silverstripe-framework/admin/client/src/legacy/AssetUploadField.js
Ingo Schommer ee10dbb680 API Moved frontend assets into admin/ "module"
We've removed the ability to directly reference JS and CSS files
for form fields and other SilverStripe features in favour of a common bundle built by Webpack.

The logical next step is to make the framework module free of frontend dependencies,
which should simplify its operation, and avoid another time intensive "npm install" on a module.
2016-09-16 13:46:06 +12:00

30 lines
799 B
JavaScript

import $ from 'jQuery';
$('.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 .toggle').entwine({
onclick: function(e) {
var allowedExt = this.closest('.ss-uploadfield-view-allowed-extensions'),
minHeightVal = this.closest('.ui-tabs-panel').height() + 20;
allowedExt.toggleClass('active');
allowedExt.find('.toggle-content').css('minHeight', minHeightVal);
}
});