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,27 +287,18 @@
|
|||||||
var editform = this.closest('.ss-uploadfield-item').find('.ss-uploadfield-item-editform');
|
var editform = this.closest('.ss-uploadfield-item').find('.ss-uploadfield-item-editform');
|
||||||
var disabled;
|
var disabled;
|
||||||
var iframe = editform.find('iframe');
|
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');
|
// Mark the row as changed if any of its form fields are edited
|
||||||
|
iframe.contents().ready(function() {
|
||||||
for(var i=0;i<inputs.length;i++){
|
// Need to use the iframe's own jQuery, as custom event triggers
|
||||||
$(inputs[i]).change(function(){
|
// (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.removeClass('edited');
|
||||||
editform.addClass('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')) {
|
if (editform.hasClass('loading')) {
|
||||||
// TODO Display loading indication, and register an event to toggle edit form
|
// TODO Display loading indication, and register an event to toggle edit form
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user