Ghost/core/client/components/gh-upload-modal.js
Hannah Wolfe 8bc84bd260 Fix button class on upload modal
no issue

- this makes sure that the cancel button on the upload modal gets the
  correct class
2014-09-24 15:26:23 +01:00

51 lines
1.5 KiB
JavaScript

import ModalDialog from 'ghost/components/gh-modal-dialog';
import upload from 'ghost/assets/lib/uploader';
var UploadModal = ModalDialog.extend({
layoutName: 'components/gh-modal-dialog',
didInsertElement: function () {
this._super();
upload.call(this.$('.js-drop-zone'), {fileStorage: this.get('config.fileStorage')});
},
confirm: {
reject: {
func: function () { // The function called on rejection
return true;
},
buttonClass: 'btn btn-default',
text: 'Cancel' // The reject button text
},
accept: {
buttonClass: 'btn btn-blue right',
text: 'Save', // The accept button texttext: 'Save'
func: function () {
var imageType = 'model.' + this.get('imageType');
if (this.$('.js-upload-url').val()) {
this.set(imageType, this.$('.js-upload-url').val());
} else {
this.set(imageType, this.$('.js-upload-target').attr('src'));
}
return true;
}
}
},
actions: {
closeModal: function () {
this.sendAction();
},
confirm: function (type) {
var func = this.get('confirm.' + type + '.func');
if (typeof func === 'function') {
func.apply(this);
}
this.sendAction();
this.sendAction('confirm' + type);
}
}
});
export default UploadModal;