silverstripe-framework/javascript/AssetUploadField.js
Kirk Mayo 561e629c16 NEW Show the allowed extensions as a toggle tip as per trac 7993
NEW Added a behat test for showing extension trac 7993
2012-12-19 17:00:39 +01:00

33 lines
829 B
JavaScript

(function($) {
$('.ss-assetuploadfield').entwine({
onmatch: function() {
this._super();
// Hide the "second step" part until we're actually uploading
this.find('.ss-uploadfield-editandorganize').hide();
},
onunmatch: function() {
this._super();
},
onfileuploadadd: function(e) {
this.find('.ss-uploadfield-editandorganize').show();
},
onfileuploadstart: function(e) {
this.find('.ss-uploadfield-editandorganize').show();
}
});
$('.ss-uploadfield-view-allowed-extensions').entwine({
onmatch: function() {
this.find('.description .toggle-content').hide();
this._super();
}
});
$('.ss-uploadfield-view-allowed-extensions .toggle').entwine({
onclick: function(e) {
jQuery(this).closest('.description').find('.toggle-content').toggle();
return false;
}
});
}(jQuery));