From 125a0ec5bf764b8ef75c25ae9b1ada18c99fbdd0 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Fri, 3 Apr 2015 16:24:17 +0530 Subject: [PATCH] UX: dynamic invite copy --- .../javascripts/discourse/controllers/invite.js.es6 | 11 +++++++++-- config/locales/client.en.yml | 9 +++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/invite.js.es6 b/app/assets/javascripts/discourse/controllers/invite.js.es6 index ad595bb4c46..6b396130c36 100644 --- a/app/assets/javascripts/discourse/controllers/invite.js.es6 +++ b/app/assets/javascripts/discourse/controllers/invite.js.es6 @@ -87,11 +87,18 @@ export default ObjectController.extend(ModalFunctionality, { if (this.get('isMessage')) { return I18n.t('topic.invite_private.email_or_username'); } else if (this.get('invitingToTopic')) { - return I18n.t('topic.invite_reply.to_topic'); + // display instructions based on provided entity + if (this.blank('emailOrUsername')) { + return I18n.t('topic.invite_reply.to_topic_blank'); + } else if (Discourse.Utilities.emailValid(this.get('emailOrUsername'))) { + return I18n.t('topic.invite_reply.to_topic_email'); + } else { + return I18n.t('topic.invite_reply.to_topic_username'); + } } else { return I18n.t('topic.invite_reply.to_forum'); } - }.property('isMessage', 'invitingToTopic'), + }.property('isMessage', 'invitingToTopic', 'emailOrUsername'), /** Instructional text for the group selection. diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 661cf53bd15..9d4e42575b3 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -789,7 +789,7 @@ en: liked: "

{{username}} {{description}}

" private_message: "

{{username}} {{description}}

" invited_to_private_message: "

{{username}} {{description}}

" - invited_to_topic: "

{{username}} {{description}}

" + invited_to_topic: "

{{username}} {{description}}

" invitee_accepted: "

{{username}} accepted your invitation

" moved_post: "

{{username}} moved {{description}}

" linked: "

{{username}} {{description}}

" @@ -1074,10 +1074,11 @@ en: invite_reply: title: 'Invite' action: 'Send Invite' - help: 'send invitations to friends so they can reply to this topic with a single click' - to_topic: "Enter a username to send a notification to an existing user with a link to this topic. Enter an email address to -send an invitation via email that allows a new user to immediately reply to this topic." + help: 'invite others to this topic via email or notifications' to_forum: "We'll send a brief email allowing your friend to immediately join by clicking a link, no login required." + to_topic_blank: "Enter the username or email address of the person you'd like to invite to this topic." + to_topic_email: "You've entered an email address. We'll email an invitation that allows your friend to immediately reply to this topic." + to_topic_username: "You've entered a username. We'll send a notification to that user with a link inviting them to this topic." email_placeholder: 'name@example.com' success: "We mailed out an invitation to {{emailOrUsername}}. We'll notify you when the invitation is redeemed. Check the invitations tab on your user page to keep track of your invites."