Permalink
Browse files

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
  • Loading branch information...
1 parent a862b4d commit 041f5f51a54b38d04403ac49fb7b9eb5b87f1d04 @kinglozzer kinglozzer committed Jul 4, 2013
Showing with 9 additions and 1 deletion.
  1. +9 −1 javascript/UploadField.js
View
@@ -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;

0 comments on commit 041f5f5

Please sign in to comment.