Add consistent left nav sidebar across all pages
Convert repo_menu from hidden horizontal context bar to sidebar sections. Add Navigate section with global links (Repos, Activity, Gists, Search, My Account, PRs, Notifications, Admin). Sidebar now shows for all users including anonymous.
This commit is contained in:
parent
ad02337045
commit
ec33c57d29
1 changed files with 42 additions and 64 deletions
|
|
@ -34,15 +34,9 @@
|
|||
<rhodecode-toast id="notifications"></rhodecode-toast>
|
||||
|
||||
<div class="main page-with-sidebar">
|
||||
<%
|
||||
not_anon = c.rhodecode_user.username != h.DEFAULT_USER
|
||||
has_sidebar = hasattr(next, 'page_sidebar') or not_anon
|
||||
%>
|
||||
% if has_sidebar:
|
||||
<nav class="page-sidebar" id="page-sidebar">
|
||||
${self.page_sidebar()}
|
||||
</nav>
|
||||
% endif
|
||||
<div class="page-content">
|
||||
${next.main()}
|
||||
</div>
|
||||
|
|
@ -123,6 +117,24 @@ can_create_repos = c.is_super_admin or c.can_create_repo
|
|||
can_create_repo_groups = c.is_super_admin or c.can_create_repo_group
|
||||
%>
|
||||
|
||||
<div class="sidebar-section">
|
||||
<h4 class="sidebar-heading">${_('Navigate')}</h4>
|
||||
<ul class="sidebar-nav">
|
||||
<li><a href="${h.route_path('home')}"><i class="icon-database"></i> ${_('Repositories')}</a></li>
|
||||
<li><a href="${h.route_path('journal' if not_anon else 'journal_public')}"><i class="icon-file-text"></i> ${_('Activity')}</a></li>
|
||||
<li><a href="${h.route_path('gists_show')}"><i class="icon-clipboard"></i> ${_('Gists')}</a></li>
|
||||
<li><a href="${h.route_path('search')}"><i class="icon-search"></i> ${_('Search')}</a></li>
|
||||
% if not_anon:
|
||||
<li><a href="${h.route_path('my_account_profile')}"><i class="icon-user"></i> ${_('My Account')}</a></li>
|
||||
<li><a href="${h.route_path('my_account_pullrequests')}"><i class="icon-request-pull"></i> ${_('Pull Requests')}</a></li>
|
||||
<li><a href="${h.route_path('my_account_notifications')}"><i class="icon-comment"></i> ${_('Notifications')}</a></li>
|
||||
% endif
|
||||
% if c.is_super_admin or c.is_delegated_admin:
|
||||
<li><a href="${h.route_path('admin_home')}"><i class="icon-cog"></i> ${_('Admin')}</a></li>
|
||||
% endif
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
% if not_anon:
|
||||
<div class="sidebar-section">
|
||||
<h4 class="sidebar-heading">${_('Create')}</h4>
|
||||
|
|
@ -411,10 +423,7 @@ ${self.menu_bar_subnav()}
|
|||
|
||||
<%def name="repo_menu(active=None)">
|
||||
<%
|
||||
## determine if we have "any" option available
|
||||
can_lock = h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking
|
||||
has_actions = can_lock
|
||||
|
||||
%>
|
||||
% if c.rhodecode_db_repo.archived:
|
||||
<div class="alert alert-warning text-center">
|
||||
|
|
@ -422,66 +431,35 @@ ${self.menu_bar_subnav()}
|
|||
</div>
|
||||
% endif
|
||||
|
||||
<!--- REPO CONTEXT BAR -->
|
||||
<div id="context-bar">
|
||||
<div class="wrapper">
|
||||
|
||||
<div class="title">
|
||||
${self.repo_page_title(c.rhodecode_db_repo)}
|
||||
</div>
|
||||
|
||||
<ul id="context-pages" class="navigation horizontal-list">
|
||||
<li class="${h.is_active('summary', active)}"><a class="menulink" href="${h.route_path('repo_summary_explicit', repo_name=c.repo_name)}"><div class="menulabel">${_('Summary')}</div></a></li>
|
||||
<li class="${h.is_active('commits', active)}"><a class="menulink" href="${h.route_path('repo_commits', repo_name=c.repo_name)}"><div class="menulabel">${_('Commits')}</div></a></li>
|
||||
<li class="${h.is_active('files', active)}"><a class="menulink" href="${h.repo_files_by_ref_url(c.repo_name, c.rhodecode_db_repo.repo_type, f_path='', ref_name=c.rhodecode_db_repo.landing_ref_name, commit_id='tip', query={'at':c.rhodecode_db_repo.landing_ref_name})}"><div class="menulabel">${_('Files')}</div></a></li>
|
||||
<li class="${h.is_active('compare', active)}"><a class="menulink" href="${h.route_path('repo_compare_select',repo_name=c.repo_name)}"><div class="menulabel">${_('Compare')}</div></a></li>
|
||||
|
||||
## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()"
|
||||
<div class="sidebar-section">
|
||||
<h4 class="sidebar-heading">${c.repo_name}</h4>
|
||||
<ul class="sidebar-nav">
|
||||
<li class="${h.is_active('summary', active)}"><a href="${h.route_path('repo_summary_explicit', repo_name=c.repo_name)}"><i class="icon-home"></i> ${_('Summary')}</a></li>
|
||||
<li class="${h.is_active('commits', active)}"><a href="${h.route_path('repo_commits', repo_name=c.repo_name)}"><i class="icon-history"></i> ${_('Commits')}</a></li>
|
||||
<li class="${h.is_active('files', active)}"><a href="${h.repo_files_by_ref_url(c.repo_name, c.rhodecode_db_repo.repo_type, f_path='', ref_name=c.rhodecode_db_repo.landing_ref_name, commit_id='tip', query={'at':c.rhodecode_db_repo.landing_ref_name})}"><i class="icon-file-text"></i> ${_('Files')}</a></li>
|
||||
<li class="${h.is_active('compare', active)}"><a href="${h.route_path('repo_compare_select',repo_name=c.repo_name)}"><i class="icon-loop"></i> ${_('Compare')}</a></li>
|
||||
%if c.rhodecode_db_repo.repo_type in ['git','hg']:
|
||||
<li class="${h.is_active('showpullrequest', active)}">
|
||||
<a class="menulink" href="${h.route_path('pullrequest_show_all', repo_name=c.repo_name)}" title="${h.tooltip(_('Show Pull Requests for %s') % c.repo_name)}">
|
||||
<div class="menulabel">
|
||||
${_('Pull Requests')} <span class="menulink-counter">${c.repository_pull_requests}</span>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="${h.is_active('showpullrequest', active)}"><a href="${h.route_path('pullrequest_show_all', repo_name=c.repo_name)}"><i class="icon-request-pull"></i> ${_('Pull Requests')} <span class="badge">${c.repository_pull_requests}</span></a></li>
|
||||
%endif
|
||||
|
||||
<li class="${h.is_active('artifacts', active)}">
|
||||
<a class="menulink" href="${h.route_path('repo_artifacts_list',repo_name=c.repo_name)}">
|
||||
<div class="menulabel">
|
||||
${_('Artifacts')} <span class="menulink-counter">${c.repository_artifacts}</span>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="${h.is_active('artifacts', active)}"><a href="${h.route_path('repo_artifacts_list',repo_name=c.repo_name)}"><i class="icon-archive"></i> ${_('Artifacts')} <span class="badge">${c.repository_artifacts}</span></a></li>
|
||||
%if not c.rhodecode_db_repo.archived and h.HasRepoPermissionAll('repository.admin')(c.repo_name):
|
||||
<li class="${h.is_active('settings', active)}"><a class="menulink" href="${h.route_path('edit_repo',repo_name=c.repo_name)}"><div class="menulabel">${_('Repository Settings')}</div></a></li>
|
||||
<li class="${h.is_active('settings', active)}"><a href="${h.route_path('edit_repo',repo_name=c.repo_name)}"><i class="icon-cog"></i> ${_('Settings')}</a></li>
|
||||
%endif
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<li class="${h.is_active('options', active)}">
|
||||
% if has_actions:
|
||||
<a class="menulink dropdown">
|
||||
<div class="menulabel">${_('Quick Actions')}<div class="show_more"></div></div>
|
||||
</a>
|
||||
<ul class="submenu">
|
||||
%if can_lock:
|
||||
%if c.rhodecode_db_repo.locked[0]:
|
||||
<li><a class="locking_del" href="${h.route_path('repo_settings_quick_actions',repo_name=c.repo_name, _query={'action': 'toggle-lock', 'set_unlock': 1})}">${_('Unlock Repository')}</a></li>
|
||||
%else:
|
||||
<li><a class="locking_add" href="${h.route_path('repo_settings_quick_actions',repo_name=c.repo_name, _query={'action': 'toggle-lock', 'set_lock': 1})}">${_('Lock Repository')}</a></li>
|
||||
%endif
|
||||
%endif
|
||||
</ul>
|
||||
% endif
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<!--- REPO END CONTEXT BAR -->
|
||||
% if can_lock:
|
||||
<div class="sidebar-section">
|
||||
<h4 class="sidebar-heading">${_('Quick Actions')}</h4>
|
||||
<ul class="sidebar-nav">
|
||||
%if c.rhodecode_db_repo.locked[0]:
|
||||
<li><a href="${h.route_path('repo_settings_quick_actions',repo_name=c.repo_name, _query={'action': 'toggle-lock', 'set_unlock': 1})}"><i class="icon-lock"></i> ${_('Unlock Repository')}</a></li>
|
||||
%else:
|
||||
<li><a href="${h.route_path('repo_settings_quick_actions',repo_name=c.repo_name, _query={'action': 'toggle-lock', 'set_lock': 1})}"><i class="icon-lock"></i> ${_('Lock Repository')}</a></li>
|
||||
%endif
|
||||
</ul>
|
||||
</div>
|
||||
% endif
|
||||
|
||||
</%def>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue