mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-03-24 05:42:03 -04:00
FIX: Hitting enter while the invite dialog is up should submit the form, not refresh the
entire page :)
This commit is contained in:
parent
b062b4a98e
commit
06e83c9e6a
7 changed files with 18 additions and 21 deletions
app/assets/javascripts/discourse
|
@ -26,6 +26,8 @@ Discourse.InviteController = Discourse.ObjectController.extend(Discourse.ModalFu
|
|||
}.property('email'),
|
||||
|
||||
createInvite: function() {
|
||||
if (this.get('disabled')) return;
|
||||
|
||||
var inviteController = this;
|
||||
this.set('saving', true);
|
||||
this.set('error', false);
|
||||
|
|
|
@ -20,6 +20,9 @@ Discourse.InvitePrivateController = Discourse.ObjectController.extend(Discourse.
|
|||
}.property('saving'),
|
||||
|
||||
invite: function() {
|
||||
|
||||
if (this.get('disabled')) return;
|
||||
|
||||
var invitePrivateController = this;
|
||||
this.set('saving', true);
|
||||
this.set('error', false);
|
||||
|
|
|
@ -9,10 +9,8 @@
|
|||
{{#if finished}}
|
||||
{{{successMessage}}}
|
||||
{{else}}
|
||||
<form>
|
||||
<label>{{i18n topic.invite_reply.email}}</label>
|
||||
{{textField value=email placeholderKey="topic.invite_reply.email_placeholder"}}
|
||||
</form>
|
||||
<label>{{i18n topic.invite_reply.email}}</label>
|
||||
{{textField value=email placeholderKey="topic.invite_reply.email_placeholder"}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
|
|
@ -9,10 +9,8 @@
|
|||
{{#if finished}}
|
||||
{{i18n topic.invite_private.success}}
|
||||
{{else}}
|
||||
<form>
|
||||
<label>{{i18n topic.invite_private.email_or_username}}</label>
|
||||
{{textField value=emailOrUsername placeholderKey="topic.invite_private.email_or_username_placeholder"}}
|
||||
</form>
|
||||
<label>{{i18n topic.invite_private.email_or_username}}</label>
|
||||
{{textField value=emailOrUsername placeholderKey="topic.invite_private.email_or_username_placeholder"}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
|
|
@ -10,12 +10,10 @@ Discourse.InvitePrivateView = Discourse.ModalBodyView.extend({
|
|||
templateName: 'modal/invite_private',
|
||||
title: Em.String.i18n('topic.invite_private.title'),
|
||||
|
||||
didInsertElement: function() {
|
||||
this._super();
|
||||
var invitePrivateModalView = this;
|
||||
Em.run.schedule('afterRender', function() {
|
||||
invitePrivateModalView.$('input').focus();
|
||||
});
|
||||
keyUp: function(e) {
|
||||
// Add the invitee if they hit enter
|
||||
if (e.keyCode === 13) { this.get('controller').invite(); }
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -10,13 +10,11 @@ Discourse.InviteView = Discourse.ModalBodyView.extend({
|
|||
templateName: 'modal/invite',
|
||||
title: Em.String.i18n('topic.invite_reply.title'),
|
||||
|
||||
didInsertElement: function() {
|
||||
this._super();
|
||||
|
||||
var inviteModalView = this;
|
||||
Em.run.schedule('afterRender', function() {
|
||||
inviteModalView.$('input').focus();
|
||||
});
|
||||
keyUp: function(e) {
|
||||
// Add the invitee if they hit enter
|
||||
if (e.keyCode === 13) { this.get('controller').createInvite(); }
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ Discourse.ModalBodyView = Discourse.View.extend({
|
|||
|
||||
var modalBodyView = this;
|
||||
Em.run.schedule('afterRender', function() {
|
||||
modalBodyView.$('form input:first').focus();
|
||||
modalBodyView.$('input:first').focus();
|
||||
});
|
||||
|
||||
var title = this.get('title');
|
||||
|
|
Loading…
Add table
Reference in a new issue