comparison rhodecode/templates/base/base.html @ 4116:ffd45b185016 rhodecode-2.2.5-gpl

Imported some of the GPLv3'd changes from RhodeCode v2.2.5. This imports changes between changesets 21af6c4eab3d and 6177597791c2 in RhodeCode's original repository, including only changes to Python files and HTML. RhodeCode clearly licensed its changes to these files under GPLv3 in their /LICENSE file, which states the following: The Python code and integrated HTML are licensed under the GPLv3 license. (See: https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE or http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE for an online copy of that LICENSE file) Conservancy reviewed these changes and confirmed that they can be licensed as a whole to the Kallithea project under GPLv3-only. While some of the contents committed herein are clearly licensed GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the statement above from RhodeCode indicates that they intend GPLv3-only as their license, per GPLv3ยง14 and other relevant sections of GPLv3.
author Bradley M. Kuhn <bkuhn@sfconservancy.org>
date Wed, 02 Jul 2014 19:03:13 -0400
parents 73ef2a5d3042
children 05ed7e20bd0f
comparison
equal deleted inserted replaced
4115:8b7294a804a0 4116:ffd45b185016
1 ## -*- coding: utf-8 -*- 1 ## -*- coding: utf-8 -*-
2 <%inherit file="root.html"/> 2 <%inherit file="root.html"/>
3 3
4 <!-- HEADER --> 4 <!-- HEADER -->
5 <div id="header-dd"></div>
6 <div id="header"> 5 <div id="header">
7 <div id="header-inner" class="title"> 6 <div id="header-inner" class="title">
8 <div id="logo"> 7 <div id="logo">
9 <h1><a href="${h.url('home')}">${c.rhodecode_name}</a></h1> 8 <div class="header">
9 <a href="${h.url('home')}"><img src="${h.url('/images/rhodecode-logo-white-216x60.png')}" alt="RhodeCode"/></a>
10 </div>
11 %if c.rhodecode_name:
12 <div class="branding">- ${c.rhodecode_name}</div>
13 %endif
10 </div> 14 </div>
11 <!-- MENU --> 15 <!-- MENU -->
12 ${self.page_nav()} 16 ${self.page_nav()}
13 <!-- END MENU --> 17 <!-- END MENU -->
14 ${self.body()} 18 ${self.body()}
16 </div> 20 </div>
17 <!-- END HEADER --> 21 <!-- END HEADER -->
18 22
19 <!-- CONTENT --> 23 <!-- CONTENT -->
20 <div id="content"> 24 <div id="content">
21 <div class="flash_msg"> 25 ${self.flash_msg()}
22 <% messages = h.flash.pop_messages() %>
23 % if messages:
24 <ul id="flash-messages">
25 % for message in messages:
26 <li class="${message.category}_msg">${message}</li>
27 % endfor
28 </ul>
29 % endif
30 </div>
31 <div id="main"> 26 <div id="main">
32 ${next.main()} 27 ${next.main()}
33 </div> 28 </div>
34 </div> 29 </div>
35 <!-- END CONTENT --> 30 <!-- END CONTENT -->
40 <div> 35 <div>
41 <p class="footer-link"> 36 <p class="footer-link">
42 ${_('Server instance: %s') % c.rhodecode_instanceid if c.rhodecode_instanceid else ''} 37 ${_('Server instance: %s') % c.rhodecode_instanceid if c.rhodecode_instanceid else ''}
43 </p> 38 </p>
44 <p class="footer-link-right"> 39 <p class="footer-link-right">
45 <a href="${h.url('rhodecode_official')}">
46 RhodeCode 40 RhodeCode
47 %if c.visual.show_version: 41 %if c.visual.show_version:
48 ${c.rhodecode_version} 42 ${c.rhodecode_version}
49 %endif 43 %endif
50 </a> 44 &copy; 2010-${h.datetime.today().year}, <a href="${h.url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved.
51 &copy; 2010-${h.datetime.today().year} by Marcin Kuzminski and others
52 %if c.rhodecode_bugtracker: 45 %if c.rhodecode_bugtracker:
53 &ndash; <a href="${c.rhodecode_bugtracker}">${_('Report a bug')}</a> 46 &ndash; <a href="${c.rhodecode_bugtracker}" target="_blank">${_('Support')}</a>
54 %endif 47 %endif
55 </p> 48 </p>
56 </div> 49 </div>
57 </div> 50 </div>
58 </div> 51 </div>
59 52
60 <!-- END FOOTER --> 53 <!-- END FOOTER -->
61 54
62 ### MAKO DEFS ### 55 ### MAKO DEFS ###
56
57 <%def name="flash_msg()">
58 <%include file="/base/flash_msg.html"/>
59 </%def>
60
63 <%def name="breadcrumbs()"> 61 <%def name="breadcrumbs()">
64 <div class="breadcrumbs"> 62 <div class="breadcrumbs">
65 ${self.breadcrumbs_links()} 63 ${self.breadcrumbs_links()}
66 </div> 64 </div>
67 </%def> 65 </%def>
68 66
69 <%def name="admin_menu()"> 67 <%def name="admin_menu()">
70 <ul class="admin_menu"> 68 <ul class="admin_menu">
71 <li>${h.link_to(_('Admin journal'),h.url('admin_home'),class_='journal ')}</li> 69 <li><a href="${h.url('admin_home')}"><i class="icon-book"></i> ${_('Admin journal')}</a></li>
72 <li>${h.link_to(_('Repositories'),h.url('repos'),class_='repos')}</li> 70 <li><a href="${h.url('repos')}"><i class="icon-archive"></i> ${_('Repositories')}</a></li>
73 <li>${h.link_to(_('Repository groups'),h.url('repos_groups'),class_='repos_groups')}</li> 71 <li><a href="${h.url('repos_groups')}"><i class="icon-folder-close"></i> ${_('Repository groups')}</a></li>
74 <li>${h.link_to(_('Users'),h.url('users'),class_='users')}</li> 72 <li><a href="${h.url('users')}"><i class="icon-user"></i> ${_('Users')}</a></li>
75 <li>${h.link_to(_('User groups'),h.url('users_groups'),class_='groups')}</li> 73 <li><a href="${h.url('users_groups')}"><i class="icon-group"></i> ${_('User groups')}</a></li>
76 <li>${h.link_to(_('Permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li> 74 <li><a href="${h.url('admin_permissions')}"><i class="icon-ban-circle"></i> ${_('Permissions')}</a></li>
77 <li>${h.link_to(_('LDAP'),h.url('ldap_home'),class_='ldap')}</li> 75 <li><a href="${h.url('auth_home')}"><i class="icon-key"></i> ${_('Authentication')}</a></li>
78 <li>${h.link_to(_('Defaults'),h.url('defaults'),class_='defaults')}</li> 76 <li><a href="${h.url('defaults')}"><i class="icon-wrench"></i> ${_('Defaults')}</a></li>
79 <li class="last">${h.link_to(_('Settings'),h.url('admin_settings'),class_='settings')}</li> 77 <li class="last"><a href="${h.url('admin_settings')}"><i class="icon-cog"></i> ${_('Settings')}</a></li>
80 </ul> 78 </ul>
81 </%def> 79
82 80 </%def>
81
82
83 ## admin menu used for people that have some admin resources
83 <%def name="admin_menu_simple(repositories=None, repository_groups=None, user_groups=None)"> 84 <%def name="admin_menu_simple(repositories=None, repository_groups=None, user_groups=None)">
84 <ul> 85 <ul>
85 %if repositories: 86 %if repositories:
86 <li>${h.link_to(_('Repositories'),h.url('repos'),class_='repos')}</li> 87 <li><a href="${h.url('repos')}"><i class="icon-archive"></i> ${_('Repositories')}</a></li>
87 %endif 88 %endif
88 %if repository_groups: 89 %if repository_groups:
89 <li>${h.link_to(_('Repository groups'),h.url('repos_groups'),class_='repos_groups')}</li> 90 <li><a href="${h.url('repos_groups')}"><i class="icon-folder-close"></i> ${_('Repository groups')}</a></li>
90 %endif 91 %endif
91 %if user_groups: 92 %if user_groups:
92 <li>${h.link_to(_('User groups'),h.url('users_groups'),class_='groups')}</li> 93 <li><a href="${h.url('users_groups')}"><i class="icon-group"></i> ${_('User groups')}</a></li>
93 %endif 94 %endif
94 </ul> 95 </ul>
95 </%def> 96 </%def>
96 97
97 <%def name="repo_context_bar(current=None)"> 98 <%def name="repo_context_bar(current=None)">
108 return h.literal('class="current"') 109 return h.literal('class="current"')
109 %> 110 %>
110 111
111 <!--- CONTEXT BAR --> 112 <!--- CONTEXT BAR -->
112 <div id="context-bar" class="box"> 113 <div id="context-bar" class="box">
114 <h2>
115 %if h.is_hg(c.rhodecode_db_repo):
116 <i class="icon-hg" style="color: #316293; font-size: 24px"></i>
117 %endif
118 %if h.is_git(c.rhodecode_db_repo):
119 <i class="icon-git" style="color: #e85634; font-size: 24px"></i>
120 %endif
121
122 ## public/private
123 %if c.rhodecode_db_repo.private:
124 <i class="icon-lock"></i>
125 %else:
126 <i class="icon-unlock-alt"></i>
127 %endif
128 ${h.repo_link(c.rhodecode_db_repo.groups_and_repo)}
129
130 %if current == 'createfork':
131 - ${_('Create fork')}
132 %endif
133 </h2>
134 <!--
113 <div id="breadcrumbs"> 135 <div id="breadcrumbs">
114 ${h.link_to(_(u'Repositories'),h.url('home'))} 136 ${h.link_to(_(u'Repositories'),h.url('home'))}
115 &raquo; 137 &raquo;
116 ${h.repo_link(c.rhodecode_db_repo.groups_and_repo)} 138 ${h.repo_link(c.rhodecode_db_repo.groups_and_repo)}
117 </div> 139 </div>
140 -->
118 <ul id="context-pages" class="horizontal-list"> 141 <ul id="context-pages" class="horizontal-list">
119 <li ${is_current('summary')}><a href="${h.url('summary_home', repo_name=c.repo_name)}" class="summary">${_('Summary')}</a></li> 142 <li ${is_current('summary')}><a href="${h.url('summary_home', repo_name=c.repo_name)}"><i class="icon-file-text"></i> ${_('Summary')}</a></li>
120 <li ${is_current('changelog')}><a href="${h.url('changelog_home', repo_name=c.repo_name)}" class="changelogs">${_('Changelog')}</a></li> 143 <li ${is_current('changelog')}><a href="${h.url('changelog_home', repo_name=c.repo_name)}"><i class="icon-time"></i> ${_('Changelog')}</a></li>
121 <li ${is_current('files')}><a href="${h.url('files_home', repo_name=c.repo_name)}" class="files"></span>${_('Files')}</a></li> 144 <li ${is_current('files')}><a href="${h.url('files_home', repo_name=c.repo_name)}"><i class="icon-file"></i> ${_('Files')}</a></li>
122 <li ${is_current('switch-to')}> 145 <li ${is_current('switch-to')}>
123 <a href="#" id="branch_tag_switcher_2" class="dropdown switch-to"></span>${_('Switch To')}</a> 146 <a href="#" id="branch_tag_switcher_2" class="dropdown"><i class="icon-random"></i> ${_('Switch To')}</a>
124 <ul id="switch_to_list_2" class="switch_to submenu"> 147 <ul id="switch_to_list_2" class="switch_to submenu">
125 <li><a href="#">${_('Loading...')}</a></li> 148 <li><a href="#">${_('Loading...')}</a></li>
126 </ul> 149 </ul>
127 </li> 150 </li>
128 <li ${is_current('options')}> 151 <li ${is_current('options')}>
129 <a href="#" class="dropdown options"></span>${_('Options')}</a> 152 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
153 <a href="${h.url('edit_repo',repo_name=c.repo_name)}" class="dropdown"><i class="icon-cogs"></i> ${_('Options')}</a>
154 %else:
155 <a href="#" class="dropdown"><i class="icon-cogs"></i> ${_('Options')}</a>
156 %endif
130 <ul> 157 <ul>
131 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name): 158 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
132 <li>${h.link_to(_('Settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')}</li> 159 <li><a href="${h.url('edit_repo',repo_name=c.repo_name)}"><i class="icon-cog"></i> ${_('Settings')}</a></li>
133 %endif 160 %endif
134 %if c.rhodecode_db_repo.fork: 161 %if c.rhodecode_db_repo.fork:
135 <li>${h.link_to(_('Compare fork'),h.url('compare_url',repo_name=c.rhodecode_db_repo.fork.repo_name,org_ref_type='branch',org_ref='default',other_repo=c.repo_name,other_ref_type='branch',other_ref=request.GET.get('branch') or 'default', merge=1),class_='compare_request')}</li> 162 <li><a href="${h.url('compare_url',repo_name=c.rhodecode_db_repo.fork.repo_name,org_ref_type=c.rhodecode_db_repo.landing_rev[0],org_ref=c.rhodecode_db_repo.landing_rev[1], other_repo=c.repo_name,other_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_rev[0],other_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1], merge=1)}">
163 <i class="icon-loop"></i> ${_('Compare fork')}</a></li>
136 %endif 164 %endif
137 <li>${h.link_to(_('Search'),h.url('search_repo',repo_name=c.repo_name),class_='search')}</li> 165 <li><a href="${h.url('compare_home',repo_name=c.repo_name)}"><i class="icon-loop"></i> ${_('Compare')}</a></li>
166
167 <li><a href="${h.url('search_repo',repo_name=c.repo_name)}"><i class="icon-search"></i> ${_('Search')}</a></li>
138 168
139 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking: 169 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking:
140 %if c.rhodecode_db_repo.locked[0]: 170 %if c.rhodecode_db_repo.locked[0]:
141 <li>${h.link_to(_('Unlock'), h.url('toggle_locking',repo_name=c.repo_name),class_='locking_del')}</li> 171 <li>${h.link_to(_('Unlock'), h.url('toggle_locking',repo_name=c.repo_name),class_='locking_del')}</li>
142 %else: 172 %else:
146 ## TODO: this check feels wrong, it would be better to have a check for permissions 176 ## TODO: this check feels wrong, it would be better to have a check for permissions
147 ## also it feels like a job for the controller 177 ## also it feels like a job for the controller
148 %if c.rhodecode_user.username != 'default': 178 %if c.rhodecode_user.username != 'default':
149 <li> 179 <li>
150 <a class="${follow_class()}" onclick="javascript:toggleFollowingRepo(this,${c.rhodecode_db_repo.repo_id},'${str(h.get_token())}');"> 180 <a class="${follow_class()}" onclick="javascript:toggleFollowingRepo(this,${c.rhodecode_db_repo.repo_id},'${str(h.get_token())}');">
151 <span class="show-follow">${_('Follow')}</span> 181 <span class="show-follow"><i class="icon-heart-empty"></i> ${_('Follow')}</span>
152 <span class="show-following">${_('Unfollow')}</span> 182 <span class="show-following"><i class="icon-heart"></i> ${_('Unfollow')}</span>
153 </a> 183 </a>
154 </li> 184 </li>
155 <li><a href="${h.url('repo_fork_home',repo_name=c.repo_name)}" class="fork">${_('Fork')}</a></li> 185 <li><a href="${h.url('repo_fork_home',repo_name=c.repo_name)}"><i class="icon-code-fork"></i> ${_('Fork')}</a></li>
156 %if h.is_hg(c.rhodecode_repo): 186 %if h.is_hg(c.rhodecode_repo):
157 <li><a href="${h.url('pullrequest_home',repo_name=c.repo_name)}" class="pull-request">${_('Create Pull Request')}</a></li> 187 <li><a href="${h.url('pullrequest_home',repo_name=c.repo_name)}"><i class="icon-code-fork"></i> ${_('Create Pull Request')}</a></li>
158 %endif 188 %endif
159 %endif 189 %endif
160 </ul> 190 </ul>
161 </li> 191 </li>
162 <li ${is_current('showpullrequest')}> 192 <li ${is_current('showpullrequest')}>
163 <a href="${h.url('pullrequest_show_all',repo_name=c.repo_name)}" title="${_('Show Pull Requests for %s') % c.repo_name}" class="pull-request">${_('Pull Requests')} 193 <a href="${h.url('pullrequest_show_all',repo_name=c.repo_name)}" title="${_('Show Pull Requests for %s') % c.repo_name}"> <i class="icon-code-fork"></i> ${_('Pull Requests')}
164 %if c.repository_pull_requests: 194 %if c.repository_pull_requests:
165 <span>${c.repository_pull_requests}</span> 195 <span>${c.repository_pull_requests}</span>
166 %endif 196 %endif
167 </a> 197 </a>
168 </li> 198 </li>
232 %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')(): 262 %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')():
233 ${h.link_to(_("Don't have an account ?"),h.url('register'))} 263 ${h.link_to(_("Don't have an account ?"),h.url('register'))}
234 %endif 264 %endif
235 </div> 265 </div>
236 <div class="submit"> 266 <div class="submit">
237 ${h.submit('sign_in',_('Log In'),class_="ui-btn xsmall")} 267 ${h.submit('sign_in',_('Log In'),class_="btn btn-mini")}
238 </div> 268 </div>
239 </div> 269 </div>
240 </div> 270 </div>
241 </div> 271 </div>
242 ${h.end_form()} 272 ${h.end_form()}
247 <div class="email">${c.rhodecode_user.email}</div> 277 <div class="email">${c.rhodecode_user.email}</div>
248 </div> 278 </div>
249 <div class="links_right"> 279 <div class="links_right">
250 <ol class="links"> 280 <ol class="links">
251 <li><a href="${h.url('notifications')}">${_('Notifications')}: ${c.unread_notifications}</a></li> 281 <li><a href="${h.url('notifications')}">${_('Notifications')}: ${c.unread_notifications}</a></li>
252 <li>${h.link_to(_(u'My account'),h.url('admin_settings_my_account'))}</li> 282 <li>${h.link_to(_(u'My account'),h.url('my_account'))}</li>
253 <li class="logout">${h.link_to(_(u'Log Out'),h.url('logout_home'))}</li> 283 <li class="logout">${h.link_to(_(u'Log Out'),h.url('logout_home'))}</li>
254 </ol> 284 </ol>
255 </div> 285 </div>
256 %endif 286 %endif
257 </div> 287 </div>
267 return h.literal('class="current"') 297 return h.literal('class="current"')
268 %> 298 %>
269 <ul id="quick" class="horizontal-list"> 299 <ul id="quick" class="horizontal-list">
270 <!-- repo switcher --> 300 <!-- repo switcher -->
271 <li ${is_current('repositories')}> 301 <li ${is_current('repositories')}>
272 <a class="menu_link repo_switcher childs" id="repo_switcher" title="${_('Switch repository')}" href="${h.url('home')}"> 302 <input id="repo_switcher" name="repo_switcher" type="hidden">
273 ${_('Repositories')}
274 </a>
275 <ul id="repo_switcher_list" class="repo_switcher">
276 <li>
277 <a href="#">${_('Loading...')}</a>
278 </li>
279 </ul>
280 </li> 303 </li>
304
281 ##ROOT MENU 305 ##ROOT MENU
282 %if c.rhodecode_user.username != 'default': 306 %if c.rhodecode_user.username != 'default':
283 <li ${is_current('journal')}> 307 <li ${is_current('journal')}>
284 <a class="menu_link journal" title="${_('Show recent activity')}" href="${h.url('journal')}"> 308 <a class="menu_link" title="${_('Show recent activity')}" href="${h.url('journal')}">
285 ${_('Journal')} 309 <i class="icon-book"></i> ${_('Journal')}
286 </a> 310 </a>
287 </li> 311 </li>
288 %else: 312 %else:
289 <li ${is_current('journal')}> 313 <li ${is_current('journal')}>
290 <a class="menu_link journal" title="${_('Public journal')}" href="${h.url('public_journal')}"> 314 <a class="menu_link" title="${_('Public journal')}" href="${h.url('public_journal')}">
291 ${_('Public journal')} 315 <i class="icon-book"></i> ${_('Public journal')}
292 </a> 316 </a>
293 </li> 317 </li>
294 %endif 318 %endif
295 <li ${is_current('gists')}> 319 <li ${is_current('gists')}>
296 <a class="menu_link gists childs" title="${_('Show public gists')}" href="${h.url('gists')}"> 320 <a class="menu_link childs" title="${_('Show public gists')}" href="${h.url('gists')}">
297 ${_('Gists')} 321 <i class="icon-file-2"></i> ${_('Gists')}
298 </a> 322 </a>
299 <ul class="admin_menu"> 323 <ul class="admin_menu">
300 <li>${h.link_to(_('Create new gist'),h.url('new_gist'),class_='gists-new ')}</li> 324 <li><a href="${h.url('new_gist', public=1)}"><i class="icon-file-alt"></i> ${_('Create new gist')}</a></li>
301 <li>${h.link_to(_('All public gists'),h.url('gists'),class_='gists ')}</li> 325 <li><a href="${h.url('gists')}"><i class="icon-copy"></i> ${_('All public gists')}</a></li>
302 %if c.rhodecode_user.username != 'default': 326 %if c.rhodecode_user.username != 'default':
303 <li>${h.link_to(_('My public gists'),h.url('gists', public=1),class_='gists')}</li> 327 <li><a href="${h.url('gists', public=1)}"><i class="icon-copy"></i> ${_('My public gists')}</a></li>
304 <li>${h.link_to(_('My private gists'),h.url('gists', private=1),class_='gists-private ')}</li> 328 <li><a href="${h.url('gists', private=1)}"><i class="icon-file-text"></i> ${_('My private gists')}</a></li>
305 %endif 329 %endif
306 </ul> 330 </ul>
307 </li> 331 </li>
308 <li ${is_current('search')}> 332 <li ${is_current('search')}>
309 <a class="menu_link search" title="${_('Search in repositories')}" href="${h.url('search')}"> 333 <a class="menu_link" title="${_('Search in repositories')}" href="${h.url('search')}">
310 ${_('Search')} 334 <i class="icon-search"></i> ${_('Search')}
311 </a> 335 </a>
312 </li> 336 </li>
313 % if h.HasPermissionAll('hg.admin')('access admin main page'): 337 % if h.HasPermissionAll('hg.admin')('access admin main page'):
314 <li ${is_current('admin')}> 338 <li ${is_current('admin')}>
315 <a class="menu_link admin childs" title="${_('Admin')}" href="${h.url('admin_home')}"> 339 <a class="menu_link childs" title="${_('Admin')}" href="${h.url('admin_home')}">
316 ${_('Admin')} 340 <i class="icon-cog"></i> ${_('Admin')}
317 </a> 341 </a>
318 ${admin_menu()} 342 ${admin_menu()}
319 </li> 343 </li>
320 % elif c.rhodecode_user.repositories_admin or c.rhodecode_user.repository_groups_admin or c.rhodecode_user.user_groups_admin: 344 % elif c.rhodecode_user.repositories_admin or c.rhodecode_user.repository_groups_admin or c.rhodecode_user.user_groups_admin:
321 <li ${is_current('admin')}> 345 <li ${is_current('admin')}>
322 <a class="menu_link admin childs" title="${_('Admin')}"> 346 <a class="menu_link childs" title="${_('Admin')}">
323 ${_('Admin')} 347 <i class="icon-cog"></i> ${_('Admin')}
324 </a> 348 </a>
325 ${admin_menu_simple(c.rhodecode_user.repositories_admin, 349 ${admin_menu_simple(c.rhodecode_user.repositories_admin,
326 c.rhodecode_user.repository_groups_admin, 350 c.rhodecode_user.repository_groups_admin,
327 c.rhodecode_user.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')())} 351 c.rhodecode_user.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')())}
328 </li> 352 </li>
329 % endif 353 % endif
330 ${usermenu()} 354 ${usermenu()}
331 <script type="text/javascript"> 355
332 YUE.on('repo_switcher','mouseover',function(){ 356 <script type="text/javascript">
333 var target = 'q_filter_rs'; 357 var visual_show_public_icon = "${c.visual.show_public_icon}" == "True";
334 var qfilter_activate = function(){ 358 var cache = {}
335 var nodes = YUQ('ul#repo_switcher_list li a.repo_name'); 359 /*format the look of items in the list*/
336 var func = function(node){ 360 var format = function(state){
337 return node.parentNode; 361 if (!state.id){
338 } 362 return state.text; // optgroup
339 q_filter(target,nodes,func); 363 }
340 } 364 var obj_dict = state.obj;
341 365 var tmpl = '';
342 var loaded = YUD.hasClass('repo_switcher','loaded'); 366
343 if(!loaded){ 367 if(obj_dict && state.type == 'repo'){
344 YUD.addClass('repo_switcher','loaded'); 368 if(obj_dict['repo_type'] === 'hg'){
345 ypjax("${h.url('repo_switcher')}",'repo_switcher_list', 369 tmpl += '<i class="icon-hg"></i> ';
346 function(o){qfilter_activate();YUD.get(target).focus()}, 370 }
347 function(o){YUD.removeClass('repo_switcher','loaded');} 371 else if(obj_dict['repo_type'] === 'git'){
348 ,null); 372 tmpl += '<i class="icon-git"></i> ';
349 }else{ 373 }
350 YUD.get(target).focus(); 374 if(obj_dict['private']){
351 } 375 tmpl += '<i class="icon-lock" style="color: #e85634;"></i> ';
352 return false; 376 }
353 }); 377 else if(visual_show_public_icon){
354 378 tmpl += '<i class="icon-unlock-alt"></i> ';
355 YUE.on('header-dd', 'click',function(e){ 379 }
356 YUD.addClass('header-inner', 'hover'); 380 }
357 YUD.addClass('content', 'hover'); 381 if(obj_dict && state.type == 'group'){
358 }); 382 tmpl += '<i class="icon-folder-close"></i> ';
359 383 }
360 </script> 384 tmpl += state.text;
361 </%def> 385 return tmpl;
386 }
387
388 $("#repo_switcher").select2({
389 placeholder: '<i class="icon-archive"></i> ${_('Repositories')} <i class="icon-caret-down"></i>',
390 dropdownAutoWidth: true,
391 formatResult: format,
392 formatSelection: format,
393 formatNoMatches: function(term){
394 return "${_('No matches found')}";
395 },
396 containerCssClass: "repo-switcher",
397 dropdownCssClass: "repo-switcher-dropdown",
398 escapeMarkup: function(m){
399 // don't escape our custom placeholder
400 if(m.substr(0,28) == '<i class="icon-archive"></i>'){
401 return m;
402 }
403
404 return Select2.util.escapeMarkup(m);
405 },
406 query: function(query){
407 var key = 'cache';
408 var cached = cache[key] ;
409 if(cached) {
410 var data = {results: []};
411 //filter results
412 $.each(cached.results, function(){
413 var section = this.text;
414 var children = [];
415 $.each(this.children, function(){
416 if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){
417 children.push({'id': this.id, 'text': this.text, 'type': this.type, 'obj': this.obj})
418 }
419 })
420 if(children.length !== 0){
421 data.results.push({'text': section, 'children': children})
422 }
423
424 });
425 query.callback(data);
426 }else{
427 $.ajax({
428 url: "${h.url('repo_switcher_data')}",
429 data: {},
430 dataType: 'json',
431 type: 'GET',
432 success: function(data) {
433 cache[key] = data;
434 query.callback({results: data.results});
435 }
436 })
437 }
438 },
439 });
440
441 $("#repo_switcher").on('select2-selecting', function(e){
442 e.preventDefault();
443 window.location = pyroutes.url('summary_home', {'repo_name': e.val})
444 })
445
446 ## Global mouse bindings ##
447
448 // general help "?"
449 Mousetrap.bind(['?'], function(e) {
450 $('#help_kb').modal({})
451 });
452
453 // / open the quick filter
454 Mousetrap.bind(['/'], function(e) {
455 $("#repo_switcher").select2("open");
456
457 // return false to prevent default browser behavior
458 // and stop event from bubbling
459 return false;
460 });
461
462 // ctrl/command+b, show the the main bar
463 Mousetrap.bind(['command+b', 'ctrl+b'], function(e) {
464 if($('#header-inner').hasClass('hover') && $('#content').hasClass('hover')){
465 $('#header-inner').removeClass('hover');
466 $('#content').removeClass('hover');
467 }
468 else{
469 $('#header-inner').addClass('hover');
470 $('#content').addClass('hover');
471 }
472 return false;
473 });
474
475 // general nav g + action
476 Mousetrap.bind(['g h'], function(e) {
477 window.location = pyroutes.url('home');
478 });
479 Mousetrap.bind(['g g'], function(e) {
480 window.location = pyroutes.url('gists', {'private':1});
481 });
482 Mousetrap.bind(['g G'], function(e) {
483 window.location = pyroutes.url('gists', {'public':1});
484 });
485 Mousetrap.bind(['n g'], function(e) {
486 window.location = pyroutes.url('new_gist');
487 });
488 Mousetrap.bind(['n r'], function(e) {
489 window.location = pyroutes.url('new_repo');
490 });
491
492 % if hasattr(c, 'repo_name') and hasattr(c, 'rhodecode_db_repo'):
493 // nav in repo context
494 Mousetrap.bind(['g s'], function(e) {
495 window.location = pyroutes.url('summary_home', {'repo_name': REPO_NAME});
496 });
497 Mousetrap.bind(['g c'], function(e) {
498 window.location = pyroutes.url('changelog_home', {'repo_name': REPO_NAME});
499 });
500 Mousetrap.bind(['g F'], function(e) {
501 window.location = pyroutes.url('files_home', {'repo_name': REPO_NAME, 'revision': '${c.rhodecode_db_repo.landing_rev[1]}', 'f_path': '', 'search': '1'});
502 });
503 Mousetrap.bind(['g f'], function(e) {
504 window.location = pyroutes.url('files_home', {'repo_name': REPO_NAME, 'revision': '${c.rhodecode_db_repo.landing_rev[1]}', 'f_path': ''});
505 });
506 Mousetrap.bind(['g o'], function(e) {
507 window.location = pyroutes.url('edit_repo', {'repo_name': REPO_NAME});
508 });
509 Mousetrap.bind(['g O'], function(e) {
510 window.location = pyroutes.url('edit_repo_perms', {'repo_name': REPO_NAME});
511 });
512 % endif
513
514 </script>
515 </%def>
516
517 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
518 <div class="modal-dialog">
519 <div class="modal-content">
520 <div class="modal-header">
521 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
522 <h4 class="modal-title">${_('Keyboard shortcuts')}</h4>
523 </div>
524 <div class="modal-body">
525 <div class="row">
526 <div class="col-md-5">
527 <table class="keyboard-mappings">
528 <tbody>
529 <tr>
530 <th></th>
531 <th>${_('Site-wide shortcuts')}</th>
532 </tr>
533 <%
534 elems = [
535 ('/', 'Open quick search box'),
536 ('ctrl/cmd+b', 'Show main settings bar'),
537 ('g h', 'Goto home page'),
538 ('g g', 'Goto my private gists page'),
539 ('g G', 'Goto my public gists page'),
540 ('n r', 'New repository page'),
541 ('n g', 'New gist page'),
542 ]
543 %>
544 %for key, desc in elems:
545 <tr>
546 <td class="keys">
547 <span class="key">${key}</span>
548 </td>
549 <td>${desc}</td>
550 </tr>
551 %endfor
552 </tbody>
553 </table>
554 </div>
555 <div class="col-md-offset-5">
556 <table class="keyboard-mappings">
557 <tbody>
558 <tr>
559 <th></th>
560 <th>${_('Repositories')}</th>
561 </tr>
562 <%
563 elems = [
564 ('g s', 'Goto summary page'),
565 ('g c', 'Goto changelog page'),
566 ('g f', 'Goto files page'),
567 ('g F', 'Goto files page with file search activated'),
568 ('g o', 'Goto repository settings'),
569 ('g O', 'Goto repository permissions settings'),
570 ]
571 %>
572 %for key, desc in elems:
573 <tr>
574 <td class="keys">
575 <span class="key">${key}</span>
576 </td>
577 <td>${desc}</td>
578 </tr>
579 %endfor
580 </tbody>
581 </table>
582 </div>
583 </div>
584 </div>
585 <div class="modal-footer">
586 </div>
587 </div><!-- /.modal-content -->
588 </div><!-- /.modal-dialog -->
589 </div><!-- /.modal -->