Browse Source

revert changes

pull/2227/head
trent 7 years ago
parent
commit
a9907efb1a
  1. 8
      src/asset_manager/config/config.js
  2. 8
      src/asset_manager/index.js
  3. 8
      src/asset_manager/view/FileUploader.js

8
src/asset_manager/config/config.js

@ -100,11 +100,5 @@ export default {
modalTitle: 'Select Image', modalTitle: 'Select Image',
//Default placeholder for input //Default placeholder for input
inputPlaceholder: 'http://path/to/the/image.jpg', inputPlaceholder: 'http://path/to/the/image.jpg'
//Max file size which can be uploaded in KB, 0 is no limit and default
uploadMaxFileSize: 0,
//alert text when file size limit is reached
uploadMaxFileSizeAlertText: null
}; };

8
src/asset_manager/index.js

@ -347,14 +347,6 @@ export default () => {
*/ */
onDblClick(func) { onDblClick(func) {
c.onDblClick = func; c.onDblClick = func;
},
/**
* Update config uploadMaxFileSize
* @param {int} maxKb
*/
setUploadMaxFileSize(maxKb) {
c.uploadMaxFileSize = maxKb;
} }
}; };
}; };

8
src/asset_manager/view/FileUploader.js

@ -115,20 +115,12 @@ export default Backbone.View.extend(
body.append(param, params[param]); body.append(param, params[param]);
} }
var fileSize = 0;
if (this.multiUpload) { if (this.multiUpload) {
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
body.append(`${config.uploadName}[]`, files[i]); body.append(`${config.uploadName}[]`, files[i]);
fileSize += files[i].size;
} }
} else if (files.length) { } else if (files.length) {
body.append(config.uploadName, files[0]); body.append(config.uploadName, files[0]);
fileSize += files[0].size;
}
if (config.uploadMaxFileSize > 0 && config.uploadMaxFileSize <= fileSize / 1024) {
alert(config.uploadMaxFileSizeAlertText || 'The file(s) you have selected to add exceed your space limit');
return;
} }
var target = this.target; var target = this.target;

Loading…
Cancel
Save