diff --git a/client/my-sites/people/controller.js b/client/my-sites/people/controller.js index ea767817d7fcb3..507cf1aa5ab77c 100644 --- a/client/my-sites/people/controller.js +++ b/client/my-sites/people/controller.js @@ -77,6 +77,8 @@ function renderInvitePeople( context ) { sites.once( 'change', () => page( context.path ) ); } + titleActions.setTitle( i18n.translate( 'Invite People', { textOnly: true } ), { siteID: route.getSiteFragment( context.path ) } ); + ReactDom.render( React.createElement( InvitePeople, { site: sites.getSelectedSite() diff --git a/client/my-sites/people/invite-people/index.jsx b/client/my-sites/people/invite-people/index.jsx index dc2c86dac38a12..b123ecbc2e275d 100644 --- a/client/my-sites/people/invite-people/index.jsx +++ b/client/my-sites/people/invite-people/index.jsx @@ -1,12 +1,25 @@ +/** + * External dependencies + */ import React from 'react'; import LinkedStateMixin from 'react-addons-linked-state-mixin'; +import page from 'page'; +import get from 'lodash/object/get'; +/** + * Internal dependencies + */ import RoleSelect from 'my-sites/people/role-select'; import TokenField from 'components/token-field'; import FormTextArea from 'components/forms/form-textarea'; import FormButton from 'components/forms/form-button'; +import FormFieldset from 'components/forms/form-fieldset'; +import FormLabel from 'components/forms/form-label'; +import FormSettingExplanation from 'components/forms/form-setting-explanation'; import { sendInvites } from 'lib/invites/actions'; import Card from 'components/card'; +import Main from 'components/main'; +import HeaderCake from 'components/header-cake'; export default React.createClass( { displayName: 'InvitePeople', @@ -35,7 +48,9 @@ export default React.createClass( { this.setState( { usernamesOrEmails: tokens } ); }, - submitForm() { + submitForm( event ) { + event.preventDefault(); + this.setState( { sendingInvites: true } ); sendInvites( this.props.site.ID, this.state.usernamesOrEmails, this.state.role, this.state.message, ( error, data ) => { this.setState( { @@ -45,6 +60,21 @@ export default React.createClass( { } ); }, + goBack() { + const siteSlug = get( this.props, 'site.slug' ); + const fallback = siteSlug ? ( '/people/team/' + siteSlug ) : '/people/team'; + // Go back to last route with /people/team/$site as the fallback + page.back( fallback ); + }, + + renderRoleExplanation() { + return ( + + { this.translate( 'Learn more about roles' ) } + + ); + }, + renderResponse() { return ( @@ -59,37 +89,60 @@ export default React.createClass( { }, render() { - if ( this.props.site.jetpack ) { - return (

Invites not currently available for Jetpack sites.

); - } return ( -
+
+ - - - - - - - - Send Invites - +
+ + { this.translate( 'Usernames or Emails' ) } + + + { this.translate( + 'Invite up to 10 email addresses and/or WordPress.com usernames.. ' + + 'Those needing a username will be sent instructions on how to create one.' + ) } + + + + + + + { this.translate( 'Custom Message' ) } + + + { this.translate( + '(Optional) You can enter a custom message of up to 500 characters that will be included in the invitation to the user(s).' + ) } + + + + + { this.translate( + 'Send Invitation', + 'Send Invitations', { + count: this.state.usernamesOrEmails.length || 1, + context: 'Button label' + } + ) } + +
{ this.state.response && this.renderResponse() } -
+ ); } } ); diff --git a/client/my-sites/people/role-select/README.md b/client/my-sites/people/role-select/README.md index 36c7e4d66982c9..54c7a480834f12 100644 --- a/client/my-sites/people/role-select/README.md +++ b/client/my-sites/people/role-select/README.md @@ -2,3 +2,7 @@ RoleSelect ================ This component listens to changes from the `RolesStore` and displays a select of the roles for a site. + +### Props +* siteId - (int) siteId for site from which to fetch roles +* explanation - (string) Optional explanation to be displayed below select in a FormSettingExplanation diff --git a/client/my-sites/people/role-select/index.jsx b/client/my-sites/people/role-select/index.jsx index 111129f0f998fd..a04d861faee610 100644 --- a/client/my-sites/people/role-select/index.jsx +++ b/client/my-sites/people/role-select/index.jsx @@ -10,7 +10,8 @@ var RolesStore = require( 'lib/site-roles/store' ), RolesActions = require( 'lib/site-roles/actions' ), FormFieldset = require( 'components/forms/form-fieldset' ), FormLabel = require( 'components/forms/form-label' ), - FormSelect = require( 'components/forms/form-select' ); + FormSelect = require( 'components/forms/form-select' ), + FormSettingExplanation = require( 'components/forms/form-setting-explanation' ); var debug = debugFactory( 'calypso:role-select' ); @@ -90,6 +91,11 @@ module.exports = React.createClass( { } ) } + { this.props.explanation && + + { this.props.explanation } + + } ); }