From 5041a5677c8b70a1db901c44ba267167572be86d Mon Sep 17 00:00:00 2001 From: cobbspur Date: Sun, 8 Sep 2013 17:17:16 +0100 Subject: [PATCH] User Profile Image Upload closes #280 - adds image uploader to user profile page. - click on cover picture or change cover button to open file upload modal. - created new upload modal that extends model to reduce some code duplication --- ghost/admin/models/uploadModal.js | 36 +++++++++ ghost/admin/tpl/modals/uploadImage.hbs | 2 +- ghost/admin/tpl/settings/user-profile.hbs | 4 +- ghost/admin/views/settings.js | 91 ++++++++++++----------- 4 files changed, 88 insertions(+), 45 deletions(-) create mode 100644 ghost/admin/models/uploadModal.js diff --git a/ghost/admin/models/uploadModal.js b/ghost/admin/models/uploadModal.js new file mode 100644 index 0000000000..07fdeb5423 --- /dev/null +++ b/ghost/admin/models/uploadModal.js @@ -0,0 +1,36 @@ +/*global Ghost, Backbone */ +(function () { + "use strict"; + Ghost.Models.uploadModal = Backbone.Model.extend({ + + options: { + close: false, + type: "action", + style: "wide", + animation: 'fadeIn', + afterRender: function () { + this.$('.js-drop-zone').upload(); + }, + 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; + } + }); + +}()); \ No newline at end of file diff --git a/ghost/admin/tpl/modals/uploadImage.hbs b/ghost/admin/tpl/modals/uploadImage.hbs index 07f3525688..2daf864d87 100644 --- a/ghost/admin/tpl/modals/uploadImage.hbs +++ b/ghost/admin/tpl/modals/uploadImage.hbs @@ -1,4 +1,4 @@
- +
diff --git a/ghost/admin/tpl/settings/user-profile.hbs b/ghost/admin/tpl/settings/user-profile.hbs index 20f6565edd..da58a9e3d5 100644 --- a/ghost/admin/tpl/settings/user-profile.hbs +++ b/ghost/admin/tpl/settings/user-profile.hbs @@ -8,14 +8,14 @@
- +
- +