mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
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
This commit is contained in:
parent
fdd7354e6f
commit
213ba9c3e6
1 changed files with 5 additions and 2 deletions
|
@ -10,6 +10,7 @@ export default Ember.Controller.extend(ValidationEngine, {
|
||||||
password: null,
|
password: null,
|
||||||
image: null,
|
image: null,
|
||||||
submitting: false,
|
submitting: false,
|
||||||
|
blogCreated: false,
|
||||||
|
|
||||||
ghostPaths: Ember.inject.service('ghost-paths'),
|
ghostPaths: Ember.inject.service('ghost-paths'),
|
||||||
notifications: Ember.inject.service(),
|
notifications: Ember.inject.service(),
|
||||||
|
@ -50,14 +51,15 @@ export default Ember.Controller.extend(ValidationEngine, {
|
||||||
var self = this,
|
var self = this,
|
||||||
data = self.getProperties('blogTitle', 'name', 'email', 'password', 'image'),
|
data = self.getProperties('blogTitle', 'name', 'email', 'password', 'image'),
|
||||||
notifications = this.get('notifications'),
|
notifications = this.get('notifications'),
|
||||||
config = this.get('config');
|
config = this.get('config'),
|
||||||
|
method = (this.get('blogCreated')) ? 'PUT' : 'POST';
|
||||||
|
|
||||||
this.toggleProperty('submitting');
|
this.toggleProperty('submitting');
|
||||||
this.validate().then(function () {
|
this.validate().then(function () {
|
||||||
self.set('showError', false);
|
self.set('showError', false);
|
||||||
ajax({
|
ajax({
|
||||||
url: self.get('ghostPaths.url').api('authentication', 'setup'),
|
url: self.get('ghostPaths.url').api('authentication', 'setup'),
|
||||||
type: 'POST',
|
type: method,
|
||||||
data: {
|
data: {
|
||||||
setup: [{
|
setup: [{
|
||||||
name: data.name,
|
name: data.name,
|
||||||
|
@ -76,6 +78,7 @@ export default Ember.Controller.extend(ValidationEngine, {
|
||||||
password: self.get('password')
|
password: self.get('password')
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
self.set('password', '');
|
self.set('password', '');
|
||||||
|
self.set('blogCreated', true);
|
||||||
|
|
||||||
if (data.image) {
|
if (data.image) {
|
||||||
self.sendImage(result.users[0])
|
self.sendImage(result.users[0])
|
||||||
|
|
Loading…
Add table
Reference in a new issue