0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Return to invite new user; invite multiple users in one go

Closes #3533, Closes #3547, Closes #3531
- invite-new-user always resets role to author now, allowing for multiple invites on one load
- Added confirm action when hitting return in INUModal's email input
- Don't pass users as the model to invite-new-user-modal
- Move invite-new-user reset to a `finally` clause
- invite-new-user always closes on a confirm
This commit is contained in:
Matt Enlow 2014-08-01 17:12:12 -06:00
parent ec1dc0e24a
commit cb2f911b07
3 changed files with 10 additions and 5 deletions

View file

@ -6,6 +6,7 @@ var InviteNewUserController = Ember.Controller.extend({
var authorRole = roles.findBy('name', 'Author'); var authorRole = roles.findBy('name', 'Author');
//Initialize role as well. //Initialize role as well.
self.set('role', authorRole); self.set('role', authorRole);
self.set('authorRole', authorRole);
return authorRole; return authorRole;
}); });
}), }),
@ -51,10 +52,14 @@ var InviteNewUserController = Ember.Controller.extend({
newUser.deleteRecord(); newUser.deleteRecord();
self.notifications.closePassive(); self.notifications.closePassive();
self.notifications.showErrors(errors); self.notifications.showErrors(errors);
}).finally(function () {
//Reset
self.set('email', '');
self.set('role', self.get('authorRole'));
//Make sure the modal closes on confirm, no matter the
//method used to close it (enter in input vs Confirm click)
self.send('closeModal');
}); });
self.set('email', null);
self.set('role', null);
}, },
confirmReject: function () { confirmReject: function () {

View file

@ -4,7 +4,7 @@
<fieldset> <fieldset>
<div class="form-group"> <div class="form-group">
<label for="new-user-email">Email Address</label> <label for="new-user-email">Email Address</label>
{{input class="email" id="new-user-email" type="email" placeholder="Email Address" name="email" autofocus="autofocus" {{input action="confirmAccept" class="email" id="new-user-email" type="email" placeholder="Email Address" name="email" autofocus="autofocus"
autocapitalize="off" autocorrect="off" value=email}} autocapitalize="off" autocorrect="off" value=email}}
</div> </div>

View file

@ -2,7 +2,7 @@
{{#link-to 'settings' class='button-back button'}}Back{{/link-to}} {{#link-to 'settings' class='button-back button'}}Back{{/link-to}}
<h2 class="title">Users</h2> <h2 class="title">Users</h2>
<section class="page-actions"> <section class="page-actions">
<button class="button-add" {{action "openModal" "invite-new-user" this}} >New&nbsp;User</button> <button class="button-add" {{action "openModal" "invite-new-user"}} >New&nbsp;User</button>
</section> </section>
</header> </header>