2013-10-02 13:39:34 +04:00
|
|
|
/*global Ghost, Backbone, $ */
|
2013-09-08 20:17:16 +04:00
|
|
|
(function () {
|
2013-09-24 14:46:30 +04:00
|
|
|
'use strict';
|
2013-10-08 19:39:07 +04:00
|
|
|
Ghost.Models.uploadModal = Ghost.TemplateModel.extend({
|
2013-09-08 20:17:16 +04:00
|
|
|
|
|
|
|
options: {
|
2013-09-17 20:24:53 +04:00
|
|
|
close: true,
|
2013-09-24 14:46:30 +04:00
|
|
|
type: 'action',
|
2013-09-17 20:24:53 +04:00
|
|
|
style: ["wide"],
|
|
|
|
animation: 'fade',
|
2013-10-31 22:02:34 +04:00
|
|
|
afterRender: function () {
|
2013-10-02 13:39:34 +04:00
|
|
|
var filestorage = $('#' + this.options.model.id).data('filestorage');
|
|
|
|
this.$('.js-drop-zone').upload({fileStorage: filestorage});
|
2013-09-08 20:17:16 +04:00
|
|
|
},
|
|
|
|
confirm: {
|
|
|
|
reject: {
|
|
|
|
func: function () { // The function called on rejection
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
buttonClass: true,
|
|
|
|
text: "Cancel" // The reject button text
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
content: {
|
|
|
|
template: 'uploadImage'
|
|
|
|
},
|
|
|
|
|
|
|
|
initialize: function (options) {
|
|
|
|
this.options.id = options.id;
|
|
|
|
this.options.key = options.key;
|
|
|
|
this.options.src = options.src;
|
|
|
|
this.options.confirm.accept = options.accept;
|
2013-10-22 09:32:25 +04:00
|
|
|
this.options.acceptEncoding = options.acceptEncoding || 'image/*';
|
2013-09-08 20:17:16 +04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-10-22 09:32:25 +04:00
|
|
|
}());
|