mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-22 03:47:09 +00:00
Merge branch '7.0'
This commit is contained in:
@@ -77,6 +77,7 @@ class Account extends Component {
|
||||
quotaUsage: Utils.bytesToSize(resp.data.usage),
|
||||
quotaTotal: Utils.bytesToSize(resp.data.total),
|
||||
isStaff: resp.data.is_staff,
|
||||
isInstAdmin: resp.data.is_inst_admin,
|
||||
isOrgStaff: resp.data.is_org_staff === 1 ? true : false,
|
||||
showInfo: !this.state.showInfo,
|
||||
});
|
||||
@@ -91,29 +92,47 @@ class Account extends Component {
|
||||
}
|
||||
|
||||
renderMenu = () => {
|
||||
if (this.state.isStaff && this.props.isAdminPanel) {
|
||||
return (
|
||||
<a href={siteRoot} title={gettext('Exit Admin Panel')} className="item">{gettext('Exit Admin Panel')}</a>
|
||||
);
|
||||
let data;
|
||||
const { isStaff, isOrgStaff, isInstAdmin } = this.state;
|
||||
|
||||
if (this.props.isAdminPanel) {
|
||||
if (isStaff) {
|
||||
data = {
|
||||
url: siteRoot,
|
||||
text: gettext('Exit System Admin')
|
||||
};
|
||||
} else if (isOrgStaff) {
|
||||
data = {
|
||||
url: siteRoot,
|
||||
text: gettext('Exit Organization Admin')
|
||||
};
|
||||
} else if (isInstAdmin) {
|
||||
data = {
|
||||
url: siteRoot,
|
||||
text: gettext('Exit Institution Admin')
|
||||
};
|
||||
}
|
||||
|
||||
} else {
|
||||
if (isStaff) {
|
||||
data = {
|
||||
url: `${siteRoot}sys/useradmin/`,
|
||||
text: gettext('System Admin')
|
||||
};
|
||||
} else if (isOrgStaff) {
|
||||
data = {
|
||||
url: `${siteRoot}org/useradmin/`,
|
||||
text: gettext('Organization Admin')
|
||||
};
|
||||
} else if (isInstAdmin) {
|
||||
data = {
|
||||
url: `${siteRoot}inst/useradmin/`,
|
||||
text: gettext('Institution Admin')
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (this.state.isOrgStaff && this.props.isAdminPanel) {
|
||||
return (
|
||||
<a href={siteRoot} title={gettext('Exit Organization Admin')} className="item">{gettext('Exit Organization Admin')}</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) {
|
||||
return (
|
||||
<a href={siteRoot + 'org/useradmin/'} title={gettext('Organization Admin')} className="item">{gettext('Organization Admin')}</a>
|
||||
);
|
||||
}
|
||||
return data && <a href={data.url} title={data.text} className="item">{data.text}</a>;
|
||||
}
|
||||
|
||||
renderAvatar = () => {
|
||||
|
@@ -8,7 +8,7 @@ import { Utils } from '../utils/utils';
|
||||
import toaster from './toast';
|
||||
import Group from '../models/group';
|
||||
|
||||
import { canViewOrg, isDocs, isPro } from '../utils/constants';
|
||||
import { canViewOrg, isDocs, isPro, customNavItems } from '../utils/constants';
|
||||
|
||||
const propTypes = {
|
||||
currentTab: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
||||
@@ -164,6 +164,21 @@ class MainSideNav extends React.Component {
|
||||
);
|
||||
}
|
||||
|
||||
renderCustomNavItems() {
|
||||
return (
|
||||
customNavItems.map((item, idx) => {
|
||||
return (
|
||||
<li key={idx} className="nav-item">
|
||||
<a href={item.link} className="nav-link ellipsis" title={item.desc}>
|
||||
<span className={item.icon} aria-hidden="true"></span>
|
||||
<span className="nav-text">{item.desc}</span>
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
let showActivity = isDocs || isPro;
|
||||
return (
|
||||
@@ -261,6 +276,7 @@ class MainSideNav extends React.Component {
|
||||
</a>
|
||||
{this.renderSharedAdmin()}
|
||||
</li>
|
||||
{customNavItems && this.renderCustomNavItems()}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
@@ -54,6 +54,7 @@ export const repoPasswordMinLength = window.app.pageOptions.repoPasswordMinLengt
|
||||
export const canAddPublicRepo = window.app.pageOptions.canAddPublicRepo;
|
||||
export const canInvitePeople = window.app.pageOptions.canInvitePeople;
|
||||
export const canLockUnlockFile = window.app.pageOptions.canLockUnlockFile;
|
||||
export const customNavItems = window.app.pageOptions.customNavItems;
|
||||
|
||||
export const curNoteMsg = window.app.pageOptions.curNoteMsg;
|
||||
export const curNoteID = window.app.pageOptions.curNoteID;
|
||||
|
Reference in New Issue
Block a user