MINOR Fixed UploadField edit forms falsely expanding by default

This commit is contained in:
Ingo Schommer 2012-03-01 11:58:40 +01:00
parent f8201c48a3
commit 0b0e24b0ec

View File

@ -196,18 +196,26 @@
} }
}); });
$('div.ss-upload .ss-uploadfield-item-editform').entwine({ $('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() { toggleEditForm: function() {
jQuery(this).toggle(); if(this.height() === 0) {
this.fitHeight();
} else {
this.height(0);
}
} }
}); });
$('div.ss-upload .ss-uploadfield-item-editform iframe').entwine({ $('div.ss-upload .ss-uploadfield-item-editform iframe').entwine({
onmatch: function() { onmatch: function() {
// TODO entwine event binding doesn't work for iframes
this.load(function() { this.load(function() {
var iframe = $(this), h = iframe.contents().height(); $(this).parent().removeClass('loading');
// Set iframe to match its contents height
iframe.height(h);
// set container to match the same height
iframe.parent().removeClass('loading').height(h);
}); });
} }
}); });