diff --git a/app/assets/javascripts/discourse/components/generated-invite-link.js.es6 b/app/assets/javascripts/discourse/components/generated-invite-link.js.es6 new file mode 100644 index 00000000000..be1c34fb3d2 --- /dev/null +++ b/app/assets/javascripts/discourse/components/generated-invite-link.js.es6 @@ -0,0 +1,6 @@ +export default Ember.Component.extend({ + didInsertElement() { + this._super(); + this.$('input').select().focus(); + } +}); diff --git a/app/assets/javascripts/discourse/controllers/invite.js.es6 b/app/assets/javascripts/discourse/controllers/invite.js.es6 index 03d848e6a22..e9293ea8059 100644 --- a/app/assets/javascripts/discourse/controllers/invite.js.es6 +++ b/app/assets/javascripts/discourse/controllers/invite.js.es6 @@ -1,5 +1,6 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; import { emailValid } from 'discourse/lib/utilities'; +import computed from 'ember-addons/ember-computed-decorators'; export default Ember.Controller.extend(ModalFunctionality, { userInvitedShow: Ember.inject.controller('user-invited-show'), @@ -11,6 +12,17 @@ export default Ember.Controller.extend(ModalFunctionality, { customMessage: null, inviteIcon: "envelope", + @computed('isMessage', 'invitingToTopic') + title(isMessage, invitingToTopic) { + if (isMessage) { + return 'topic.invite_private.title'; + } else if (invitingToTopic) { + return 'topic.invite_reply.title'; + } else { + return 'user.invited.create'; + } + }, + isAdmin: function(){ return Discourse.User.currentProp("admin"); }.property(), @@ -120,9 +132,7 @@ export default Ember.Controller.extend(ModalFunctionality, { }, successMessage: function() { - if (this.get('model.inviteLink')) { - return I18n.t('user.invited.generated_link_message', {inviteLink: this.get('model.inviteLink'), invitedEmail: this.get('emailOrUsername')}); - } else if (this.get('hasGroups')) { + if (this.get('hasGroups')) { return I18n.t('topic.invite_private.success_group'); } else if (this.get('isMessage')) { return I18n.t('topic.invite_private.success'); diff --git a/app/assets/javascripts/discourse/templates/components/generated-invite-link.hbs b/app/assets/javascripts/discourse/templates/components/generated-invite-link.hbs new file mode 100644 index 00000000000..09d02aae71a --- /dev/null +++ b/app/assets/javascripts/discourse/templates/components/generated-invite-link.hbs @@ -0,0 +1,5 @@ +

{{i18n "user.invited.link_generated"}}

+

+ +

+

{{i18n "user.invited.valid_for" email=email}}

diff --git a/app/assets/javascripts/discourse/templates/modal/invite.hbs b/app/assets/javascripts/discourse/templates/modal/invite.hbs index 2ffca0e33dc..b61593b1fb6 100644 --- a/app/assets/javascripts/discourse/templates/modal/invite.hbs +++ b/app/assets/javascripts/discourse/templates/modal/invite.hbs @@ -1,4 +1,4 @@ - +{{/d-modal-body}} +