first upload all files
This commit is contained in:
32
Modules/Product/Resources/assets/admin/js/Download.js
Normal file
32
Modules/Product/Resources/assets/admin/js/Download.js
Normal file
@@ -0,0 +1,32 @@
|
||||
export default class {
|
||||
constructor(download) {
|
||||
this.downloadHtml = this.getDownloadHtml(download);
|
||||
}
|
||||
|
||||
getDownloadHtml(download) {
|
||||
let template = _.template($('#product-download-template').html());
|
||||
|
||||
return $(template(download));
|
||||
}
|
||||
|
||||
render() {
|
||||
this.attachEventListeners();
|
||||
|
||||
return this.downloadHtml;
|
||||
}
|
||||
|
||||
attachEventListeners() {
|
||||
this.downloadHtml.find('.delete-row').on('click', () => {
|
||||
this.downloadHtml.remove();
|
||||
});
|
||||
|
||||
this.downloadHtml.find('.btn-choose-file').on('click', () => {
|
||||
let picker = new MediaPicker();
|
||||
|
||||
picker.on('select', (file) => {
|
||||
this.downloadHtml.find('.download-name').val(file.filename);
|
||||
this.downloadHtml.find('.download-file').val(file.id);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user