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:
Loz Calver 2013-07-04 15:57:35 +01:00
parent a862b4da99
commit 041f5f51a5

View File

@ -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;