mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-19 15:38:38 +00:00
custom nav item (#4071)
* custom nav item * optimize code * optimize code
This commit is contained in:
parent
3fa9f80432
commit
d52949da9c
@ -8,7 +8,7 @@ import { Utils } from '../utils/utils';
|
|||||||
import toaster from './toast';
|
import toaster from './toast';
|
||||||
import Group from '../models/group';
|
import Group from '../models/group';
|
||||||
|
|
||||||
import { canViewOrg, isDocs, isPro } from '../utils/constants';
|
import { canViewOrg, isDocs, isPro, customNavItems } from '../utils/constants';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
currentTab: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
currentTab: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
||||||
@ -159,6 +159,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() {
|
render() {
|
||||||
let showActivity = isDocs || isPro;
|
let showActivity = isDocs || isPro;
|
||||||
return (
|
return (
|
||||||
@ -255,6 +270,7 @@ class MainSideNav extends React.Component {
|
|||||||
</a>
|
</a>
|
||||||
{this.renderSharedAdmin()}
|
{this.renderSharedAdmin()}
|
||||||
</li>
|
</li>
|
||||||
|
{customNavItems && this.renderCustomNavItems()}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -54,6 +54,7 @@ export const repoPasswordMinLength = window.app.pageOptions.repoPasswordMinLengt
|
|||||||
export const canAddPublicRepo = window.app.pageOptions.canAddPublicRepo;
|
export const canAddPublicRepo = window.app.pageOptions.canAddPublicRepo;
|
||||||
export const canInvitePeople = window.app.pageOptions.canInvitePeople;
|
export const canInvitePeople = window.app.pageOptions.canInvitePeople;
|
||||||
export const canLockUnlockFile = window.app.pageOptions.canLockUnlockFile;
|
export const canLockUnlockFile = window.app.pageOptions.canLockUnlockFile;
|
||||||
|
export const customNavItems = window.app.pageOptions.customNavItems;
|
||||||
|
|
||||||
export const curNoteMsg = window.app.pageOptions.curNoteMsg;
|
export const curNoteMsg = window.app.pageOptions.curNoteMsg;
|
||||||
export const curNoteID = window.app.pageOptions.curNoteID;
|
export const curNoteID = window.app.pageOptions.curNoteID;
|
||||||
|
@ -913,3 +913,14 @@ if ENABLE_REMOTE_USER_AUTHENTICATION:
|
|||||||
|
|
||||||
if ENABLE_OAUTH or ENABLE_WORK_WEIXIN:
|
if ENABLE_OAUTH or ENABLE_WORK_WEIXIN:
|
||||||
AUTHENTICATION_BACKENDS += ('seahub.oauth.backends.OauthRemoteUserBackend',)
|
AUTHENTICATION_BACKENDS += ('seahub.oauth.backends.OauthRemoteUserBackend',)
|
||||||
|
|
||||||
|
#####################
|
||||||
|
# Custom Nav Items #
|
||||||
|
#####################
|
||||||
|
# an example:
|
||||||
|
# CUSTOM_NAV_ITEMS = [
|
||||||
|
# {'icon': 'sf2-icon-star',
|
||||||
|
# 'desc': 'test custom name',
|
||||||
|
# 'link': 'http://127.0.0.1:8000/shared-libs/',
|
||||||
|
# },
|
||||||
|
# ]
|
||||||
|
@ -91,6 +91,7 @@
|
|||||||
repoPasswordMinLength: {{repo_password_min_length}},
|
repoPasswordMinLength: {{repo_password_min_length}},
|
||||||
canAddPublicRepo: {% if can_add_public_repo %} true {% else %} false {% endif %},
|
canAddPublicRepo: {% if can_add_public_repo %} true {% else %} false {% endif %},
|
||||||
canInvitePeople: {% if enable_guest_invitation and user.permissions.can_invite_guest %} true {% else %} false {% endif %},
|
canInvitePeople: {% if enable_guest_invitation and user.permissions.can_invite_guest %} true {% else %} false {% endif %},
|
||||||
|
customNavItems: JSON.parse('{{ custom_nav_items | escapejs }}'),
|
||||||
|
|
||||||
{% if request.user.is_authenticated and request.cur_note %}
|
{% if request.user.is_authenticated and request.cur_note %}
|
||||||
curNoteMsg: '{{ request.cur_note.message|urlize }}',
|
curNoteMsg: '{{ request.cur_note.message|urlize }}',
|
||||||
|
@ -63,6 +63,7 @@ from seahub.onlyoffice.settings import ENABLE_ONLYOFFICE
|
|||||||
from seahub.constants import HASH_URLS, PERMISSION_READ
|
from seahub.constants import HASH_URLS, PERMISSION_READ
|
||||||
|
|
||||||
LIBRARY_TEMPLATES = getattr(settings, 'LIBRARY_TEMPLATES', {})
|
LIBRARY_TEMPLATES = getattr(settings, 'LIBRARY_TEMPLATES', {})
|
||||||
|
CUSTOM_NAV_ITEMS = getattr(settings, 'CUSTOM_NAV_ITEMS', '')
|
||||||
|
|
||||||
from constance import config
|
from constance import config
|
||||||
|
|
||||||
@ -1267,5 +1268,6 @@ def react_fake_view(request, **kwargs):
|
|||||||
'is_email_configured': IS_EMAIL_CONFIGURED,
|
'is_email_configured': IS_EMAIL_CONFIGURED,
|
||||||
'can_add_public_repo': request.user.permissions.can_add_public_repo(),
|
'can_add_public_repo': request.user.permissions.can_add_public_repo(),
|
||||||
'folder_perm_enabled': folder_perm_enabled,
|
'folder_perm_enabled': folder_perm_enabled,
|
||||||
'file_audit_enabled' : FILE_AUDIT_ENABLED
|
'file_audit_enabled' : FILE_AUDIT_ENABLED,
|
||||||
|
'custom_nav_items' : json.dumps(CUSTOM_NAV_ITEMS),
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user