1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 00:43:53 +00:00

add exit admin panel (#3165)

This commit is contained in:
陈钦亮
2019-03-25 10:38:08 +08:00
committed by Daniel Pan
parent 8321d3a530
commit 873ead2c77
2 changed files with 15 additions and 7 deletions

View File

@@ -92,16 +92,20 @@ class Account extends Component {
} }
renderMenu = () => { renderMenu = () => {
if (this.state.isStaff && !this.props.isAdminPanel) { let isAdminPage = this.state.isStaff || this.state.isOrgStaff;
return (
<a href={siteRoot + 'sys/useradmin/'} title={gettext('System Admin')} className="item">{gettext('System Admin')}</a> if (isAdminPage && this.props.isAdminPanel) {
);
}
if (this.props.isAdminPanel) {
return ( return (
<a href={siteRoot} title={gettext('Exit Admin Panel')} className="item">{gettext('Exit Admin Panel')}</a> <a href={siteRoot} title={gettext('Exit Admin Panel')} className="item">{gettext('Exit Admin Panel')}</a>
); );
} }
if (this.state.isStaff) {
return (
<a href={siteRoot + 'sys/useradmin/'} title={gettext('System Admin')} className="item">{gettext('System Admin')}</a>
);
}
if (this.state.isOrgStaff) { if (this.state.isOrgStaff) {
return ( return (
<a href={siteRoot + 'org/useradmin/'} title={gettext('Organization Admin')} className="item">{gettext('Organization Admin')}</a> <a href={siteRoot + 'org/useradmin/'} title={gettext('Organization Admin')} className="item">{gettext('Organization Admin')}</a>
@@ -153,6 +157,10 @@ class Account extends Component {
} }
} }
Account.defaultProps = {
isAdminPanel: false
}
Account.propTypes = propTypes; Account.propTypes = propTypes;
export default Account; export default Account;

View File

@@ -48,7 +48,7 @@ class MainPanel extends Component {
</div> </div>
</div> </div>
<div className="common-toolbar"> <div className="common-toolbar">
<Account /> <Account isAdminPanel={true}/>
</div> </div>
</div> </div>
{this.props.children} {this.props.children}