Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR Simplified edit form toggle in UploadField.js, prevent new <but…

…ton> element trigger from submitting the form
  • Loading branch information...
commit ddf479170880d3254e76f61e5c1141248974910a 1 parent 8b6ef65
@chillu chillu authored
Showing with 7 additions and 17 deletions.
  1. +7 −17 javascript/UploadField.js
View
24 javascript/UploadField.js
@@ -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);
});
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.