mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX: UploadField action buttons aren't disabled when editing an item
Toggle disabled classes/attributes based on form visibility instead of .toggle() Use jQuery.attr() simply because it looks nicer
This commit is contained in:
parent
a862b4da99
commit
041f5f51a5
@ -383,6 +383,7 @@
|
||||
$( 'div.ss-upload:not(.disabled):not(.readonly) .ss-uploadfield-item-edit').entwine({
|
||||
onclick: function(e) {
|
||||
var editform = this.closest('.ss-uploadfield-item').find('.ss-uploadfield-item-editform');
|
||||
var itemInfo = editform.prev('.ss-uploadfield-item-info');
|
||||
var disabled;
|
||||
var iframe = editform.find('iframe');
|
||||
|
||||
@ -406,8 +407,15 @@
|
||||
disabled=this.find('ss-uploadfield-item-edit').siblings();
|
||||
}
|
||||
editform.parent('.ss-uploadfield-item').removeClass('ui-state-warning');
|
||||
disabled.toggleClass('ui-state-disabled');
|
||||
editform.toggleEditForm();
|
||||
|
||||
if (itemInfo.find('.toggle-details-icon').hasClass('opened')) {
|
||||
disabled.addClass('ui-state-disabled');
|
||||
disabled.attr('disabled', 'disabled');
|
||||
} else {
|
||||
disabled.removeClass('ui-state-disabled');
|
||||
disabled.removeAttr('disabled');
|
||||
}
|
||||
}
|
||||
e.preventDefault(); // Avoid a form submit
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user