MINOR Simplified edit form toggle in UploadField.js, prevent new <button> element trigger from submitting the form

This commit is contained in:
Ingo Schommer 2012-02-23 17:31:28 +01:00
parent 8b6ef6599e
commit ddf4791708

View File

@ -192,32 +192,22 @@
this.siblings().toggleClass('ui-state-disabled');
editform.toggleEditForm();
}
e.preventDefault(); // Avoid a form submit
}
});
$('div.ss-upload .ss-uploadfield-item-editform').entwine({
EditFormVisible: false,
fitHeight: function() {
var iframe = this.find('iframe'),
h = iframe.contents().height() + 'px';
iframe.css('height', h);
return h;
},
showEditForm: function() {
return this.stop().animate({height: this.fitHeight()});
},
hideEditFormShow: function() {
return this.stop().animate({height: 0});
},
toggleEditForm: function() {
if (this.getEditFormVisible()) this.hideEditFormShow();
else this.showEditForm();
this.setEditFormVisible(!this.getEditFormVisible());
jQuery(this).toggle();
}
});
$('div.ss-upload .ss-uploadfield-item-editform iframe').entwine({
onmatch: function() {
this.load(function() {
$(this).parent().removeClass('loading');
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);
});
}
});