base.mako
1263 lines
| 48.6 KiB
| application/x-mako
|
MakoHtmlLexer
r1282 | ## -*- coding: utf-8 -*- | |||
r4031 | ||||
<%! | ||||
r4401 | from rhodecode.lib import html_filters | |||
r4031 | %> | |||
r1282 | <%inherit file="root.mako"/> | |||
r2484 | <%include file="/ejs_templates/templates.html"/> | |||
r1282 | <div class="outerwrapper"> | |||
<!-- HEADER --> | ||||
<div class="header"> | ||||
<div id="header-inner" class="wrapper"> | ||||
<div id="logo"> | ||||
<div class="logo-wrapper"> | ||||
r3541 | <a href="${h.route_path('home')}"><img src="${h.asset('images/rhodecode-logo-white-60x60.png')}" alt="RhodeCode"/></a> | |||
r1282 | </div> | |||
r3543 | % if c.rhodecode_name: | |||
<div class="branding"> | ||||
<a href="${h.route_path('home')}">${h.branding(c.rhodecode_name)}</a> | ||||
</div> | ||||
% endif | ||||
r1282 | </div> | |||
<!-- MENU BAR NAV --> | ||||
${self.menu_bar_nav()} | ||||
<!-- END MENU BAR NAV --> | ||||
</div> | ||||
</div> | ||||
${self.menu_bar_subnav()} | ||||
<!-- END HEADER --> | ||||
<!-- CONTENT --> | ||||
<div id="content" class="wrapper"> | ||||
r1483 | ||||
<rhodecode-toast id="notifications"></rhodecode-toast> | ||||
r1282 | <div class="main"> | |||
${next.main()} | ||||
</div> | ||||
r4481 | ||||
r1282 | </div> | |||
<!-- END CONTENT --> | ||||
</div> | ||||
r4481 | ||||
r1282 | <!-- FOOTER --> | |||
<div id="footer"> | ||||
<div id="footer-inner" class="title wrapper"> | ||||
<div> | ||||
r4375 | <% sid = 'block' if request.GET.get('showrcid') else 'none' %> | |||
r1282 | <p class="footer-link-right"> | |||
r4375 | <a class="grey-link-action" href="${h.route_path('home', _query={'showrcid': 1})}"> | |||
RhodeCode | ||||
r1282 | % if c.visual.show_version: | |||
r4375 | ${c.rhodecode_version} | |||
r1282 | % endif | |||
r4375 | ${c.rhodecode_edition} | |||
</a> | | ||||
r1282 | % if c.visual.rhodecode_support_url: | |||
r4375 | <a class="grey-link-action" href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a> | | |||
<a class="grey-link-action" href="https://docs.rhodecode.com" target="_blank">${_('Documentation')}</a> | ||||
r1282 | % endif | |||
r4375 | ||||
r1282 | </p> | |||
r4375 | ||||
r1282 | <p class="server-instance" style="display:${sid}"> | |||
## display hidden instance ID if specially defined | ||||
r4375 | © 2010-${h.datetime.today().year}, <a href="${h.route_url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved. | |||
r1282 | % if c.rhodecode_instanceid: | |||
r3424 | ${_('RhodeCode instance id: {}').format(c.rhodecode_instanceid)} | |||
r1282 | % endif | |||
</p> | ||||
</div> | ||||
</div> | ||||
</div> | ||||
<!-- END FOOTER --> | ||||
### MAKO DEFS ### | ||||
<%def name="menu_bar_subnav()"> | ||||
</%def> | ||||
<%def name="breadcrumbs(class_='breadcrumbs')"> | ||||
<div class="${class_}"> | ||||
${self.breadcrumbs_links()} | ||||
</div> | ||||
</%def> | ||||
r3566 | <%def name="admin_menu(active=None)"> | |||
r3586 | ||||
r3566 | <div id="context-bar"> | |||
<div class="wrapper"> | ||||
Liviu
|
r3570 | <div class="title"> | ||
<div class="title-content"> | ||||
<div class="title-main"> | ||||
r3597 | % if c.is_super_admin: | |||
Bartlomiej Wolynczyk
|
r4134 | ${_('Super-admin Panel')} | ||
r3586 | % else: | |||
${_('Delegated Admin Panel')} | ||||
% endif | ||||
Liviu
|
r3570 | </div> | ||
</div> | ||||
</div> | ||||
r3586 | <ul id="context-pages" class="navigation horizontal-list"> | |||
Bartlomiej Wolynczyk
|
r4134 | ## super-admin case | ||
r3587 | % if c.is_super_admin: | |||
r4062 | <li class="${h.is_active('audit_logs', active)}"><a href="${h.route_path('admin_audit_logs')}">${_('Admin audit logs')}</a></li> | |||
<li class="${h.is_active('repositories', active)}"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li> | ||||
<li class="${h.is_active('repository_groups', active)}"><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li> | ||||
<li class="${h.is_active('users', active)}"><a href="${h.route_path('users')}">${_('Users')}</a></li> | ||||
<li class="${h.is_active('user_groups', active)}"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li> | ||||
r4661 | <li class="${h.is_active('artifacts', active)}"><a href="${h.route_path('admin_artifacts')}">${_('Artifacts')}</a></li> | |||
r4062 | <li class="${h.is_active('permissions', active)}"><a href="${h.route_path('admin_permissions_application')}">${_('Permissions')}</a></li> | |||
<li class="${h.is_active('authentication', active)}"><a href="${h.route_path('auth_home', traverse='')}">${_('Authentication')}</a></li> | ||||
<li class="${h.is_active('integrations', active)}"><a href="${h.route_path('global_integrations_home')}">${_('Integrations')}</a></li> | ||||
<li class="${h.is_active('defaults', active)}"><a href="${h.route_path('admin_defaults_repositories')}">${_('Defaults')}</a></li> | ||||
<li class="${h.is_active('settings', active)}"><a href="${h.route_path('admin_settings')}">${_('Settings')}</a></li> | ||||
r3564 | ||||
## delegated admin | ||||
r3587 | % elif c.is_delegated_admin: | |||
<% | ||||
repositories=c.auth_user.repositories_admin or c.can_create_repo | ||||
repository_groups=c.auth_user.repository_groups_admin or c.can_create_repo_group | ||||
user_groups=c.auth_user.user_groups_admin or c.can_create_user_group | ||||
%> | ||||
r3564 | %if repositories: | |||
r4062 | <li class="${h.is_active('repositories', active)} local-admin-repos"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li> | |||
r3564 | %endif | |||
%if repository_groups: | ||||
r4062 | <li class="${h.is_active('repository_groups', active)} local-admin-repo-groups"><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li> | |||
r3564 | %endif | |||
%if user_groups: | ||||
r4062 | <li class="${h.is_active('user_groups', active)} local-admin-user-groups"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li> | |||
r3564 | %endif | |||
% endif | ||||
</ul> | ||||
r3586 | ||||
r3566 | </div> | |||
<div class="clear"></div> | ||||
</div> | ||||
r1282 | </%def> | |||
<%def name="dt_info_panel(elements)"> | ||||
<dl class="dl-horizontal"> | ||||
%for dt, dd, title, show_items in elements: | ||||
<dt>${dt}:</dt> | ||||
r1843 | <dd title="${h.tooltip(title)}"> | |||
r1282 | %if callable(dd): | |||
## allow lazy evaluation of elements | ||||
${dd()} | ||||
%else: | ||||
${dd} | ||||
%endif | ||||
%if show_items: | ||||
<span class="btn-collapse" data-toggle="item-${h.md5_safe(dt)[:6]}-details">${_('Show More')} </span> | ||||
%endif | ||||
</dd> | ||||
%if show_items: | ||||
<div class="collapsable-content" data-toggle="item-${h.md5_safe(dt)[:6]}-details" style="display: none"> | ||||
%for item in show_items: | ||||
<dt></dt> | ||||
<dd>${item}</dd> | ||||
%endfor | ||||
</div> | ||||
%endif | ||||
%endfor | ||||
</dl> | ||||
</%def> | ||||
r4011 | <%def name="tr_info_entry(element)"> | |||
<% key, val, title, show_items = element %> | ||||
<tr> | ||||
<td style="vertical-align: top">${key}</td> | ||||
<td title="${h.tooltip(title)}"> | ||||
%if callable(val): | ||||
## allow lazy evaluation of elements | ||||
${val()} | ||||
%else: | ||||
${val} | ||||
%endif | ||||
%if show_items: | ||||
<div class="collapsable-content" data-toggle="item-${h.md5_safe(val)[:6]}-details" style="display: none"> | ||||
% for item in show_items: | ||||
<dt></dt> | ||||
<dd>${item}</dd> | ||||
% endfor | ||||
</div> | ||||
%endif | ||||
</td> | ||||
<td style="vertical-align: top"> | ||||
%if show_items: | ||||
<span class="btn-collapse" data-toggle="item-${h.md5_safe(val)[:6]}-details">${_('Show More')} </span> | ||||
%endif | ||||
</td> | ||||
</tr> | ||||
</%def> | ||||
r4140 | <%def name="gravatar(email, size=16, tooltip=False, tooltip_alt=None, user=None, extra_class=None)"> | |||
r1282 | <% | |||
r4026 | if size > 16: | |||
gravatar_class = ['gravatar','gravatar-large'] | ||||
r1282 | else: | |||
r4026 | gravatar_class = ['gravatar'] | |||
data_hovercard_url = '' | ||||
data_hovercard_alt = tooltip_alt.replace('<', '<').replace('>', '>') if tooltip_alt else '' | ||||
if tooltip: | ||||
gravatar_class += ['tooltip-hovercard'] | ||||
r4140 | if extra_class: | |||
gravatar_class += extra_class | ||||
r4026 | if tooltip and user: | |||
if user.username == h.DEFAULT_USER: | ||||
gravatar_class.pop(-1) | ||||
else: | ||||
data_hovercard_url = request.route_path('hovercard_user', user_id=getattr(user, 'user_id', '')) | ||||
gravatar_class = ' '.join(gravatar_class) | ||||
r1282 | %> | |||
<%doc> | ||||
TODO: johbo: For now we serve double size images to make it smooth | ||||
for retina. This is how it worked until now. Should be replaced | ||||
with a better solution at some point. | ||||
</%doc> | ||||
r4026 | ||||
<img class="${gravatar_class}" height="${size}" width="${size}" data-hovercard-url="${data_hovercard_url}" data-hovercard-alt="${data_hovercard_alt}" src="${h.gravatar_url(email, size * 2)}" /> | ||||
</%def> | ||||
r4232 | <%def name="gravatar_with_user(contact, size=16, show_disabled=False, tooltip=False, _class='rc-user')"> | |||
r4026 | <% | |||
email = h.email_or_none(contact) | ||||
rc_user = h.discover_user(contact) | ||||
%> | ||||
r4232 | <div class="${_class}"> | |||
r4026 | ${self.gravatar(email, size, tooltip=tooltip, tooltip_alt=contact, user=rc_user)} | |||
r4418 | <span class="${('user user-disabled' if show_disabled else 'user')}"> | |||
${h.link_to_user(rc_user or contact)} | ||||
</span> | ||||
r4026 | </div> | |||
r1282 | </%def> | |||
r4026 | <%def name="user_group_icon(user_group=None, size=16, tooltip=False)"> | |||
<% | ||||
if (size > 16): | ||||
gravatar_class = 'icon-user-group-alt' | ||||
else: | ||||
gravatar_class = 'icon-user-group-alt' | ||||
if tooltip: | ||||
gravatar_class += ' tooltip-hovercard' | ||||
data_hovercard_url = request.route_path('hovercard_user_group', user_group_id=user_group.users_group_id) | ||||
%> | ||||
<%doc> | ||||
TODO: johbo: For now we serve double size images to make it smooth | ||||
for retina. This is how it worked until now. Should be replaced | ||||
with a better solution at some point. | ||||
</%doc> | ||||
<i style="font-size: ${size}px" class="${gravatar_class} x-icon-size-${size}" data-hovercard-url="${data_hovercard_url}"></i> | ||||
r1282 | </%def> | |||
<%def name="repo_page_title(repo_instance)"> | ||||
r3666 | <div class="title-content repo-title"> | |||
r3688 | ||||
r1282 | <div class="title-main"> | |||
## SVN/HG/GIT icons | ||||
%if h.is_hg(repo_instance): | ||||
<i class="icon-hg"></i> | ||||
%endif | ||||
%if h.is_git(repo_instance): | ||||
<i class="icon-git"></i> | ||||
%endif | ||||
%if h.is_svn(repo_instance): | ||||
<i class="icon-svn"></i> | ||||
%endif | ||||
## public/private | ||||
%if repo_instance.private: | ||||
<i class="icon-repo-private"></i> | ||||
%else: | ||||
<i class="icon-repo-public"></i> | ||||
%endif | ||||
## repo name with group name | ||||
r3442 | ${h.breadcrumb_repo_link(repo_instance)} | |||
r1282 | ||||
r3666 | ## Context Actions | |||
<div class="pull-right"> | ||||
%if c.rhodecode_user.username != h.DEFAULT_USER: | ||||
r3810 | <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_uid, _query=dict(auth_token=c.rhodecode_user.feed_token))}" title="${_('RSS Feed')}" class="btn btn-sm"><i class="icon-rss-sign"></i>RSS</a> | |||
r3670 | ||||
<a href="#WatchRepo" onclick="toggleFollowingRepo(this, templateContext.repo_id); return false" title="${_('Watch this Repository and actions on it in your personalized journal')}" class="btn btn-sm ${('watching' if c.repository_is_user_following else '')}"> | ||||
% if c.repository_is_user_following: | ||||
r3680 | <i class="icon-eye-off"></i>${_('Unwatch')} | |||
r3670 | % else: | |||
r3680 | <i class="icon-eye"></i>${_('Watch')} | |||
r3670 | % endif | |||
</a> | ||||
r3666 | %else: | |||
r3810 | <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_uid)}" title="${_('RSS Feed')}" class="btn btn-sm"><i class="icon-rss-sign"></i>RSS</a> | |||
r3666 | %endif | |||
</div> | ||||
r1282 | </div> | |||
## FORKED | ||||
%if repo_instance.fork: | ||||
Liviu
|
r3570 | <p class="discreet"> | ||
r1282 | <i class="icon-code-fork"></i> ${_('Fork of')} | |||
r3367 | ${h.link_to_if(c.has_origin_repo_read_perm,repo_instance.fork.repo_name, h.route_path('repo_summary', repo_name=repo_instance.fork.repo_name))} | |||
r1282 | </p> | |||
%endif | ||||
## IMPORTED FROM REMOTE | ||||
%if repo_instance.clone_uri: | ||||
Liviu
|
r3570 | <p class="discreet"> | ||
r1282 | <i class="icon-code-fork"></i> ${_('Clone from')} | |||
r2306 | <a href="${h.safe_str(h.hide_credentials(repo_instance.clone_uri))}">${h.hide_credentials(repo_instance.clone_uri)}</a> | |||
r1282 | </p> | |||
%endif | ||||
## LOCKING STATUS | ||||
%if repo_instance.locked[0]: | ||||
Liviu
|
r3570 | <p class="locking_locked discreet"> | ||
r1282 | <i class="icon-repo-lock"></i> | |||
${_('Repository locked by %(user)s') % {'user': h.person_by_id(repo_instance.locked[0])}} | ||||
</p> | ||||
%elif repo_instance.enable_locking: | ||||
Liviu
|
r3570 | <p class="locking_unlocked discreet"> | ||
r1282 | <i class="icon-repo-unlock"></i> | |||
${_('Repository not locked. Pull repository to lock it.')} | ||||
</p> | ||||
%endif | ||||
</div> | ||||
</%def> | ||||
<%def name="repo_menu(active=None)"> | ||||
<% | ||||
r3907 | ## 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 | ||||
r1282 | %> | |||
r3744 | % if c.rhodecode_db_repo.archived: | |||
<div class="alert alert-warning text-center"> | ||||
<strong>${_('This repository has been archived. It is now read-only.')}</strong> | ||||
</div> | ||||
% endif | ||||
r1282 | ||||
r3566 | <!--- REPO CONTEXT BAR --> | |||
r1282 | <div id="context-bar"> | |||
<div class="wrapper"> | ||||
Liviu
|
r3559 | |||
<div class="title"> | ||||
${self.repo_page_title(c.rhodecode_db_repo)} | ||||
</div> | ||||
r2774 | <ul id="context-pages" class="navigation horizontal-list"> | |||
r4376 | <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> | |||
r4062 | <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> | |||
r4373 | <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> | |||
r4062 | <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> | |||
r3440 | ||||
r1282 | ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()" | |||
%if c.rhodecode_db_repo.repo_type in ['git','hg']: | ||||
r4062 | <li class="${h.is_active('showpullrequest', active)}"> | |||
r1843 | <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)}"> | |||
r3569 | <div class="menulabel"> | |||
r3984 | ${_('Pull Requests')} <span class="menulink-counter">${c.repository_pull_requests}</span> | |||
r3569 | </div> | |||
r1282 | </a> | |||
</li> | ||||
%endif | ||||
r3440 | ||||
r4062 | <li class="${h.is_active('artifacts', active)}"> | |||
r3984 | <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> | ||||
r3671 | ||||
r4414 | %if not c.rhodecode_db_repo.archived and h.HasRepoPermissionAll('repository.admin')(c.repo_name): | |||
r4062 | <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> | |||
r3567 | %endif | |||
r4062 | <li class="${h.is_active('options', active)}"> | |||
r3719 | % if has_actions: | |||
<a class="menulink dropdown"> | ||||
<div class="menulabel">${_('Options')}<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_edit_toggle_locking',repo_name=c.repo_name)}">${_('Unlock Repository')}</a></li> | ||||
%else: | ||||
<li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock Repository')}</a></li> | ||||
%endif | ||||
%endif | ||||
</ul> | ||||
% endif | ||||
</li> | ||||
r3567 | ||||
r1282 | </ul> | |||
</div> | ||||
<div class="clear"></div> | ||||
</div> | ||||
r3744 | ||||
r3566 | <!--- REPO END CONTEXT BAR --> | |||
r1282 | ||||
</%def> | ||||
r3442 | <%def name="repo_group_page_title(repo_group_instance)"> | |||
<div class="title-content"> | ||||
<div class="title-main"> | ||||
## Repository Group icon | ||||
r3680 | <i class="icon-repo-group"></i> | |||
r3442 | ||||
## repo name with group name | ||||
${h.breadcrumb_repo_group_link(repo_group_instance)} | ||||
</div> | ||||
<%namespace name="dt" file="/data_table/_dt_elements.mako"/> | ||||
Liviu
|
r3617 | <div class="repo-group-desc discreet"> | ||
r3442 | ${dt.repo_group_desc(repo_group_instance.description_safe, repo_group_instance.personal, c.visual.stylify_metatags)} | |||
</div> | ||||
</div> | ||||
</%def> | ||||
r3907 | ||||
r3442 | <%def name="repo_group_menu(active=None)"> | |||
<% | ||||
gr_name = c.repo_group.group_name if c.repo_group else None | ||||
# create repositories with write permission on group is set to true | ||||
group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page') | ||||
%> | ||||
r3907 | ||||
r3566 | <!--- REPO GROUP CONTEXT BAR --> | |||
r3442 | <div id="context-bar"> | |||
<div class="wrapper"> | ||||
Liviu
|
r3570 | <div class="title"> | ||
${self.repo_group_page_title(c.repo_group)} | ||||
</div> | ||||
r3442 | <ul id="context-pages" class="navigation horizontal-list"> | |||
r4062 | <li class="${h.is_active('home', active)}"> | |||
r3907 | <a class="menulink" href="${h.route_path('repo_group_home', repo_group_name=c.repo_group.group_name)}"><div class="menulabel">${_('Group Home')}</div></a> | |||
</li> | ||||
r3587 | % if c.is_super_admin or group_admin: | |||
r4062 | <li class="${h.is_active('settings', active)}"> | |||
r3907 | <a class="menulink" href="${h.route_path('edit_repo_group',repo_group_name=c.repo_group.group_name)}" title="${_('You have admin right to this group, and can edit it')}"><div class="menulabel">${_('Group Settings')}</div></a> | |||
</li> | ||||
r3567 | % endif | |||
r3907 | ||||
r3442 | </ul> | |||
</div> | ||||
<div class="clear"></div> | ||||
</div> | ||||
r3566 | <!--- REPO GROUP CONTEXT BAR --> | |||
r3442 | ||||
</%def> | ||||
r1318 | <%def name="usermenu(active=False)"> | |||
r3907 | <% | |||
not_anonymous = c.rhodecode_user.username != h.DEFAULT_USER | ||||
gr_name = c.repo_group.group_name if (hasattr(c, 'repo_group') and c.repo_group) else None | ||||
# create repositories with write permission on group is set to true | ||||
can_fork = c.is_super_admin or h.HasPermissionAny('hg.fork.repository')() | ||||
create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')() | ||||
group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page') | ||||
group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page') | ||||
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 | ||||
can_create_repos_in_group = c.is_super_admin or group_admin or (group_write and create_on_write) | ||||
can_create_repo_groups_in_group = c.is_super_admin or group_admin | ||||
%> | ||||
% if not_anonymous: | ||||
<% | ||||
default_target_group = dict() | ||||
if c.rhodecode_user.personal_repo_group: | ||||
default_target_group = dict(parent_group=c.rhodecode_user.personal_repo_group.group_id) | ||||
%> | ||||
## create action | ||||
<li> | ||||
<a href="#create-actions" onclick="return false;" class="menulink childs"> | ||||
r4433 | <i class="icon-plus-circled"></i> | |||
r3907 | </a> | |||
<div class="action-menu submenu"> | ||||
<ol> | ||||
## scope of within a repository | ||||
% if hasattr(c, 'rhodecode_db_repo') and c.rhodecode_db_repo: | ||||
<li class="submenu-title">${_('This Repository')}</li> | ||||
<li> | ||||
<a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a> | ||||
</li> | ||||
% if can_fork: | ||||
<li> | ||||
<a href="${h.route_path('repo_fork_new',repo_name=c.repo_name,_query=default_target_group)}">${_('Fork this repository')}</a> | ||||
</li> | ||||
% endif | ||||
% endif | ||||
## scope of within repository groups | ||||
% if hasattr(c, 'repo_group') and c.repo_group and (can_create_repos_in_group or can_create_repo_groups_in_group): | ||||
<li class="submenu-title">${_('This Repository Group')}</li> | ||||
% if can_create_repos_in_group: | ||||
<li> | ||||
r4079 | <a href="${h.route_path('repo_new',_query=dict(parent_group=c.repo_group.group_id))}">${_('New Repository')}</a> | |||
r3907 | </li> | |||
% endif | ||||
% if can_create_repo_groups_in_group: | ||||
<li> | ||||
r4079 | <a href="${h.route_path('repo_group_new',_query=dict(parent_group=c.repo_group.group_id))}">${_(u'New Repository Group')}</a> | |||
r3907 | </li> | |||
% endif | ||||
% endif | ||||
## personal group | ||||
% if c.rhodecode_user.personal_repo_group: | ||||
<li class="submenu-title">Personal Group</li> | ||||
<li> | ||||
<a href="${h.route_path('repo_new',_query=dict(parent_group=c.rhodecode_user.personal_repo_group.group_id))}" >${_('New Repository')} </a> | ||||
</li> | ||||
<li> | ||||
<a href="${h.route_path('repo_group_new',_query=dict(parent_group=c.rhodecode_user.personal_repo_group.group_id))}">${_('New Repository Group')} </a> | ||||
</li> | ||||
% endif | ||||
## Global actions | ||||
<li class="submenu-title">RhodeCode</li> | ||||
% if can_create_repos: | ||||
<li> | ||||
<a href="${h.route_path('repo_new')}" >${_('New Repository')}</a> | ||||
</li> | ||||
% endif | ||||
% if can_create_repo_groups: | ||||
<li> | ||||
<a href="${h.route_path('repo_group_new')}" >${_(u'New Repository Group')}</a> | ||||
</li> | ||||
% endif | ||||
<li> | ||||
<a href="${h.route_path('gists_new')}">${_(u'New Gist')}</a> | ||||
</li> | ||||
</ol> | ||||
</div> | ||||
</li> | ||||
## notifications | ||||
<li> | ||||
<a class="${('empty' if c.unread_notifications == 0 else '')}" href="${h.route_path('notifications_show_all')}"> | ||||
${c.unread_notifications} | ||||
</a> | ||||
</li> | ||||
% endif | ||||
r1282 | ## USER MENU | |||
r1318 | <li id="quick_login_li" class="${'active' if active else ''}"> | |||
r3386 | % if c.rhodecode_user.username == h.DEFAULT_USER: | |||
<a id="quick_login_link" class="menulink childs" href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}"> | ||||
${gravatar(c.rhodecode_user.email, 20)} | ||||
<span class="user"> | ||||
<span>${_('Sign in')}</span> | ||||
</span> | ||||
</a> | ||||
% else: | ||||
## logged in user | ||||
<a id="quick_login_link" class="menulink childs"> | ||||
${gravatar(c.rhodecode_user.email, 20)} | ||||
<span class="user"> | ||||
<span class="menu_link_user">${c.rhodecode_user.username}</span> | ||||
<div class="show_more"></div> | ||||
</span> | ||||
</a> | ||||
## subnav with menu for logged in user | ||||
<div class="user-menu submenu"> | ||||
<div id="quick_login"> | ||||
%if c.rhodecode_user.username != h.DEFAULT_USER: | ||||
<div class=""> | ||||
<div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div> | ||||
<div class="full_name">${c.rhodecode_user.full_name_or_username}</div> | ||||
<div class="email">${c.rhodecode_user.email}</div> | ||||
r1282 | </div> | |||
r3386 | <div class=""> | |||
<ol class="links"> | ||||
<li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li> | ||||
% if c.rhodecode_user.personal_repo_group: | ||||
<li>${h.link_to(_(u'My personal group'), h.route_path('repo_group_home', repo_group_name=c.rhodecode_user.personal_repo_group.group_name))}</li> | ||||
% endif | ||||
<li>${h.link_to(_(u'Pull Requests'), h.route_path('my_account_pullrequests'))}</li> | ||||
r3909 | ||||
% if c.debug_style: | ||||
<li> | ||||
<a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}"> | ||||
<div class="menulabel">${_('[Style]')}</div> | ||||
</a> | ||||
</li> | ||||
% endif | ||||
r3424 | ## bookmark-items | |||
<li class="bookmark-items"> | ||||
${_('Bookmarks')} | ||||
<div class="pull-right"> | ||||
r3909 | <a href="${h.route_path('my_account_bookmarks')}"> | |||
<i class="icon-cog"></i> | ||||
</a> | ||||
r3424 | </div> | |||
</li> | ||||
% if not c.bookmark_items: | ||||
<li> | ||||
<a href="${h.route_path('my_account_bookmarks')}">${_('No Bookmarks yet.')}</a> | ||||
</li> | ||||
% endif | ||||
% for item in c.bookmark_items: | ||||
<li> | ||||
% if item.repository: | ||||
<div> | ||||
<a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}"> | ||||
r3434 | <code>${item.position}</code> | |||
r3424 | % if item.repository.repo_type == 'hg': | |||
<i class="icon-hg" title="${_('Repository')}" style="font-size: 16px"></i> | ||||
% elif item.repository.repo_type == 'git': | ||||
<i class="icon-git" title="${_('Repository')}" style="font-size: 16px"></i> | ||||
% elif item.repository.repo_type == 'svn': | ||||
<i class="icon-svn" title="${_('Repository')}" style="font-size: 16px"></i> | ||||
% endif | ||||
${(item.title or h.shorter(item.repository.repo_name, 30))} | ||||
</a> | ||||
</div> | ||||
% elif item.repository_group: | ||||
<div> | ||||
<a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}"> | ||||
r3434 | <code>${item.position}</code> | |||
r3680 | <i class="icon-repo-group" title="${_('Repository group')}" style="font-size: 14px"></i> | |||
r3424 | ${(item.title or h.shorter(item.repository_group.group_name, 30))} | |||
</a> | ||||
</div> | ||||
% else: | ||||
<a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}"> | ||||
r3434 | <code>${item.position}</code> | |||
r3424 | ${item.title} | |||
</a> | ||||
% endif | ||||
</li> | ||||
% endfor | ||||
r3386 | ||||
<li class="logout"> | ||||
${h.secure_form(h.route_path('logout'), request=request)} | ||||
${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")} | ||||
${h.end_form()} | ||||
</li> | ||||
</ol> | ||||
r1282 | </div> | |||
r3386 | %endif | |||
</div> | ||||
</div> | ||||
r3907 | ||||
r3386 | % endif | |||
r1282 | </li> | |||
</%def> | ||||
<%def name="menu_items(active=None)"> | ||||
r4300 | <% | |||
notice_messages, notice_level = c.rhodecode_user.get_notice_messages() | ||||
notice_display = 'none' if len(notice_messages) == 0 else '' | ||||
%> | ||||
r2774 | ||||
r2898 | <ul id="quick" class="main_nav navigation horizontal-list"> | |||
## notice box for important system messages | ||||
r4300 | <li style="display: ${notice_display}"> | |||
<a class="notice-box" href="#openNotice" onclick="$('.notice-messages-container').toggle(); return false"> | ||||
<div class="menulabel-notice ${notice_level}" > | ||||
${len(notice_messages)} | ||||
r2898 | </div> | |||
</a> | ||||
</li> | ||||
r4300 | <div class="notice-messages-container" style="display: none"> | |||
<div class="notice-messages"> | ||||
<table class="rctable"> | ||||
% for notice in notice_messages: | ||||
<tr id="notice-message-${notice['msg_id']}" class="notice-message-${notice['level']}"> | ||||
<td style="vertical-align: text-top; width: 20px"> | ||||
<i class="tooltip icon-info notice-color-${notice['level']}" title="${notice['level']}"></i> | ||||
</td> | ||||
<td> | ||||
<span><i class="icon-plus-squared cursor-pointer" onclick="$('#notice-${notice['msg_id']}').toggle()"></i> </span> | ||||
${notice['subject']} | ||||
r2898 | ||||
r4300 | <div id="notice-${notice['msg_id']}" style="display: none"> | |||
${h.render(notice['body'], renderer='markdown')} | ||||
</div> | ||||
</td> | ||||
<td style="vertical-align: text-top; width: 35px;"> | ||||
<a class="tooltip" title="${_('dismiss')}" href="#dismiss" onclick="dismissNotice(${notice['msg_id']});return false"> | ||||
<i class="icon-remove icon-filled-red"></i> | ||||
</a> | ||||
</td> | ||||
</tr> | ||||
% endfor | ||||
</table> | ||||
</div> | ||||
</div> | ||||
r2898 | ## Main filter | |||
r2774 | <li> | |||
<div class="menulabel main_filter_box"> | ||||
<div class="main_filter_input_box"> | ||||
r3556 | <ul class="searchItems"> | |||
r4095 | <li class="searchTag searchTagIcon"> | |||
<i class="icon-search"></i> | ||||
</li> | ||||
r3556 | % if c.template_context['search_context']['repo_id']: | |||
<li class="searchTag searchTagFilter searchTagHidable" > | ||||
##<a href="${h.route_path('search_repo',repo_name=c.template_context['search_context']['repo_name'])}"> | ||||
<span class="tag"> | ||||
This repo | ||||
r3680 | <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-cancel-circled"></i></a> | |||
r3556 | </span> | |||
##</a> | ||||
</li> | ||||
% elif c.template_context['search_context']['repo_group_id']: | ||||
<li class="searchTag searchTagFilter searchTagHidable"> | ||||
##<a href="${h.route_path('search_repo_group',repo_group_name=c.template_context['search_context']['repo_group_name'])}"> | ||||
<span class="tag"> | ||||
This group | ||||
r3680 | <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-cancel-circled"></i></a> | |||
r3556 | </span> | |||
##</a> | ||||
</li> | ||||
% endif | ||||
<li class="searchTagInput"> | ||||
r3750 | <input class="main_filter_input" id="main_filter" size="25" type="text" name="main_filter" placeholder="${_('search / go to...')}" value="" /> | |||
r3556 | </li> | |||
<li class="searchTag searchTagHelp"> | ||||
<a href="#showFilterHelp" onclick="showMainFilterBox(); return false">?</a> | ||||
</li> | ||||
</ul> | ||||
r2774 | </div> | |||
</div> | ||||
<div id="main_filter_help" style="display: none"> | ||||
r3443 | - Use '/' key to quickly access this field. | |||
r2774 | ||||
r3443 | - Enter a name of repository, or repository group for quick search. | |||
- Prefix query to allow special search: | ||||
r2774 | ||||
r4499 | <strong>user:</strong>admin, to search for usernames, always global | |||
r3556 | ||||
r4499 | <strong>user_group:</strong>devops, to search for user groups, always global | |||
r2774 | ||||
r4499 | <strong>pr:</strong>303, to search for pull request number, title, or description, always global | |||
r4329 | ||||
r4499 | <strong>commit:</strong>efced4, to search for commits, scoped to repositories or groups | |||
r3556 | ||||
r4499 | <strong>file:</strong>models.py, to search for file paths, scoped to repositories or groups | |||
r2795 | ||||
r3556 | % if c.template_context['search_context']['repo_id']: | |||
For advanced full text search visit: <a href="${h.route_path('search_repo',repo_name=c.template_context['search_context']['repo_name'])}">repository search</a> | ||||
% elif c.template_context['search_context']['repo_group_id']: | ||||
For advanced full text search visit: <a href="${h.route_path('search_repo_group',repo_group_name=c.template_context['search_context']['repo_group_name'])}">repository group search</a> | ||||
% else: | ||||
For advanced full text search visit: <a href="${h.route_path('search')}">global search</a> | ||||
% endif | ||||
r2774 | </div> | |||
</li> | ||||
r1282 | ||||
## ROOT MENU | ||||
r4062 | <li class="${h.is_active('home', active)}"> | |||
r3540 | <a class="menulink" title="${_('Home')}" href="${h.route_path('home')}"> | |||
<div class="menulabel">${_('Home')}</div> | ||||
</a> | ||||
</li> | ||||
r1282 | %if c.rhodecode_user.username != h.DEFAULT_USER: | |||
r4062 | <li class="${h.is_active('journal', active)}"> | |||
r1933 | <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}"> | |||
r1282 | <div class="menulabel">${_('Journal')}</div> | |||
</a> | ||||
</li> | ||||
%else: | ||||
r4062 | <li class="${h.is_active('journal', active)}"> | |||
r1933 | <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}"> | |||
r1282 | <div class="menulabel">${_('Public journal')}</div> | |||
</a> | ||||
</li> | ||||
%endif | ||||
r3540 | ||||
r4062 | <li class="${h.is_active('gists', active)}"> | |||
r1891 | <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}"> | |||
r1282 | <div class="menulabel">${_('Gists')}</div> | |||
</a> | ||||
</li> | ||||
r3540 | ||||
r3587 | % if c.is_super_admin or c.is_delegated_admin: | |||
r4062 | <li class="${h.is_active('admin', active)}"> | |||
r3564 | <a class="menulink childs" title="${_('Admin settings')}" href="${h.route_path('admin_home')}"> | |||
<div class="menulabel">${_('Admin')} </div> | ||||
r1282 | </a> | |||
</li> | ||||
r3587 | % endif | |||
r3564 | ||||
r2774 | ## render extra user menu | |||
${usermenu(active=(active=='my_account'))} | ||||
r1282 | </ul> | |||
<script type="text/javascript"> | ||||
r2774 | var visualShowPublicIcon = "${c.visual.show_public_icon}" == "True"; | |||
r1282 | ||||
r2774 | var formatRepoResult = function(result, container, query, escapeMarkup) { | |||
return function(data, escapeMarkup) { | ||||
if (!data.repo_id){ | ||||
return data.text; // optgroup text Repositories | ||||
r1282 | } | |||
r2774 | ||||
var tmpl = ''; | ||||
var repoType = data['repo_type']; | ||||
var repoName = data['text']; | ||||
if(data && data.type == 'repo'){ | ||||
if(repoType === 'hg'){ | ||||
tmpl += '<i class="icon-hg"></i> '; | ||||
} | ||||
else if(repoType === 'git'){ | ||||
tmpl += '<i class="icon-git"></i> '; | ||||
} | ||||
else if(repoType === 'svn'){ | ||||
tmpl += '<i class="icon-svn"></i> '; | ||||
} | ||||
if(data['private']){ | ||||
tmpl += '<i class="icon-lock" ></i> '; | ||||
} | ||||
else if(visualShowPublicIcon){ | ||||
tmpl += '<i class="icon-unlock-alt"></i> '; | ||||
} | ||||
r1282 | } | |||
r2774 | tmpl += escapeMarkup(repoName); | |||
return tmpl; | ||||
r1282 | ||||
r2774 | }(result, escapeMarkup); | |||
r1282 | }; | |||
r3424 | var formatRepoGroupResult = function(result, container, query, escapeMarkup) { | |||
return function(data, escapeMarkup) { | ||||
if (!data.repo_group_id){ | ||||
return data.text; // optgroup text Repositories | ||||
} | ||||
var tmpl = ''; | ||||
var repoGroupName = data['text']; | ||||
if(data){ | ||||
r3680 | tmpl += '<i class="icon-repo-group"></i> '; | |||
r3424 | ||||
} | ||||
tmpl += escapeMarkup(repoGroupName); | ||||
return tmpl; | ||||
}(result, escapeMarkup); | ||||
}; | ||||
r3556 | var escapeRegExChars = function (value) { | |||
return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); | ||||
}; | ||||
var getRepoIcon = function(repo_type) { | ||||
if (repo_type === 'hg') { | ||||
return '<i class="icon-hg"></i> '; | ||||
} | ||||
else if (repo_type === 'git') { | ||||
return '<i class="icon-git"></i> '; | ||||
} | ||||
else if (repo_type === 'svn') { | ||||
return '<i class="icon-svn"></i> '; | ||||
} | ||||
return '' | ||||
}; | ||||
r2774 | ||||
var autocompleteMainFilterFormatResult = function (data, value, org_formatter) { | ||||
if (value.split(':').length === 2) { | ||||
value = value.split(':')[1] | ||||
} | ||||
var searchType = data['type']; | ||||
r3750 | var searchSubType = data['subtype']; | |||
r2774 | var valueDisplay = data['value_display']; | |||
r4096 | var valueIcon = data['value_icon']; | |||
r2774 | ||||
var pattern = '(' + escapeRegExChars(value) + ')'; | ||||
r3556 | valueDisplay = Select2.util.escapeMarkup(valueDisplay); | |||
r3443 | ||||
r2774 | // highlight match | |||
r3556 | if (searchType != 'text') { | |||
valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>'); | ||||
} | ||||
r2774 | ||||
var icon = ''; | ||||
r1282 | ||||
r2804 | if (searchType === 'hint') { | |||
r3680 | icon += '<i class="icon-repo-group"></i> '; | |||
r2804 | } | |||
r3750 | // full text search/hints | |||
r2804 | else if (searchType === 'search') { | |||
r4096 | if (valueIcon === undefined) { | |||
icon += '<i class="icon-more"></i> '; | ||||
} else { | ||||
icon += valueIcon + ' '; | ||||
} | ||||
r3750 | if (searchSubType !== undefined && searchSubType == 'repo') { | |||
valueDisplay += '<div class="pull-right tag">repository</div>'; | ||||
} | ||||
else if (searchSubType !== undefined && searchSubType == 'repo_group') { | ||||
valueDisplay += '<div class="pull-right tag">repo group</div>'; | ||||
} | ||||
r2774 | } | |||
r3443 | // repository | |||
r2774 | else if (searchType === 'repo') { | |||
r3443 | ||||
var repoIcon = getRepoIcon(data['repo_type']); | ||||
icon += repoIcon; | ||||
r2774 | if (data['private']) { | |||
icon += '<i class="icon-lock" ></i> '; | ||||
} | ||||
else if (visualShowPublicIcon) { | ||||
icon += '<i class="icon-unlock-alt"></i> '; | ||||
} | ||||
} | ||||
r3443 | // repository groups | |||
r2774 | else if (searchType === 'repo_group') { | |||
r3680 | icon += '<i class="icon-repo-group"></i> '; | |||
r2774 | } | |||
r3443 | // user group | |||
r2795 | else if (searchType === 'user_group') { | |||
icon += '<i class="icon-group"></i> '; | ||||
} | ||||
r3556 | // user | |||
r2774 | else if (searchType === 'user') { | |||
icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']); | ||||
} | ||||
r4329 | // pull request | |||
else if (searchType === 'pull_request') { | ||||
icon += '<i class="icon-merge"></i> '; | ||||
} | ||||
r3443 | // commit | |||
r2774 | else if (searchType === 'commit') { | |||
r3443 | var repo_data = data['repo_data']; | |||
var repoIcon = getRepoIcon(repo_data['repository_type']); | ||||
if (repoIcon) { | ||||
icon += repoIcon; | ||||
} else { | ||||
icon += '<i class="icon-tag"></i>'; | ||||
} | ||||
r2774 | } | |||
r3542 | // file | |||
else if (searchType === 'file') { | ||||
var repo_data = data['repo_data']; | ||||
var repoIcon = getRepoIcon(repo_data['repository_type']); | ||||
if (repoIcon) { | ||||
icon += repoIcon; | ||||
} else { | ||||
icon += '<i class="icon-tag"></i>'; | ||||
} | ||||
} | ||||
r3556 | // generic text | |||
else if (searchType === 'text') { | ||||
icon = ''; | ||||
} | ||||
r1282 | ||||
r2774 | var tmpl = '<div class="ac-container-wrap">{0}{1}</div>'; | |||
return tmpl.format(icon, valueDisplay); | ||||
}; | ||||
var handleSelect = function(element, suggestion) { | ||||
r2804 | if (suggestion.type === "hint") { | |||
// we skip action | ||||
$('#main_filter').focus(); | ||||
r3556 | } | |||
else if (suggestion.type === "text") { | ||||
// we skip action | ||||
$('#main_filter').focus(); | ||||
r2804 | } else { | |||
window.location = suggestion['url']; | ||||
} | ||||
r2774 | }; | |||
r3556 | ||||
r2774 | var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) { | |||
if (queryLowerCase.split(':').length === 2) { | ||||
queryLowerCase = queryLowerCase.split(':')[1] | ||||
} | ||||
r3556 | if (suggestion.type === "text") { | |||
// special case we don't want to "skip" display for | ||||
return true | ||||
} | ||||
r2774 | return suggestion.value_display.toLowerCase().indexOf(queryLowerCase) !== -1; | |||
}; | ||||
r3556 | var cleanContext = { | |||
repo_view_type: null, | ||||
repo_id: null, | ||||
repo_name: "", | ||||
repo_group_id: null, | ||||
repo_group_name: null | ||||
}; | ||||
var removeGoToFilter = function () { | ||||
$('.searchTagHidable').hide(); | ||||
$('#main_filter').autocomplete( | ||||
'setOptions', {params:{search_context: cleanContext}}); | ||||
}; | ||||
r2774 | $('#main_filter').autocomplete({ | |||
serviceUrl: pyroutes.url('goto_switcher_data'), | ||||
r3556 | params: { | |||
"search_context": templateContext.search_context | ||||
}, | ||||
r2774 | minChars:2, | |||
maxHeight:400, | ||||
deferRequestBy: 300, //miliseconds | ||||
tabDisabled: true, | ||||
r3556 | autoSelectFirst: false, | |||
r3750 | containerClass: 'autocomplete-qfilter-suggestions', | |||
r2774 | formatResult: autocompleteMainFilterFormatResult, | |||
lookupFilter: autocompleteMainFilterResult, | ||||
r3320 | onSelect: function (element, suggestion) { | |||
r2774 | handleSelect(element, suggestion); | |||
return false; | ||||
r3320 | }, | |||
onSearchError: function (element, query, jqXHR, textStatus, errorThrown) { | ||||
if (jqXHR !== 'abort') { | ||||
r4339 | var message = formatErrorMessage(jqXHR, textStatus, errorThrown); | |||
SwalNoAnimation.fire({ | ||||
icon: 'error', | ||||
title: _gettext('Error during search operation'), | ||||
html: '<span style="white-space: pre-line">{0}</span>'.format(message), | ||||
}).then(function(result) { | ||||
window.location.reload(); | ||||
}) | ||||
r3320 | } | |||
r4095 | }, | |||
onSearchStart: function (params) { | ||||
$('.searchTag.searchTagIcon').html('<i class="icon-spin animate-spin"></i>') | ||||
}, | ||||
onSearchComplete: function (query, suggestions) { | ||||
$('.searchTag.searchTagIcon').html('<i class="icon-search"></i>') | ||||
}, | ||||
r1282 | }); | |||
r2774 | showMainFilterBox = function () { | |||
$('#main_filter_help').toggle(); | ||||
r3443 | }; | |||
r1282 | ||||
r3556 | $('#main_filter').on('keydown.autocomplete', function (e) { | |||
var BACKSPACE = 8; | ||||
var el = $(e.currentTarget); | ||||
if(e.which === BACKSPACE){ | ||||
var inputVal = el.val(); | ||||
if (inputVal === ""){ | ||||
removeGoToFilter() | ||||
} | ||||
} | ||||
}); | ||||
r4300 | var dismissNotice = function(noticeId) { | |||
var url = pyroutes.url('user_notice_dismiss', | ||||
{"user_id": templateContext.rhodecode_user.user_id}); | ||||
var postData = { | ||||
'csrf_token': CSRF_TOKEN, | ||||
'notice_id': noticeId, | ||||
}; | ||||
var success = function(response) { | ||||
$('#notice-message-' + noticeId).remove(); | ||||
return false; | ||||
}; | ||||
var failure = function(data, textStatus, xhr) { | ||||
alert("error processing request: " + textStatus); | ||||
return false; | ||||
}; | ||||
ajaxPOST(url, postData, success, failure); | ||||
} | ||||
r4453 | ||||
var hideLicenseWarning = function () { | ||||
var fingerprint = templateContext.session_attrs.license_fingerprint; | ||||
storeUserSessionAttr('rc_user_session_attr.hide_license_warning', fingerprint); | ||||
$('#notifications').hide(); | ||||
} | ||||
var hideLicenseError = function () { | ||||
var fingerprint = templateContext.session_attrs.license_fingerprint; | ||||
storeUserSessionAttr('rc_user_session_attr.hide_license_error', fingerprint); | ||||
$('#notifications').hide(); | ||||
} | ||||
r1282 | </script> | |||
<script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script> | ||||
</%def> | ||||
<div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> | ||||
<div class="modal-dialog"> | ||||
<div class="modal-content"> | ||||
<div class="modal-header"> | ||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||||
<h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4> | ||||
</div> | ||||
<div class="modal-body"> | ||||
<div class="block-left"> | ||||
<table class="keyboard-mappings"> | ||||
<tbody> | ||||
<tr> | ||||
<th></th> | ||||
<th>${_('Site-wide shortcuts')}</th> | ||||
</tr> | ||||
<% | ||||
elems = [ | ||||
r2774 | ('/', 'Use quick search box'), | |||
r1282 | ('g h', 'Goto home page'), | |||
('g g', 'Goto my private gists page'), | ||||
('g G', 'Goto my public gists page'), | ||||
r3424 | ('g 0-9', 'Goto bookmarked items from 0-9'), | |||
r1282 | ('n r', 'New repository page'), | |||
('n g', 'New gist page'), | ||||
] | ||||
%> | ||||
%for key, desc in elems: | ||||
<tr> | ||||
<td class="keys"> | ||||
<span class="key tag">${key}</span> | ||||
</td> | ||||
<td>${desc}</td> | ||||
</tr> | ||||
%endfor | ||||
</tbody> | ||||
</table> | ||||
</div> | ||||
<div class="block-left"> | ||||
<table class="keyboard-mappings"> | ||||
<tbody> | ||||
<tr> | ||||
<th></th> | ||||
<th>${_('Repositories')}</th> | ||||
</tr> | ||||
<% | ||||
elems = [ | ||||
('g s', 'Goto summary page'), | ||||
('g c', 'Goto changelog page'), | ||||
('g f', 'Goto files page'), | ||||
('g F', 'Goto files page with file search activated'), | ||||
('g p', 'Goto pull requests page'), | ||||
('g o', 'Goto repository settings'), | ||||
r3985 | ('g O', 'Goto repository access permissions settings'), | |||
r4485 | ('t s', 'Toggle sidebar on some pages'), | |||
r1282 | ] | |||
%> | ||||
%for key, desc in elems: | ||||
<tr> | ||||
<td class="keys"> | ||||
<span class="key tag">${key}</span> | ||||
</td> | ||||
<td>${desc}</td> | ||||
</tr> | ||||
%endfor | ||||
</tbody> | ||||
</table> | ||||
</div> | ||||
</div> | ||||
<div class="modal-footer"> | ||||
</div> | ||||
</div><!-- /.modal-content --> | ||||
</div><!-- /.modal-dialog --> | ||||
</div><!-- /.modal --> | ||||
r4485 | ||||
<script type="text/javascript"> | ||||
(function () { | ||||
"use sctrict"; | ||||
r4540 | // details block auto-hide menu | |||
$(document).mouseup(function(e) { | ||||
var container = $('.details-inline-block'); | ||||
if (!container.is(e.target) && container.has(e.target).length === 0) { | ||||
$('.details-inline-block[open]').removeAttr('open') | ||||
} | ||||
}); | ||||
r4485 | var $sideBar = $('.right-sidebar'); | |||
var expanded = $sideBar.hasClass('right-sidebar-expanded'); | ||||
var sidebarState = templateContext.session_attrs.sidebarState; | ||||
var sidebarEnabled = $('aside.right-sidebar').get(0); | ||||
if (sidebarState === 'expanded') { | ||||
expanded = true | ||||
} else if (sidebarState === 'collapsed') { | ||||
expanded = false | ||||
} | ||||
if (sidebarEnabled) { | ||||
// show sidebar since it's hidden on load | ||||
$('.right-sidebar').show(); | ||||
// init based on set initial class, or if defined user session attrs | ||||
if (expanded) { | ||||
window.expandSidebar(); | ||||
window.updateStickyHeader(); | ||||
} else { | ||||
window.collapseSidebar(); | ||||
window.updateStickyHeader(); | ||||
} | ||||
} | ||||
})() | ||||
</script> | ||||