diff --git a/ghost/admin/components/gh-upload-modal.js b/ghost/admin/components/gh-upload-modal.js
index a93a85507d..d5a6775290 100644
--- a/ghost/admin/components/gh-upload-modal.js
+++ b/ghost/admin/components/gh-upload-modal.js
@@ -1,17 +1,36 @@
-/*global console */
-
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();
+ var filestorage = $('#general').data('filestorage');
+ upload.call(this.$('.js-drop-zone'), {fileStorage: filestorage});
+ },
+ confirm: {
+ reject: {
+ func: function () { // The function called on rejection
+ return true;
+ },
+ buttonClass: true,
+ text: 'Cancel' // The reject button text
+ },
+ accept: {
+ buttonClass: 'button-save right',
+ text: 'Save', // The accept button texttext: 'Save'
+ func: function () {
+ var imageType = 'model.' + this.get('imageType');
- // @TODO: get this real
- console.log('UploadController:afterRender');
- // var filestorage = $('#' + this.options.model.id).data('filestorage');
- // this.$('.js-drop-zone').upload({fileStorage: filestorage});
+ 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: {
@@ -21,12 +40,11 @@ var UploadModal = ModalDialog.extend({
confirm: function (type) {
var func = this.get('confirm.' + type + '.func');
if (typeof func === 'function') {
- func();
+ func.apply(this);
}
this.sendAction();
}
- },
-
+ }
});
export default UploadModal;
diff --git a/ghost/admin/controllers/modals/upload.js b/ghost/admin/controllers/modals/upload.js
index c224440eea..953dfe2bb7 100644
--- a/ghost/admin/controllers/modals/upload.js
+++ b/ghost/admin/controllers/modals/upload.js
@@ -1,5 +1,6 @@
var UploadController = Ember.Controller.extend({
+ acceptEncoding: 'image/*',
actions: {
confirmReject: function () {
return true;
diff --git a/ghost/admin/fixtures/settings.js b/ghost/admin/fixtures/settings.js
index 2339c5485b..7aa4642a49 100644
--- a/ghost/admin/fixtures/settings.js
+++ b/ghost/admin/fixtures/settings.js
@@ -3,8 +3,8 @@ var settings = {
"title": "Ghost",
"description": "Just a blogging platform.",
"email": "ghost@tryghost.org",
- "logo": "",
- "cover": "",
+ "logo": "http://media-cache-ec0.pinimg.com/236x/be/35/06/be35065e6f9a613d4a7661a6f45d0831.jpg",
+ "cover": "http://i906.photobucket.com/albums/ac267/df853/bring_me_a_shrubbery_cat.jpg",
"defaultLang": "en_US",
"postsPerPage": "6",
"forceI18n": "true",
@@ -23,4 +23,4 @@ var settings = {
};
export default settings;
-/* jshint ignore:end */
\ No newline at end of file
+/* jshint ignore:end */
diff --git a/ghost/admin/routes/application.js b/ghost/admin/routes/application.js
index 0e4c7a5a7e..5afffb2aab 100644
--- a/ghost/admin/routes/application.js
+++ b/ghost/admin/routes/application.js
@@ -24,12 +24,14 @@ var ApplicationRoute = Ember.Route.extend({
this.set('controller.user', null);
},
- openModal: function (modalName, model) {
+ openModal: function (modalName, model, type) {
modalName = 'modals/' + modalName;
// We don't always require a modal to have a controller
// so we're skipping asserting if one exists
if (this.controllerFor(modalName, true)) {
this.controllerFor(modalName).set('model', model);
+ this.controllerFor(modalName).set('imageType', type);
+ this.controllerFor(modalName).set('src', model.get(type));
}
return this.render(modalName, {
into: 'application',
@@ -58,4 +60,4 @@ var ApplicationRoute = Ember.Route.extend({
}
});
-export default ApplicationRoute;
\ No newline at end of file
+export default ApplicationRoute;
diff --git a/ghost/admin/templates/components/gh-file-upload.hbs b/ghost/admin/templates/components/gh-file-upload.hbs
index 8388128d2c..9aa605e4ca 100644
--- a/ghost/admin/templates/components/gh-file-upload.hbs
+++ b/ghost/admin/templates/components/gh-file-upload.hbs
@@ -1,2 +1,4 @@
-
-
+
+
+
-
+
Display a sexy logo for your publication