diff options
author | Jack <jackdeng@gmail.com> | 2015-09-22 08:16:51 -0700 |
---|---|---|
committer | Jack <jackdeng@gmail.com> | 2015-09-22 08:16:51 -0700 |
commit | 602bed85f2b32733f73e2edddb542fa36baac462 (patch) | |
tree | 06a6ee9b609a9122bc2f0e6f6e6300f9ba79a3aa /web/react/components/navbar_dropdown.jsx | |
parent | a31868336f97a91bfd5a7e91e99a9b294d131f90 (diff) | |
parent | f439c82d7c885b4c530ba9da0a41b17910743b55 (diff) | |
download | chat-602bed85f2b32733f73e2edddb542fa36baac462.tar.gz chat-602bed85f2b32733f73e2edddb542fa36baac462.tar.bz2 chat-602bed85f2b32733f73e2edddb542fa36baac462.zip |
fix conflict
Diffstat (limited to 'web/react/components/navbar_dropdown.jsx')
-rw-r--r-- | web/react/components/navbar_dropdown.jsx | 75 |
1 files changed, 49 insertions, 26 deletions
diff --git a/web/react/components/navbar_dropdown.jsx b/web/react/components/navbar_dropdown.jsx index b7566cfb9..4c01d2c43 100644 --- a/web/react/components/navbar_dropdown.jsx +++ b/web/react/components/navbar_dropdown.jsx @@ -30,12 +30,12 @@ export default class NavbarDropdown extends React.Component { UserStore.addTeamsChangeListener(this.onListenerChange); TeamStore.addChangeListener(this.onListenerChange); - $(React.findDOMNode(this.refs.dropdown)).on('hide.bs.dropdown', function resetDropdown() { + $(React.findDOMNode(this.refs.dropdown)).on('hide.bs.dropdown', () => { this.blockToggle = true; - setTimeout(function blockTimeout() { + setTimeout(() => { this.blockToggle = false; - }.bind(this), 100); - }.bind(this)); + }, 100); + }); } componentWillUnmount() { UserStore.removeTeamsChangeListener(this.onListenerChange); @@ -53,12 +53,16 @@ export default class NavbarDropdown extends React.Component { var teamLink = ''; var inviteLink = ''; var manageLink = ''; + var sysAdminLink = ''; + var adminDivider = ''; var currentUser = UserStore.getCurrentUser(); var isAdmin = false; + var isSystemAdmin = false; var teamSettings = null; if (currentUser != null) { - isAdmin = currentUser.roles.indexOf('admin') > -1; + isAdmin = Utils.isAdmin(currentUser.roles); + isSystemAdmin = Utils.isInRole(currentUser.roles, 'system_admin'); inviteLink = ( <li> @@ -67,7 +71,7 @@ export default class NavbarDropdown extends React.Component { data-toggle='modal' data-target='#invite_member' > - Invite New Member + {'Invite New Member'} </a> </li> ); @@ -82,7 +86,7 @@ export default class NavbarDropdown extends React.Component { data-title='Team Invite' data-value={Utils.getWindowLocationOrigin() + '/signup_user_complete/?id=' + currentUser.team_id} > - Get Team Invite Link + {'Get Team Invite Link'} </a> </li> ); @@ -97,19 +101,36 @@ export default class NavbarDropdown extends React.Component { data-toggle='modal' data-target='#team_members' > - Manage Team + {'Manage Team'} + </a> + </li> + ); + + adminDivider = (<li className='divider'></li>); + + teamSettings = ( + <li> + <a + href='#' + data-toggle='modal' + data-target='#team_settings' + > + {'Team Settings'} + </a> + </li> + ); + } + + if (isSystemAdmin) { + sysAdminLink = ( + <li> + <a + href='/admin_console' + > + {'System Console'} </a> </li> ); - teamSettings = (<li> - <a - href='#' - data-toggle='modal' - data-target='#team_settings' - > - Team Settings - </a> - </li>); } var teams = []; @@ -123,9 +144,9 @@ export default class NavbarDropdown extends React.Component { ); if (this.state.teams.length > 1 && this.state.currentTeam) { var curTeamName = this.state.currentTeam.name; - this.state.teams.forEach(function listTeams(teamName) { + this.state.teams.forEach((teamName) => { if (teamName !== curTeamName) { - teams.push(<li key={teamName}><a href={Utils.getWindowLocationOrigin() + '/' + teamName}>Switch to {teamName}</a></li>); + teams.push(<li key={teamName}><a href={Utils.getWindowLocationOrigin() + '/' + teamName}>{'Switch to ' + teamName}</a></li>); } }); } @@ -135,7 +156,7 @@ export default class NavbarDropdown extends React.Component { target='_blank' href={Utils.getWindowLocationOrigin() + '/signup_team'} > - Create a New Team + {'Create a New Team'} </a> </li>); @@ -167,21 +188,23 @@ export default class NavbarDropdown extends React.Component { data-toggle='modal' data-target='#user_settings' > - Account Settings + {'Account Settings'} </a> </li> - {teamSettings} {inviteLink} {teamLink} - {manageLink} <li> <a href='#' onClick={this.handleLogoutClick} > - Logout + {'Logout'} </a> </li> + {adminDivider} + {teamSettings} + {manageLink} + {sysAdminLink} {teams} <li className='divider'></li> <li> @@ -189,7 +212,7 @@ export default class NavbarDropdown extends React.Component { target='_blank' href='/static/help/help.html' > - Help + {'Help'} </a> </li> <li> @@ -197,7 +220,7 @@ export default class NavbarDropdown extends React.Component { target='_blank' href='/static/help/report_problem.html' > - Report a Problem + {'Report a Problem'} </a> </li> </ul> |