mirror of
https://github.com/TryGhost/Ghost-Admin.git
synced 2023-12-14 02:33:04 +01:00
Merge pull request #5634 from acburdine/onboard-fixes
Fixes in setup/three
This commit is contained in:
commit
bca7b173ff
2 changed files with 15 additions and 6 deletions
|
@ -3,8 +3,12 @@ import DS from 'ember-data';
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
notifications: Ember.inject.service(),
|
notifications: Ember.inject.service(),
|
||||||
|
two: Ember.inject.controller('setup/two'),
|
||||||
|
|
||||||
errors: DS.Errors.create(),
|
errors: DS.Errors.create(),
|
||||||
users: '',
|
users: '',
|
||||||
|
|
||||||
|
ownerEmail: Ember.computed.alias('two.email'),
|
||||||
usersArray: Ember.computed('users', function () {
|
usersArray: Ember.computed('users', function () {
|
||||||
var users = this.get('users').split('\n').filter(function (email) {
|
var users = this.get('users').split('\n').filter(function (email) {
|
||||||
return email.trim().length > 0;
|
return email.trim().length > 0;
|
||||||
|
@ -17,11 +21,12 @@ export default Ember.Controller.extend({
|
||||||
return validator.isEmail(user);
|
return validator.isEmail(user);
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
validateUsers: Ember.computed('usersArray', function () {
|
validateUsers: Ember.computed('usersArray', 'ownerEmail', function () {
|
||||||
var errors = [];
|
var errors = [],
|
||||||
|
self = this;
|
||||||
|
|
||||||
this.get('usersArray').forEach(function (user) {
|
this.get('usersArray').forEach(function (user) {
|
||||||
if (!validator.isEmail(user)) {
|
if (!validator.isEmail(user) || user === self.get('ownerEmail')) {
|
||||||
errors.push({
|
errors.push({
|
||||||
user: user,
|
user: user,
|
||||||
error: 'email'
|
error: 'email'
|
||||||
|
@ -115,6 +120,7 @@ export default Ember.Controller.extend({
|
||||||
invitationsString = successCount > 1 ? 'invitations' : 'invitation';
|
invitationsString = successCount > 1 ? 'invitations' : 'invitation';
|
||||||
|
|
||||||
notifications.showAlert(successCount + ' ' + invitationsString + ' sent!', {type: 'success', delayed: true});
|
notifications.showAlert(successCount + ' ' + invitationsString + ' sent!', {type: 'success', delayed: true});
|
||||||
|
self.send('loadServerNotifications');
|
||||||
self.transitionTo('posts.index');
|
self.transitionTo('posts.index');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -130,7 +136,10 @@ export default Ember.Controller.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
skipInvite: function () {
|
||||||
|
this.send('loadServerNotifications');
|
||||||
|
this.transitionTo('posts.index');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,6 @@
|
||||||
<button {{action 'invite'}} class="btn btn-default btn-lg btn-block {{buttonClass}}">
|
<button {{action 'invite'}} class="btn btn-default btn-lg btn-block {{buttonClass}}">
|
||||||
{{buttonText}}
|
{{buttonText}}
|
||||||
</button>
|
</button>
|
||||||
{{#link-to "posts" class="gh-flow-skip"}}
|
<button class="gh-flow-skip" {{action "skipInvite"}}>
|
||||||
I'll do this later, take me to my blog!
|
I'll do this later, take me to my blog!
|
||||||
{{/link-to}}
|
</button>
|
||||||
|
|
Loading…
Reference in a new issue