From 5e5f4d3999cc42846be06c6c531615bd35d78b1a Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Thu, 20 Aug 2015 10:39:29 -0400 Subject: Skipping invite members step when email is disabled. Cosmetic refactoring included. --- .../components/team_signup_send_invites_page.jsx | 116 +++++++++++++++------ 1 file changed, 87 insertions(+), 29 deletions(-) (limited to 'web') diff --git a/web/react/components/team_signup_send_invites_page.jsx b/web/react/components/team_signup_send_invites_page.jsx index 4bc03798b..a1e12661e 100644 --- a/web/react/components/team_signup_send_invites_page.jsx +++ b/web/react/components/team_signup_send_invites_page.jsx @@ -6,13 +6,18 @@ var utils = require('../utils/utils.jsx'); var ConfigStore = require('../stores/config_store.jsx'); var client = require('../utils/client.jsx'); -module.exports = React.createClass({ - displayName: 'TeamSignupSendInivtesPage', - propTypes: { - state: React.PropTypes.object, - updateParent: React.PropTypes.func - }, - submitBack: function(e) { +export default class TeamSignupSendInvitesPage extends React.Component { + constructor(props) { + super(props); + this.submitBack = this.submitBack.bind(this); + this.submitNext = this.submitNext.bind(this); + this.submitAddInvite = this.submitAddInvite.bind(this); + this.submitSkip = this.submitSkip.bind(this); + this.state = { + emailEnabled: !ConfigStore.getSettingAsBoolean('ByPassEmail', false) + }; + } + submitBack(e) { e.preventDefault(); if (config.AllowSignupDomainsWizard) { @@ -22,8 +27,8 @@ module.exports = React.createClass({ } this.props.updateParent(this.props.state); - }, - submitNext: function(e) { + } + submitNext(e) { e.preventDefault(); var valid = true; @@ -48,8 +53,8 @@ module.exports = React.createClass({ this.props.state.wizard = 'username'; this.props.updateParent(this.props.state); } - }, - submitAddInvite: function(e) { + } + submitAddInvite(e) { e.preventDefault(); this.props.state.wizard = 'send_invites'; if (!this.props.state.invites) { @@ -57,18 +62,19 @@ module.exports = React.createClass({ } this.props.state.invites.push(''); this.props.updateParent(this.props.state); - }, - submitSkip: function(e) { + } + submitSkip(e) { e.preventDefault(); this.props.state.wizard = 'username'; this.props.updateParent(this.props.state); - }, - getInitialState: function() { - return { - emailEnabled: !ConfigStore.getSettingAsBoolean('ByPassEmail', false) - }; - }, - render: function() { + } + componentWillMount() { + if (!this.state.emailEnabled) { + this.props.state.wizard = 'username'; + this.props.updateParent(this.props.state); + } + } + render() { client.track('signup', 'signup_team_05_send_invites'); var content = null; @@ -79,43 +85,95 @@ module.exports = React.createClass({ for (var i = 0; i < this.props.state.invites.length; i++) { if (i === 0) { - emails.push(); + emails.push( + + ); } else { - emails.push(); + emails.push( + + ); } } content = ( ); bottomContent = ( -

{'if you prefer, you can invite ' + strings.Team + ' members later'}
and skip this step for now.

+

+ {'if you prefer, you can invite ' + strings.Team + ' members later'} +
+ {' and '} + + {'skip this step '} + + {'for now.'} +

); } else { content = ( -
{'Email is currently disabled for your ' + strings.Team + ', and emails cannot be sent. Contact your system administrator to enable email and email invitations.'}
+
+ {'Email is currently disabled for your ' + strings.Team + ', and emails cannot be sent. Contact your system administrator to enable email and email invitations.'} +
); } return (
- +

{'Invite ' + utils.toTitleCase(strings.Team) + ' Members'}

{content}
- +
{bottomContent}
); } -}); +} +TeamSignupSendInvitesPage.propTypes = { + state: React.PropTypes.object.isRequired, + updateParent: React.PropTypes.func.isRequired +}; -- cgit v1.2.3-1-g7c22 From e0a525ebe74eee95b7f142d36920668f5da30061 Mon Sep 17 00:00:00 2001 From: nickago Date: Thu, 20 Aug 2015 10:44:22 -0700 Subject: Fixed this/self typo --- web/react/components/file_upload.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web') diff --git a/web/react/components/file_upload.jsx b/web/react/components/file_upload.jsx index 7497ec330..e77982559 100644 --- a/web/react/components/file_upload.jsx +++ b/web/react/components/file_upload.jsx @@ -219,7 +219,7 @@ module.exports = React.createClass({ continue; } - var channelId = this.props.channelId || ChannelStore.getCurrentId(); + var channelId = self.props.channelId || ChannelStore.getCurrentId(); // generate a unique id that can be used by other components to refer back to this file upload var clientId = utils.generateId(); -- cgit v1.2.3-1-g7c22