Permalink
Browse files

MINOR Fixed UploadField edit forms falsely expanding by default

  • Loading branch information...
1 parent f8201c4 commit 0b0e24b0ecab7ea1f9ddbe7a599d347e7319401c @chillu chillu committed Mar 1, 2012
Showing with 14 additions and 6 deletions.
  1. +14 −6 javascript/UploadField.js
View
@@ -196,18 +196,26 @@
}
});
$('div.ss-upload .ss-uploadfield-item-editform').entwine({
+ fitHeight: function() {
+ var iframe = this.find('iframe'), h = iframe.contents().height();
+ // Set iframe to match its contents height
+ iframe.height(h);
+ // set container to match the same height
+ iframe.parent().height(h);
+ },
toggleEditForm: function() {
- jQuery(this).toggle();
+ if(this.height() === 0) {
+ this.fitHeight();
+ } else {
+ this.height(0);
+ }
}
});
$('div.ss-upload .ss-uploadfield-item-editform iframe').entwine({
onmatch: function() {
+ // TODO entwine event binding doesn't work for iframes
this.load(function() {
- var iframe = $(this), h = iframe.contents().height();
- // Set iframe to match its contents height
- iframe.height(h);
- // set container to match the same height
- iframe.parent().removeClass('loading').height(h);
+ $(this).parent().removeClass('loading');
});
}
});

0 comments on commit 0b0e24b

Please sign in to comment.