From 213ba9c3e6dee331f9514a6bca401d69dfe193fb Mon Sep 17 00:00:00 2001 From: Rem Zolotykh Date: Fri, 10 Jul 2015 01:54:02 +0200 Subject: [PATCH] Allow editing blog details on setup closes #5526 - when user creates blog we set `blogCreated` flag to true and depending on it make `POST` or `PUT` request --- core/client/app/controllers/setup/two.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/client/app/controllers/setup/two.js b/core/client/app/controllers/setup/two.js index 8a90572f01..251d873470 100644 --- a/core/client/app/controllers/setup/two.js +++ b/core/client/app/controllers/setup/two.js @@ -10,6 +10,7 @@ export default Ember.Controller.extend(ValidationEngine, { password: null, image: null, submitting: false, + blogCreated: false, ghostPaths: Ember.inject.service('ghost-paths'), notifications: Ember.inject.service(), @@ -50,14 +51,15 @@ export default Ember.Controller.extend(ValidationEngine, { var self = this, data = self.getProperties('blogTitle', 'name', 'email', 'password', 'image'), notifications = this.get('notifications'), - config = this.get('config'); + config = this.get('config'), + method = (this.get('blogCreated')) ? 'PUT' : 'POST'; this.toggleProperty('submitting'); this.validate().then(function () { self.set('showError', false); ajax({ url: self.get('ghostPaths.url').api('authentication', 'setup'), - type: 'POST', + type: method, data: { setup: [{ name: data.name, @@ -76,6 +78,7 @@ export default Ember.Controller.extend(ValidationEngine, { password: self.get('password') }).then(function () { self.set('password', ''); + self.set('blogCreated', true); if (data.image) { self.sendImage(result.users[0])