##// END OF EJS Templates
ui: moved counter for PRs to last position as in style.
marcink -
r3767:97ee3f9f new-ui
parent child Browse files
Show More
@@ -1,974 +1,974 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="root.mako"/>
3 3
4 4 <%include file="/ejs_templates/templates.html"/>
5 5
6 6 <div class="outerwrapper">
7 7 <!-- HEADER -->
8 8 <div class="header">
9 9 <div id="header-inner" class="wrapper">
10 10 <div id="logo">
11 11 <div class="logo-wrapper">
12 12 <a href="${h.route_path('home')}"><img src="${h.asset('images/rhodecode-logo-white-60x60.png')}" alt="RhodeCode"/></a>
13 13 </div>
14 14 % if c.rhodecode_name:
15 15 <div class="branding">
16 16 <a href="${h.route_path('home')}">${h.branding(c.rhodecode_name)}</a>
17 17 </div>
18 18 % endif
19 19 </div>
20 20 <!-- MENU BAR NAV -->
21 21 ${self.menu_bar_nav()}
22 22 <!-- END MENU BAR NAV -->
23 23 </div>
24 24 </div>
25 25 ${self.menu_bar_subnav()}
26 26 <!-- END HEADER -->
27 27
28 28 <!-- CONTENT -->
29 29 <div id="content" class="wrapper">
30 30
31 31 <rhodecode-toast id="notifications"></rhodecode-toast>
32 32
33 33 <div class="main">
34 34 ${next.main()}
35 35 </div>
36 36 </div>
37 37 <!-- END CONTENT -->
38 38
39 39 </div>
40 40 <!-- FOOTER -->
41 41 <div id="footer">
42 42 <div id="footer-inner" class="title wrapper">
43 43 <div>
44 44 <p class="footer-link-right">
45 45 % if c.visual.show_version:
46 46 RhodeCode Enterprise ${c.rhodecode_version} ${c.rhodecode_edition}
47 47 % endif
48 48 &copy; 2010-${h.datetime.today().year}, <a href="${h.route_url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved.
49 49 % if c.visual.rhodecode_support_url:
50 50 <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a>
51 51 % endif
52 52 </p>
53 53 <% sid = 'block' if request.GET.get('showrcid') else 'none' %>
54 54 <p class="server-instance" style="display:${sid}">
55 55 ## display hidden instance ID if specially defined
56 56 % if c.rhodecode_instanceid:
57 57 ${_('RhodeCode instance id: {}').format(c.rhodecode_instanceid)}
58 58 % endif
59 59 </p>
60 60 </div>
61 61 </div>
62 62 </div>
63 63
64 64 <!-- END FOOTER -->
65 65
66 66 ### MAKO DEFS ###
67 67
68 68 <%def name="menu_bar_subnav()">
69 69 </%def>
70 70
71 71 <%def name="breadcrumbs(class_='breadcrumbs')">
72 72 <div class="${class_}">
73 73 ${self.breadcrumbs_links()}
74 74 </div>
75 75 </%def>
76 76
77 77 <%def name="admin_menu(active=None)">
78 78 <%
79 79 def is_active(selected):
80 80 if selected == active:
81 81 return "active"
82 82 %>
83 83
84 84 <div id="context-bar">
85 85 <div class="wrapper">
86 86 <div class="title">
87 87 <div class="title-content">
88 88 <div class="title-main">
89 89 % if c.is_super_admin:
90 90 ${_('Super Admin Panel')}
91 91 % else:
92 92 ${_('Delegated Admin Panel')}
93 93 % endif
94 94 </div>
95 95 </div>
96 96 </div>
97 97
98 98 <ul id="context-pages" class="navigation horizontal-list">
99 99
100 100 ## super admin case
101 101 % if c.is_super_admin:
102 102 <li class="${is_active('audit_logs')}"><a href="${h.route_path('admin_audit_logs')}">${_('Admin audit logs')}</a></li>
103 103 <li class="${is_active('repositories')}"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li>
104 104 <li class="${is_active('repository_groups')}"><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li>
105 105 <li class="${is_active('users')}"><a href="${h.route_path('users')}">${_('Users')}</a></li>
106 106 <li class="${is_active('user_groups')}"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li>
107 107 <li class="${is_active('permissions')}"><a href="${h.route_path('admin_permissions_application')}">${_('Permissions')}</a></li>
108 108 <li class="${is_active('authentication')}"><a href="${h.route_path('auth_home', traverse='')}">${_('Authentication')}</a></li>
109 109 <li class="${is_active('integrations')}"><a href="${h.route_path('global_integrations_home')}">${_('Integrations')}</a></li>
110 110 <li class="${is_active('defaults')}"><a href="${h.route_path('admin_defaults_repositories')}">${_('Defaults')}</a></li>
111 111 <li class="${is_active('settings')}"><a href="${h.route_path('admin_settings')}">${_('Settings')}</a></li>
112 112
113 113 ## delegated admin
114 114 % elif c.is_delegated_admin:
115 115 <%
116 116 repositories=c.auth_user.repositories_admin or c.can_create_repo
117 117 repository_groups=c.auth_user.repository_groups_admin or c.can_create_repo_group
118 118 user_groups=c.auth_user.user_groups_admin or c.can_create_user_group
119 119 %>
120 120
121 121 %if repositories:
122 122 <li class="${is_active('repositories')} local-admin-repos"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li>
123 123 %endif
124 124 %if repository_groups:
125 125 <li class="${is_active('repository_groups')} local-admin-repo-groups"><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li>
126 126 %endif
127 127 %if user_groups:
128 128 <li class="${is_active('user_groups')} local-admin-user-groups"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li>
129 129 %endif
130 130 % endif
131 131 </ul>
132 132
133 133 </div>
134 134 <div class="clear"></div>
135 135 </div>
136 136 </%def>
137 137
138 138 <%def name="dt_info_panel(elements)">
139 139 <dl class="dl-horizontal">
140 140 %for dt, dd, title, show_items in elements:
141 141 <dt>${dt}:</dt>
142 142 <dd title="${h.tooltip(title)}">
143 143 %if callable(dd):
144 144 ## allow lazy evaluation of elements
145 145 ${dd()}
146 146 %else:
147 147 ${dd}
148 148 %endif
149 149 %if show_items:
150 150 <span class="btn-collapse" data-toggle="item-${h.md5_safe(dt)[:6]}-details">${_('Show More')} </span>
151 151 %endif
152 152 </dd>
153 153
154 154 %if show_items:
155 155 <div class="collapsable-content" data-toggle="item-${h.md5_safe(dt)[:6]}-details" style="display: none">
156 156 %for item in show_items:
157 157 <dt></dt>
158 158 <dd>${item}</dd>
159 159 %endfor
160 160 </div>
161 161 %endif
162 162
163 163 %endfor
164 164 </dl>
165 165 </%def>
166 166
167 167 <%def name="gravatar(email, size=16)">
168 168 <%
169 169 if (size > 16):
170 170 gravatar_class = 'gravatar gravatar-large'
171 171 else:
172 172 gravatar_class = 'gravatar'
173 173 %>
174 174 <%doc>
175 175 TODO: johbo: For now we serve double size images to make it smooth
176 176 for retina. This is how it worked until now. Should be replaced
177 177 with a better solution at some point.
178 178 </%doc>
179 179 <img class="${gravatar_class}" src="${h.gravatar_url(email, size * 2)}" height="${size}" width="${size}">
180 180 </%def>
181 181
182 182
183 183 <%def name="gravatar_with_user(contact, size=16, show_disabled=False)">
184 184 <% email = h.email_or_none(contact) %>
185 185 <div class="rc-user tooltip" title="${h.tooltip(h.author_string(email))}">
186 186 ${self.gravatar(email, size)}
187 187 <span class="${'user user-disabled' if show_disabled else 'user'}"> ${h.link_to_user(contact)}</span>
188 188 </div>
189 189 </%def>
190 190
191 191
192 192 <%def name="repo_page_title(repo_instance)">
193 193 <div class="title-content repo-title">
194 194
195 195 <div class="title-main">
196 196 ## SVN/HG/GIT icons
197 197 %if h.is_hg(repo_instance):
198 198 <i class="icon-hg"></i>
199 199 %endif
200 200 %if h.is_git(repo_instance):
201 201 <i class="icon-git"></i>
202 202 %endif
203 203 %if h.is_svn(repo_instance):
204 204 <i class="icon-svn"></i>
205 205 %endif
206 206
207 207 ## public/private
208 208 %if repo_instance.private:
209 209 <i class="icon-repo-private"></i>
210 210 %else:
211 211 <i class="icon-repo-public"></i>
212 212 %endif
213 213
214 214 ## repo name with group name
215 215 ${h.breadcrumb_repo_link(repo_instance)}
216 216
217 217 ## Context Actions
218 218 <div class="pull-right">
219 219 %if c.rhodecode_user.username != h.DEFAULT_USER:
220 220 <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_name, _query=dict(auth_token=c.rhodecode_user.feed_token))}" title="${_('RSS Feed')}" class="btn btn-sm"><i class="icon-rss-sign"></i>RSS</a>
221 221
222 222 <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 '')}">
223 223 % if c.repository_is_user_following:
224 224 <i class="icon-eye-off"></i>${_('Unwatch')}
225 225 % else:
226 226 <i class="icon-eye"></i>${_('Watch')}
227 227 % endif
228 228
229 229 </a>
230 230 %else:
231 231 <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_name)}" title="${_('RSS Feed')}" class="btn btn-sm"><i class="icon-rss-sign"></i>RSS</a>
232 232 %endif
233 233 </div>
234 234
235 235 </div>
236 236
237 237 ## FORKED
238 238 %if repo_instance.fork:
239 239 <p class="discreet">
240 240 <i class="icon-code-fork"></i> ${_('Fork of')}
241 241 ${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))}
242 242 </p>
243 243 %endif
244 244
245 245 ## IMPORTED FROM REMOTE
246 246 %if repo_instance.clone_uri:
247 247 <p class="discreet">
248 248 <i class="icon-code-fork"></i> ${_('Clone from')}
249 249 <a href="${h.safe_str(h.hide_credentials(repo_instance.clone_uri))}">${h.hide_credentials(repo_instance.clone_uri)}</a>
250 250 </p>
251 251 %endif
252 252
253 253 ## LOCKING STATUS
254 254 %if repo_instance.locked[0]:
255 255 <p class="locking_locked discreet">
256 256 <i class="icon-repo-lock"></i>
257 257 ${_('Repository locked by %(user)s') % {'user': h.person_by_id(repo_instance.locked[0])}}
258 258 </p>
259 259 %elif repo_instance.enable_locking:
260 260 <p class="locking_unlocked discreet">
261 261 <i class="icon-repo-unlock"></i>
262 262 ${_('Repository not locked. Pull repository to lock it.')}
263 263 </p>
264 264 %endif
265 265
266 266 </div>
267 267 </%def>
268 268
269 269 <%def name="repo_menu(active=None)">
270 270 <%
271 271 def is_active(selected):
272 272 if selected == active:
273 273 return "active"
274 274 %>
275 275 % if c.rhodecode_db_repo.archived:
276 276 <div class="alert alert-warning text-center">
277 277 <strong>${_('This repository has been archived. It is now read-only.')}</strong>
278 278 </div>
279 279 % endif
280 280
281 281 <!--- REPO CONTEXT BAR -->
282 282 <div id="context-bar">
283 283 <div class="wrapper">
284 284
285 285 <div class="title">
286 286 ${self.repo_page_title(c.rhodecode_db_repo)}
287 287 </div>
288 288
289 289 <ul id="context-pages" class="navigation horizontal-list">
290 290 <li class="${is_active('summary')}"><a class="menulink" href="${h.route_path('repo_summary', repo_name=c.repo_name)}"><div class="menulabel">${_('Summary')}</div></a></li>
291 291 <li class="${is_active('commits')}"><a class="menulink" href="${h.route_path('repo_commits', repo_name=c.repo_name)}"><div class="menulabel">${_('Commits')}</div></a></li>
292 292 <li class="${is_active('files')}"><a class="menulink" href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.rhodecode_db_repo.landing_rev[1], f_path='')}"><div class="menulabel">${_('Files')}</div></a></li>
293 293 <li class="${is_active('compare')}"><a class="menulink" href="${h.route_path('repo_compare_select',repo_name=c.repo_name)}"><div class="menulabel">${_('Compare')}</div></a></li>
294 294
295 295 ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()"
296 296 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
297 297 <li class="${is_active('showpullrequest')}">
298 298 <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)}">
299 299 <div class="menulabel">
300 300 %if c.repository_pull_requests == 1:
301 ${c.repository_pull_requests} ${_('Pull Request')}
301 ${_('Pull Request')} ${c.repository_pull_requests}
302 302 %else:
303 ${c.repository_pull_requests} ${_('Pull Requests')}
303 ${_('Pull Requests')} ${c.repository_pull_requests}
304 304 %endif
305 305 </div>
306 306 </a>
307 307 </li>
308 308 %endif
309 309
310 310 <li class="${is_active('artifacts')}"><a class="menulink" href="${h.route_path('repo_artifacts_list',repo_name=c.repo_name)}"><div class="menulabel">${_('Artifacts')} (BETA)</div></a></li>
311 311
312 312 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
313 313 <li class="${is_active('settings')}"><a class="menulink" href="${h.route_path('edit_repo',repo_name=c.repo_name)}"><div class="menulabel">${_('Repository Settings')}</div></a></li>
314 314 %endif
315 315
316 316 ## determine if we have "any" option available
317 317 <%
318 318 can_lock = h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking
319 319 has_actions = (c.rhodecode_user.username != h.DEFAULT_USER and c.rhodecode_db_repo.repo_type in ['git','hg'] ) or can_lock
320 320 %>
321 321 <li class="${is_active('options')}">
322 322 % if has_actions:
323 323 <a class="menulink dropdown">
324 324 <div class="menulabel">${_('Options')}<div class="show_more"></div></div>
325 325 </a>
326 326 <ul class="submenu">
327 327 <li><a href="${h.route_path('repo_fork_new',repo_name=c.repo_name)}">${_('Fork this repository')}</a></li>
328 328 <li><a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a></li>
329 329 %if can_lock:
330 330 %if c.rhodecode_db_repo.locked[0]:
331 331 <li><a class="locking_del" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Unlock Repository')}</a></li>
332 332 %else:
333 333 <li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock Repository')}</a></li>
334 334 %endif
335 335 %endif
336 336 </ul>
337 337 % else:
338 338 <a class="menulink disabled">
339 339 <div class="menulabel">${_('Options')}<div class="show_more"></div></div>
340 340 </a>
341 341 % endif
342 342 </li>
343 343
344 344 </ul>
345 345 </div>
346 346 <div class="clear"></div>
347 347 </div>
348 348
349 349 <!--- REPO END CONTEXT BAR -->
350 350
351 351 </%def>
352 352
353 353 <%def name="repo_group_page_title(repo_group_instance)">
354 354 <div class="title-content">
355 355 <div class="title-main">
356 356 ## Repository Group icon
357 357 <i class="icon-repo-group"></i>
358 358
359 359 ## repo name with group name
360 360 ${h.breadcrumb_repo_group_link(repo_group_instance)}
361 361 </div>
362 362
363 363 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
364 364 <div class="repo-group-desc discreet">
365 365 ${dt.repo_group_desc(repo_group_instance.description_safe, repo_group_instance.personal, c.visual.stylify_metatags)}
366 366 </div>
367 367
368 368 </div>
369 369 </%def>
370 370
371 371 <%def name="repo_group_menu(active=None)">
372 372 <%
373 373 def is_active(selected):
374 374 if selected == active:
375 375 return "active"
376 376
377 377 gr_name = c.repo_group.group_name if c.repo_group else None
378 378 # create repositories with write permission on group is set to true
379 379 create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
380 380 group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page')
381 381 group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page')
382 382
383 383 %>
384 384
385 385 <!--- REPO GROUP CONTEXT BAR -->
386 386 <div id="context-bar">
387 387 <div class="wrapper">
388 388 <div class="title">
389 389 ${self.repo_group_page_title(c.repo_group)}
390 390 </div>
391 391
392 392 <ul id="context-pages" class="navigation horizontal-list">
393 393 <li class="${is_active('home')}"><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>
394 394 % if c.is_super_admin or group_admin:
395 395 <li class="${is_active('settings')}"><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>
396 396 % endif
397 397 ## determine if we have "any" option available
398 398 <%
399 399 can_create_repos = c.is_super_admin or group_admin or (group_write and create_on_write)
400 400 can_create_repo_groups = c.is_super_admin or group_admin
401 401 has_actions = can_create_repos or can_create_repo_groups
402 402 %>
403 403 <li class="${is_active('options')}">
404 404 % if has_actions:
405 405 <a class="menulink dropdown">
406 406 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
407 407 </a>
408 408 <ul class="submenu">
409 409 %if can_create_repos:
410 410 <li><a href="${h.route_path('repo_new',_query=dict(parent_group=c.repo_group.group_id))}">${_('Add Repository')}</a></li>
411 411 %endif
412 412 %if can_create_repo_groups:
413 413 <li><a href="${h.route_path('repo_group_new',_query=dict(parent_group=c.repo_group.group_id))}">${_(u'Add Repository Group')}</a></li>
414 414 %endif
415 415 </ul>
416 416 % else:
417 417 <a class="menulink disabled">
418 418 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
419 419 </a>
420 420 % endif
421 421 </li>
422 422 </ul>
423 423 </div>
424 424 <div class="clear"></div>
425 425 </div>
426 426
427 427 <!--- REPO GROUP CONTEXT BAR -->
428 428
429 429 </%def>
430 430
431 431
432 432 <%def name="usermenu(active=False)">
433 433 ## USER MENU
434 434 <li id="quick_login_li" class="${'active' if active else ''}">
435 435 % if c.rhodecode_user.username == h.DEFAULT_USER:
436 436 <a id="quick_login_link" class="menulink childs" href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">
437 437 ${gravatar(c.rhodecode_user.email, 20)}
438 438 <span class="user">
439 439 <span>${_('Sign in')}</span>
440 440 </span>
441 441 </a>
442 442 % else:
443 443 ## logged in user
444 444 <a id="quick_login_link" class="menulink childs">
445 445 ${gravatar(c.rhodecode_user.email, 20)}
446 446 <span class="user">
447 447 <span class="menu_link_user">${c.rhodecode_user.username}</span>
448 448 <div class="show_more"></div>
449 449 </span>
450 450 </a>
451 451 ## subnav with menu for logged in user
452 452 <div class="user-menu submenu">
453 453 <div id="quick_login">
454 454 %if c.rhodecode_user.username != h.DEFAULT_USER:
455 455 <div class="">
456 456 <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div>
457 457 <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
458 458 <div class="email">${c.rhodecode_user.email}</div>
459 459 </div>
460 460 <div class="">
461 461 <ol class="links">
462 462 <li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li>
463 463 % if c.rhodecode_user.personal_repo_group:
464 464 <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>
465 465 % endif
466 466 <li>${h.link_to(_(u'Pull Requests'), h.route_path('my_account_pullrequests'))}</li>
467 467 ## bookmark-items
468 468 <li class="bookmark-items">
469 469 ${_('Bookmarks')}
470 470 <div class="pull-right">
471 471 <a href="${h.route_path('my_account_bookmarks')}">${_('Manage')}</a>
472 472 </div>
473 473 </li>
474 474 % if not c.bookmark_items:
475 475 <li>
476 476 <a href="${h.route_path('my_account_bookmarks')}">${_('No Bookmarks yet.')}</a>
477 477 </li>
478 478 % endif
479 479 % for item in c.bookmark_items:
480 480 <li>
481 481 % if item.repository:
482 482 <div>
483 483 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
484 484 <code>${item.position}</code>
485 485 % if item.repository.repo_type == 'hg':
486 486 <i class="icon-hg" title="${_('Repository')}" style="font-size: 16px"></i>
487 487 % elif item.repository.repo_type == 'git':
488 488 <i class="icon-git" title="${_('Repository')}" style="font-size: 16px"></i>
489 489 % elif item.repository.repo_type == 'svn':
490 490 <i class="icon-svn" title="${_('Repository')}" style="font-size: 16px"></i>
491 491 % endif
492 492 ${(item.title or h.shorter(item.repository.repo_name, 30))}
493 493 </a>
494 494 </div>
495 495 % elif item.repository_group:
496 496 <div>
497 497 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
498 498 <code>${item.position}</code>
499 499 <i class="icon-repo-group" title="${_('Repository group')}" style="font-size: 14px"></i>
500 500 ${(item.title or h.shorter(item.repository_group.group_name, 30))}
501 501 </a>
502 502 </div>
503 503 % else:
504 504 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
505 505 <code>${item.position}</code>
506 506 ${item.title}
507 507 </a>
508 508 % endif
509 509 </li>
510 510 % endfor
511 511
512 512 <li class="logout">
513 513 ${h.secure_form(h.route_path('logout'), request=request)}
514 514 ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")}
515 515 ${h.end_form()}
516 516 </li>
517 517 </ol>
518 518 </div>
519 519 %endif
520 520 </div>
521 521 </div>
522 522 ## unread counter
523 523 <div class="pill_container">
524 524 <a class="menu_link_notifications ${'empty' if c.unread_notifications == 0 else ''}" href="${h.route_path('notifications_show_all')}">${c.unread_notifications}</a>
525 525 </div>
526 526 % endif
527 527 </li>
528 528 </%def>
529 529
530 530 <%def name="menu_items(active=None)">
531 531 <%
532 532 def is_active(selected):
533 533 if selected == active:
534 534 return "active"
535 535 return ""
536 536 %>
537 537
538 538 <ul id="quick" class="main_nav navigation horizontal-list">
539 539 ## notice box for important system messages
540 540 <li style="display: none">
541 541 <a class="notice-box" href="#openNotice" onclick="showNoticeBox(); return false">
542 542 <div class="menulabel-notice" >
543 543 0
544 544 </div>
545 545 </a>
546 546 </li>
547 547
548 548 ## Main filter
549 549 <li>
550 550 <div class="menulabel main_filter_box">
551 551 <div class="main_filter_input_box">
552 552 <ul class="searchItems">
553 553
554 554 % if c.template_context['search_context']['repo_id']:
555 555 <li class="searchTag searchTagFilter searchTagHidable" >
556 556 ##<a href="${h.route_path('search_repo',repo_name=c.template_context['search_context']['repo_name'])}">
557 557 <span class="tag">
558 558 This repo
559 559 <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-cancel-circled"></i></a>
560 560 </span>
561 561 ##</a>
562 562 </li>
563 563 % elif c.template_context['search_context']['repo_group_id']:
564 564 <li class="searchTag searchTagFilter searchTagHidable">
565 565 ##<a href="${h.route_path('search_repo_group',repo_group_name=c.template_context['search_context']['repo_group_name'])}">
566 566 <span class="tag">
567 567 This group
568 568 <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-cancel-circled"></i></a>
569 569 </span>
570 570 ##</a>
571 571 </li>
572 572 % endif
573 573
574 574 <li class="searchTagInput">
575 575 <input class="main_filter_input" id="main_filter" size="25" type="text" name="main_filter" placeholder="${_('search / go to...')}" value="" />
576 576 </li>
577 577 <li class="searchTag searchTagHelp">
578 578 <a href="#showFilterHelp" onclick="showMainFilterBox(); return false">?</a>
579 579 </li>
580 580 </ul>
581 581 </div>
582 582 </div>
583 583
584 584 <div id="main_filter_help" style="display: none">
585 585 - Use '/' key to quickly access this field.
586 586
587 587 - Enter a name of repository, or repository group for quick search.
588 588
589 589 - Prefix query to allow special search:
590 590
591 591 user:admin, to search for usernames, always global
592 592
593 593 user_group:devops, to search for user groups, always global
594 594
595 595 commit:efced4, to search for commits, scoped to repositories or groups
596 596
597 597 file:models.py, to search for file paths, scoped to repositories or groups
598 598
599 599 % if c.template_context['search_context']['repo_id']:
600 600 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>
601 601 % elif c.template_context['search_context']['repo_group_id']:
602 602 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>
603 603 % else:
604 604 For advanced full text search visit: <a href="${h.route_path('search')}">global search</a>
605 605 % endif
606 606 </div>
607 607 </li>
608 608
609 609 ## ROOT MENU
610 610 <li class="${is_active('home')}">
611 611 <a class="menulink" title="${_('Home')}" href="${h.route_path('home')}">
612 612 <div class="menulabel">${_('Home')}</div>
613 613 </a>
614 614 </li>
615 615
616 616 %if c.rhodecode_user.username != h.DEFAULT_USER:
617 617 <li class="${is_active('journal')}">
618 618 <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}">
619 619 <div class="menulabel">${_('Journal')}</div>
620 620 </a>
621 621 </li>
622 622 %else:
623 623 <li class="${is_active('journal')}">
624 624 <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}">
625 625 <div class="menulabel">${_('Public journal')}</div>
626 626 </a>
627 627 </li>
628 628 %endif
629 629
630 630 <li class="${is_active('gists')}">
631 631 <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}">
632 632 <div class="menulabel">${_('Gists')}</div>
633 633 </a>
634 634 </li>
635 635
636 636 % if c.is_super_admin or c.is_delegated_admin:
637 637 <li class="${is_active('admin')}">
638 638 <a class="menulink childs" title="${_('Admin settings')}" href="${h.route_path('admin_home')}">
639 639 <div class="menulabel">${_('Admin')} </div>
640 640 </a>
641 641 </li>
642 642 % endif
643 643
644 644 ## render extra user menu
645 645 ${usermenu(active=(active=='my_account'))}
646 646
647 647 % if c.debug_style:
648 648 <li>
649 649 <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}">
650 650 <div class="menulabel">${_('[Style]')}</div>
651 651 </a>
652 652 </li>
653 653 % endif
654 654 </ul>
655 655
656 656 <script type="text/javascript">
657 657 var visualShowPublicIcon = "${c.visual.show_public_icon}" == "True";
658 658
659 659 var formatRepoResult = function(result, container, query, escapeMarkup) {
660 660 return function(data, escapeMarkup) {
661 661 if (!data.repo_id){
662 662 return data.text; // optgroup text Repositories
663 663 }
664 664
665 665 var tmpl = '';
666 666 var repoType = data['repo_type'];
667 667 var repoName = data['text'];
668 668
669 669 if(data && data.type == 'repo'){
670 670 if(repoType === 'hg'){
671 671 tmpl += '<i class="icon-hg"></i> ';
672 672 }
673 673 else if(repoType === 'git'){
674 674 tmpl += '<i class="icon-git"></i> ';
675 675 }
676 676 else if(repoType === 'svn'){
677 677 tmpl += '<i class="icon-svn"></i> ';
678 678 }
679 679 if(data['private']){
680 680 tmpl += '<i class="icon-lock" ></i> ';
681 681 }
682 682 else if(visualShowPublicIcon){
683 683 tmpl += '<i class="icon-unlock-alt"></i> ';
684 684 }
685 685 }
686 686 tmpl += escapeMarkup(repoName);
687 687 return tmpl;
688 688
689 689 }(result, escapeMarkup);
690 690 };
691 691
692 692 var formatRepoGroupResult = function(result, container, query, escapeMarkup) {
693 693 return function(data, escapeMarkup) {
694 694 if (!data.repo_group_id){
695 695 return data.text; // optgroup text Repositories
696 696 }
697 697
698 698 var tmpl = '';
699 699 var repoGroupName = data['text'];
700 700
701 701 if(data){
702 702
703 703 tmpl += '<i class="icon-repo-group"></i> ';
704 704
705 705 }
706 706 tmpl += escapeMarkup(repoGroupName);
707 707 return tmpl;
708 708
709 709 }(result, escapeMarkup);
710 710 };
711 711
712 712 var escapeRegExChars = function (value) {
713 713 return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
714 714 };
715 715
716 716 var getRepoIcon = function(repo_type) {
717 717 if (repo_type === 'hg') {
718 718 return '<i class="icon-hg"></i> ';
719 719 }
720 720 else if (repo_type === 'git') {
721 721 return '<i class="icon-git"></i> ';
722 722 }
723 723 else if (repo_type === 'svn') {
724 724 return '<i class="icon-svn"></i> ';
725 725 }
726 726 return ''
727 727 };
728 728
729 729 var autocompleteMainFilterFormatResult = function (data, value, org_formatter) {
730 730
731 731 if (value.split(':').length === 2) {
732 732 value = value.split(':')[1]
733 733 }
734 734
735 735 var searchType = data['type'];
736 736 var searchSubType = data['subtype'];
737 737 var valueDisplay = data['value_display'];
738 738
739 739 var pattern = '(' + escapeRegExChars(value) + ')';
740 740
741 741 valueDisplay = Select2.util.escapeMarkup(valueDisplay);
742 742
743 743 // highlight match
744 744 if (searchType != 'text') {
745 745 valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
746 746 }
747 747
748 748 var icon = '';
749 749
750 750 if (searchType === 'hint') {
751 751 icon += '<i class="icon-repo-group"></i> ';
752 752 }
753 753 // full text search/hints
754 754 else if (searchType === 'search') {
755 755 icon += '<i class="icon-more"></i> ';
756 756 if (searchSubType !== undefined && searchSubType == 'repo') {
757 757 valueDisplay += '<div class="pull-right tag">repository</div>';
758 758 }
759 759 else if (searchSubType !== undefined && searchSubType == 'repo_group') {
760 760 valueDisplay += '<div class="pull-right tag">repo group</div>';
761 761 }
762 762 }
763 763 // repository
764 764 else if (searchType === 'repo') {
765 765
766 766 var repoIcon = getRepoIcon(data['repo_type']);
767 767 icon += repoIcon;
768 768
769 769 if (data['private']) {
770 770 icon += '<i class="icon-lock" ></i> ';
771 771 }
772 772 else if (visualShowPublicIcon) {
773 773 icon += '<i class="icon-unlock-alt"></i> ';
774 774 }
775 775 }
776 776 // repository groups
777 777 else if (searchType === 'repo_group') {
778 778 icon += '<i class="icon-repo-group"></i> ';
779 779 }
780 780 // user group
781 781 else if (searchType === 'user_group') {
782 782 icon += '<i class="icon-group"></i> ';
783 783 }
784 784 // user
785 785 else if (searchType === 'user') {
786 786 icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']);
787 787 }
788 788 // commit
789 789 else if (searchType === 'commit') {
790 790 var repo_data = data['repo_data'];
791 791 var repoIcon = getRepoIcon(repo_data['repository_type']);
792 792 if (repoIcon) {
793 793 icon += repoIcon;
794 794 } else {
795 795 icon += '<i class="icon-tag"></i>';
796 796 }
797 797 }
798 798 // file
799 799 else if (searchType === 'file') {
800 800 var repo_data = data['repo_data'];
801 801 var repoIcon = getRepoIcon(repo_data['repository_type']);
802 802 if (repoIcon) {
803 803 icon += repoIcon;
804 804 } else {
805 805 icon += '<i class="icon-tag"></i>';
806 806 }
807 807 }
808 808 // generic text
809 809 else if (searchType === 'text') {
810 810 icon = '';
811 811 }
812 812
813 813 var tmpl = '<div class="ac-container-wrap">{0}{1}</div>';
814 814 return tmpl.format(icon, valueDisplay);
815 815 };
816 816
817 817 var handleSelect = function(element, suggestion) {
818 818 if (suggestion.type === "hint") {
819 819 // we skip action
820 820 $('#main_filter').focus();
821 821 }
822 822 else if (suggestion.type === "text") {
823 823 // we skip action
824 824 $('#main_filter').focus();
825 825
826 826 } else {
827 827 window.location = suggestion['url'];
828 828 }
829 829 };
830 830
831 831 var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) {
832 832 if (queryLowerCase.split(':').length === 2) {
833 833 queryLowerCase = queryLowerCase.split(':')[1]
834 834 }
835 835 if (suggestion.type === "text") {
836 836 // special case we don't want to "skip" display for
837 837 return true
838 838 }
839 839 return suggestion.value_display.toLowerCase().indexOf(queryLowerCase) !== -1;
840 840 };
841 841
842 842 var cleanContext = {
843 843 repo_view_type: null,
844 844
845 845 repo_id: null,
846 846 repo_name: "",
847 847
848 848 repo_group_id: null,
849 849 repo_group_name: null
850 850 };
851 851 var removeGoToFilter = function () {
852 852 $('.searchTagHidable').hide();
853 853 $('#main_filter').autocomplete(
854 854 'setOptions', {params:{search_context: cleanContext}});
855 855 };
856 856
857 857 $('#main_filter').autocomplete({
858 858 serviceUrl: pyroutes.url('goto_switcher_data'),
859 859 params: {
860 860 "search_context": templateContext.search_context
861 861 },
862 862 minChars:2,
863 863 maxHeight:400,
864 864 deferRequestBy: 300, //miliseconds
865 865 tabDisabled: true,
866 866 autoSelectFirst: false,
867 867 containerClass: 'autocomplete-qfilter-suggestions',
868 868 formatResult: autocompleteMainFilterFormatResult,
869 869 lookupFilter: autocompleteMainFilterResult,
870 870 onSelect: function (element, suggestion) {
871 871 handleSelect(element, suggestion);
872 872 return false;
873 873 },
874 874 onSearchError: function (element, query, jqXHR, textStatus, errorThrown) {
875 875 if (jqXHR !== 'abort') {
876 876 alert("Error during search.\nError code: {0}".format(textStatus));
877 877 window.location = '';
878 878 }
879 879 }
880 880 });
881 881
882 882 showMainFilterBox = function () {
883 883 $('#main_filter_help').toggle();
884 884 };
885 885
886 886 $('#main_filter').on('keydown.autocomplete', function (e) {
887 887
888 888 var BACKSPACE = 8;
889 889 var el = $(e.currentTarget);
890 890 if(e.which === BACKSPACE){
891 891 var inputVal = el.val();
892 892 if (inputVal === ""){
893 893 removeGoToFilter()
894 894 }
895 895 }
896 896 });
897 897
898 898 </script>
899 899 <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script>
900 900 </%def>
901 901
902 902 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
903 903 <div class="modal-dialog">
904 904 <div class="modal-content">
905 905 <div class="modal-header">
906 906 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
907 907 <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4>
908 908 </div>
909 909 <div class="modal-body">
910 910 <div class="block-left">
911 911 <table class="keyboard-mappings">
912 912 <tbody>
913 913 <tr>
914 914 <th></th>
915 915 <th>${_('Site-wide shortcuts')}</th>
916 916 </tr>
917 917 <%
918 918 elems = [
919 919 ('/', 'Use quick search box'),
920 920 ('g h', 'Goto home page'),
921 921 ('g g', 'Goto my private gists page'),
922 922 ('g G', 'Goto my public gists page'),
923 923 ('g 0-9', 'Goto bookmarked items from 0-9'),
924 924 ('n r', 'New repository page'),
925 925 ('n g', 'New gist page'),
926 926 ]
927 927 %>
928 928 %for key, desc in elems:
929 929 <tr>
930 930 <td class="keys">
931 931 <span class="key tag">${key}</span>
932 932 </td>
933 933 <td>${desc}</td>
934 934 </tr>
935 935 %endfor
936 936 </tbody>
937 937 </table>
938 938 </div>
939 939 <div class="block-left">
940 940 <table class="keyboard-mappings">
941 941 <tbody>
942 942 <tr>
943 943 <th></th>
944 944 <th>${_('Repositories')}</th>
945 945 </tr>
946 946 <%
947 947 elems = [
948 948 ('g s', 'Goto summary page'),
949 949 ('g c', 'Goto changelog page'),
950 950 ('g f', 'Goto files page'),
951 951 ('g F', 'Goto files page with file search activated'),
952 952 ('g p', 'Goto pull requests page'),
953 953 ('g o', 'Goto repository settings'),
954 954 ('g O', 'Goto repository permissions settings'),
955 955 ]
956 956 %>
957 957 %for key, desc in elems:
958 958 <tr>
959 959 <td class="keys">
960 960 <span class="key tag">${key}</span>
961 961 </td>
962 962 <td>${desc}</td>
963 963 </tr>
964 964 %endfor
965 965 </tbody>
966 966 </table>
967 967 </div>
968 968 </div>
969 969 <div class="modal-footer">
970 970 </div>
971 971 </div><!-- /.modal-content -->
972 972 </div><!-- /.modal-dialog -->
973 973 </div><!-- /.modal -->
974 974
General Comments 0
You need to be logged in to leave comments. Login now