mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Removing special case handling for chosen.js from UploadField, using generic change listener (incl. some iframe scoping fixes)
This commit is contained in:
parent
8e7d221ce2
commit
3f19f4cec0
@ -287,26 +287,17 @@
|
||||
var editform = this.closest('.ss-uploadfield-item').find('.ss-uploadfield-item-editform');
|
||||
var disabled;
|
||||
var iframe = editform.find('iframe');
|
||||
var inputs = iframe.contents().find('.ss-uploadfield-edit-iframe input');
|
||||
var ulSelects =iframe.contents().find('.ss-uploadfield-edit-iframe .chzn-drop ul.chzn-results');
|
||||
|
||||
for(var i=0;i<inputs.length;i++){
|
||||
$(inputs[i]).change(function(){
|
||||
// Mark the row as changed if any of its form fields are edited
|
||||
iframe.contents().ready(function() {
|
||||
// Need to use the iframe's own jQuery, as custom event triggers
|
||||
// (e.g. from TreeDropdownField) can't be captured by the parent jQuery object.
|
||||
var iframe_jQuery = iframe.get(0).contentWindow.jQuery;
|
||||
iframe_jQuery(iframe_jQuery.find(':input')).bind('change', function(e){
|
||||
editform.removeClass('edited');
|
||||
editform.addClass('edited');
|
||||
});
|
||||
|
||||
}
|
||||
for(var i=0;i<ulSelects.length;i++){
|
||||
var current= $(ulSelects[i]).find('li.result-selected');
|
||||
$(ulSelects[i]).children('li').click(function(){
|
||||
if(this !== current[0]){
|
||||
editform.removeClass('edited');
|
||||
editform.addClass('edited');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (editform.hasClass('loading')) {
|
||||
// TODO Display loading indication, and register an event to toggle edit form
|
||||
|
Loading…
Reference in New Issue
Block a user