##// END OF EJS Templates
ui: bookmarks, optimized editing to be less in the face.
marcink -
r3909:3bb90fa7 default
parent child Browse files
Show More
@@ -1,1056 +1,1061 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_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>
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_uid)}" 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 ## determine if we have "any" option available
275 275 can_lock = h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking
276 276 has_actions = can_lock
277 277
278 278 %>
279 279 % if c.rhodecode_db_repo.archived:
280 280 <div class="alert alert-warning text-center">
281 281 <strong>${_('This repository has been archived. It is now read-only.')}</strong>
282 282 </div>
283 283 % endif
284 284
285 285 <!--- REPO CONTEXT BAR -->
286 286 <div id="context-bar">
287 287 <div class="wrapper">
288 288
289 289 <div class="title">
290 290 ${self.repo_page_title(c.rhodecode_db_repo)}
291 291 </div>
292 292
293 293 <ul id="context-pages" class="navigation horizontal-list">
294 294 <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>
295 295 <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>
296 296 <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>
297 297 <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>
298 298
299 299 ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()"
300 300 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
301 301 <li class="${is_active('showpullrequest')}">
302 302 <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)}">
303 303 <div class="menulabel">
304 304 %if c.repository_pull_requests == 1:
305 305 ${_('Pull Request')} ${c.repository_pull_requests}
306 306 %else:
307 307 ${_('Pull Requests')} ${c.repository_pull_requests}
308 308 %endif
309 309 </div>
310 310 </a>
311 311 </li>
312 312 %endif
313 313
314 314 <li class="${is_active('artifacts')}"><a class="menulink" href="${h.route_path('repo_artifacts_list',repo_name=c.repo_name)}"><div class="menulabel">${_('Artifacts')}</div></a></li>
315 315
316 316 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
317 317 <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>
318 318 %endif
319 319
320 320 <li class="${is_active('options')}">
321 321 % if has_actions:
322 322 <a class="menulink dropdown">
323 323 <div class="menulabel">${_('Options')}<div class="show_more"></div></div>
324 324 </a>
325 325 <ul class="submenu">
326 326 %if can_lock:
327 327 %if c.rhodecode_db_repo.locked[0]:
328 328 <li><a class="locking_del" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Unlock Repository')}</a></li>
329 329 %else:
330 330 <li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock Repository')}</a></li>
331 331 %endif
332 332 %endif
333 333 </ul>
334 334 % else:
335 335 <a class="menulink disabled">
336 336 <div class="menulabel">${_('Options')}<div class="show_more"></div></div>
337 337 </a>
338 338 % endif
339 339 </li>
340 340
341 341 </ul>
342 342 </div>
343 343 <div class="clear"></div>
344 344 </div>
345 345
346 346 <!--- REPO END CONTEXT BAR -->
347 347
348 348 </%def>
349 349
350 350 <%def name="repo_group_page_title(repo_group_instance)">
351 351 <div class="title-content">
352 352 <div class="title-main">
353 353 ## Repository Group icon
354 354 <i class="icon-repo-group"></i>
355 355
356 356 ## repo name with group name
357 357 ${h.breadcrumb_repo_group_link(repo_group_instance)}
358 358 </div>
359 359
360 360 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
361 361 <div class="repo-group-desc discreet">
362 362 ${dt.repo_group_desc(repo_group_instance.description_safe, repo_group_instance.personal, c.visual.stylify_metatags)}
363 363 </div>
364 364
365 365 </div>
366 366 </%def>
367 367
368 368
369 369 <%def name="repo_group_menu(active=None)">
370 370 <%
371 371 def is_active(selected):
372 372 if selected == active:
373 373 return "active"
374 374
375 375 gr_name = c.repo_group.group_name if c.repo_group else None
376 376 # create repositories with write permission on group is set to true
377 377 group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page')
378 378
379 379 %>
380 380
381 381
382 382 <!--- REPO GROUP CONTEXT BAR -->
383 383 <div id="context-bar">
384 384 <div class="wrapper">
385 385 <div class="title">
386 386 ${self.repo_group_page_title(c.repo_group)}
387 387 </div>
388 388
389 389 <ul id="context-pages" class="navigation horizontal-list">
390 390 <li class="${is_active('home')}">
391 391 <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>
392 392 </li>
393 393 % if c.is_super_admin or group_admin:
394 394 <li class="${is_active('settings')}">
395 395 <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>
396 396 </li>
397 397 % endif
398 398
399 399 </ul>
400 400 </div>
401 401 <div class="clear"></div>
402 402 </div>
403 403
404 404 <!--- REPO GROUP CONTEXT BAR -->
405 405
406 406 </%def>
407 407
408 408
409 409 <%def name="usermenu(active=False)">
410 410 <%
411 411 not_anonymous = c.rhodecode_user.username != h.DEFAULT_USER
412 412
413 413 gr_name = c.repo_group.group_name if (hasattr(c, 'repo_group') and c.repo_group) else None
414 414 # create repositories with write permission on group is set to true
415 415
416 416 can_fork = c.is_super_admin or h.HasPermissionAny('hg.fork.repository')()
417 417 create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
418 418 group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page')
419 419 group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page')
420 420
421 421 can_create_repos = c.is_super_admin or c.can_create_repo
422 422 can_create_repo_groups = c.is_super_admin or c.can_create_repo_group
423 423
424 424 can_create_repos_in_group = c.is_super_admin or group_admin or (group_write and create_on_write)
425 425 can_create_repo_groups_in_group = c.is_super_admin or group_admin
426 426 %>
427 427
428 428 % if not_anonymous:
429 429 <%
430 430 default_target_group = dict()
431 431 if c.rhodecode_user.personal_repo_group:
432 432 default_target_group = dict(parent_group=c.rhodecode_user.personal_repo_group.group_id)
433 433 %>
434 434
435 435 ## create action
436 436 <li>
437 437 <a href="#create-actions" onclick="return false;" class="menulink childs">
438 438 <i class="icon-plus-circled"></i>
439 439 </a>
440 440
441 441 <div class="action-menu submenu">
442 442
443 443 <ol>
444 444 ## scope of within a repository
445 445 % if hasattr(c, 'rhodecode_db_repo') and c.rhodecode_db_repo:
446 446 <li class="submenu-title">${_('This Repository')}</li>
447 447 <li>
448 448 <a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a>
449 449 </li>
450 450 % if can_fork:
451 451 <li>
452 452 <a href="${h.route_path('repo_fork_new',repo_name=c.repo_name,_query=default_target_group)}">${_('Fork this repository')}</a>
453 453 </li>
454 454 % endif
455 455 % endif
456 456
457 457 ## scope of within repository groups
458 458 % if hasattr(c, 'repo_group') and c.repo_group and (can_create_repos_in_group or can_create_repo_groups_in_group):
459 459 <li class="submenu-title">${_('This Repository Group')}</li>
460 460
461 461 % if can_create_repos_in_group:
462 462 <li>
463 463 <a href="${h.route_path('repo_new',_query=default_target_group)}">${_('New Repository')}</a>
464 464 </li>
465 465 % endif
466 466
467 467 % if can_create_repo_groups_in_group:
468 468 <li>
469 469 <a href="${h.route_path('repo_group_new',_query=default_target_group)}">${_(u'New Repository Group')}</a>
470 470 </li>
471 471 % endif
472 472 % endif
473 473
474 474 ## personal group
475 475 % if c.rhodecode_user.personal_repo_group:
476 476 <li class="submenu-title">Personal Group</li>
477 477
478 478 <li>
479 479 <a href="${h.route_path('repo_new',_query=dict(parent_group=c.rhodecode_user.personal_repo_group.group_id))}" >${_('New Repository')} </a>
480 480 </li>
481 481
482 482 <li>
483 483 <a href="${h.route_path('repo_group_new',_query=dict(parent_group=c.rhodecode_user.personal_repo_group.group_id))}">${_('New Repository Group')} </a>
484 484 </li>
485 485 % endif
486 486
487 487 ## Global actions
488 488 <li class="submenu-title">RhodeCode</li>
489 489 % if can_create_repos:
490 490 <li>
491 491 <a href="${h.route_path('repo_new')}" >${_('New Repository')}</a>
492 492 </li>
493 493 % endif
494 494
495 495 % if can_create_repo_groups:
496 496 <li>
497 497 <a href="${h.route_path('repo_group_new')}" >${_(u'New Repository Group')}</a>
498 498 </li>
499 499 % endif
500 500
501 501 <li>
502 502 <a href="${h.route_path('gists_new')}">${_(u'New Gist')}</a>
503 503 </li>
504 504
505 505 </ol>
506 506
507 507 </div>
508 508 </li>
509 509
510 510 ## notifications
511 511 <li>
512 512 <a class="${('empty' if c.unread_notifications == 0 else '')}" href="${h.route_path('notifications_show_all')}">
513 513 ${c.unread_notifications}
514 514 </a>
515 515 </li>
516 516 % endif
517 517
518 518 ## USER MENU
519 519 <li id="quick_login_li" class="${'active' if active else ''}">
520 520 % if c.rhodecode_user.username == h.DEFAULT_USER:
521 521 <a id="quick_login_link" class="menulink childs" href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">
522 522 ${gravatar(c.rhodecode_user.email, 20)}
523 523 <span class="user">
524 524 <span>${_('Sign in')}</span>
525 525 </span>
526 526 </a>
527 527 % else:
528 528 ## logged in user
529 529 <a id="quick_login_link" class="menulink childs">
530 530 ${gravatar(c.rhodecode_user.email, 20)}
531 531 <span class="user">
532 532 <span class="menu_link_user">${c.rhodecode_user.username}</span>
533 533 <div class="show_more"></div>
534 534 </span>
535 535 </a>
536 536 ## subnav with menu for logged in user
537 537 <div class="user-menu submenu">
538 538 <div id="quick_login">
539 539 %if c.rhodecode_user.username != h.DEFAULT_USER:
540 540 <div class="">
541 541 <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div>
542 542 <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
543 543 <div class="email">${c.rhodecode_user.email}</div>
544 544 </div>
545 545 <div class="">
546 546 <ol class="links">
547 547 <li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li>
548 548 % if c.rhodecode_user.personal_repo_group:
549 549 <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>
550 550 % endif
551 551 <li>${h.link_to(_(u'Pull Requests'), h.route_path('my_account_pullrequests'))}</li>
552
553 % if c.debug_style:
554 <li>
555 <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}">
556 <div class="menulabel">${_('[Style]')}</div>
557 </a>
558 </li>
559 % endif
560
552 561 ## bookmark-items
553 562 <li class="bookmark-items">
554 563 ${_('Bookmarks')}
555 564 <div class="pull-right">
556 <a href="${h.route_path('my_account_bookmarks')}">${_('Manage')}</a>
565 <a href="${h.route_path('my_account_bookmarks')}">
566
567 <i class="icon-cog"></i>
568 </a>
557 569 </div>
558 570 </li>
559 571 % if not c.bookmark_items:
560 572 <li>
561 573 <a href="${h.route_path('my_account_bookmarks')}">${_('No Bookmarks yet.')}</a>
562 574 </li>
563 575 % endif
564 576 % for item in c.bookmark_items:
565 577 <li>
566 578 % if item.repository:
567 579 <div>
568 580 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
569 581 <code>${item.position}</code>
570 582 % if item.repository.repo_type == 'hg':
571 583 <i class="icon-hg" title="${_('Repository')}" style="font-size: 16px"></i>
572 584 % elif item.repository.repo_type == 'git':
573 585 <i class="icon-git" title="${_('Repository')}" style="font-size: 16px"></i>
574 586 % elif item.repository.repo_type == 'svn':
575 587 <i class="icon-svn" title="${_('Repository')}" style="font-size: 16px"></i>
576 588 % endif
577 589 ${(item.title or h.shorter(item.repository.repo_name, 30))}
578 590 </a>
579 591 </div>
580 592 % elif item.repository_group:
581 593 <div>
582 594 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
583 595 <code>${item.position}</code>
584 596 <i class="icon-repo-group" title="${_('Repository group')}" style="font-size: 14px"></i>
585 597 ${(item.title or h.shorter(item.repository_group.group_name, 30))}
586 598 </a>
587 599 </div>
588 600 % else:
589 601 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
590 602 <code>${item.position}</code>
591 603 ${item.title}
592 604 </a>
593 605 % endif
594 606 </li>
595 607 % endfor
596 608
597 609 <li class="logout">
598 610 ${h.secure_form(h.route_path('logout'), request=request)}
599 611 ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")}
600 612 ${h.end_form()}
601 613 </li>
602 614 </ol>
603 615 </div>
604 616 %endif
605 617 </div>
606 618 </div>
607 619
608 620 % endif
609 621 </li>
610 622 </%def>
611 623
612 624 <%def name="menu_items(active=None)">
613 625 <%
614 626 def is_active(selected):
615 627 if selected == active:
616 628 return "active"
617 629 return ""
618 630 %>
619 631
620 632 <ul id="quick" class="main_nav navigation horizontal-list">
621 633 ## notice box for important system messages
622 634 <li style="display: none">
623 635 <a class="notice-box" href="#openNotice" onclick="return false">
624 636 <div class="menulabel-notice" >
625 637 0
626 638 </div>
627 639 </a>
628 640 </li>
629 641
630 642 ## Main filter
631 643 <li>
632 644 <div class="menulabel main_filter_box">
633 645 <div class="main_filter_input_box">
634 646 <ul class="searchItems">
635 647
636 648 % if c.template_context['search_context']['repo_id']:
637 649 <li class="searchTag searchTagFilter searchTagHidable" >
638 650 ##<a href="${h.route_path('search_repo',repo_name=c.template_context['search_context']['repo_name'])}">
639 651 <span class="tag">
640 652 This repo
641 653 <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-cancel-circled"></i></a>
642 654 </span>
643 655 ##</a>
644 656 </li>
645 657 % elif c.template_context['search_context']['repo_group_id']:
646 658 <li class="searchTag searchTagFilter searchTagHidable">
647 659 ##<a href="${h.route_path('search_repo_group',repo_group_name=c.template_context['search_context']['repo_group_name'])}">
648 660 <span class="tag">
649 661 This group
650 662 <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-cancel-circled"></i></a>
651 663 </span>
652 664 ##</a>
653 665 </li>
654 666 % endif
655 667
656 668 <li class="searchTagInput">
657 669 <input class="main_filter_input" id="main_filter" size="25" type="text" name="main_filter" placeholder="${_('search / go to...')}" value="" />
658 670 </li>
659 671 <li class="searchTag searchTagHelp">
660 672 <a href="#showFilterHelp" onclick="showMainFilterBox(); return false">?</a>
661 673 </li>
662 674 </ul>
663 675 </div>
664 676 </div>
665 677
666 678 <div id="main_filter_help" style="display: none">
667 679 - Use '/' key to quickly access this field.
668 680
669 681 - Enter a name of repository, or repository group for quick search.
670 682
671 683 - Prefix query to allow special search:
672 684
673 685 user:admin, to search for usernames, always global
674 686
675 687 user_group:devops, to search for user groups, always global
676 688
677 689 commit:efced4, to search for commits, scoped to repositories or groups
678 690
679 691 file:models.py, to search for file paths, scoped to repositories or groups
680 692
681 693 % if c.template_context['search_context']['repo_id']:
682 694 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>
683 695 % elif c.template_context['search_context']['repo_group_id']:
684 696 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>
685 697 % else:
686 698 For advanced full text search visit: <a href="${h.route_path('search')}">global search</a>
687 699 % endif
688 700 </div>
689 701 </li>
690 702
691 703 ## ROOT MENU
692 704 <li class="${is_active('home')}">
693 705 <a class="menulink" title="${_('Home')}" href="${h.route_path('home')}">
694 706 <div class="menulabel">${_('Home')}</div>
695 707 </a>
696 708 </li>
697 709
698 710 %if c.rhodecode_user.username != h.DEFAULT_USER:
699 711 <li class="${is_active('journal')}">
700 712 <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}">
701 713 <div class="menulabel">${_('Journal')}</div>
702 714 </a>
703 715 </li>
704 716 %else:
705 717 <li class="${is_active('journal')}">
706 718 <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}">
707 719 <div class="menulabel">${_('Public journal')}</div>
708 720 </a>
709 721 </li>
710 722 %endif
711 723
712 724 <li class="${is_active('gists')}">
713 725 <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}">
714 726 <div class="menulabel">${_('Gists')}</div>
715 727 </a>
716 728 </li>
717 729
718 730 % if c.is_super_admin or c.is_delegated_admin:
719 731 <li class="${is_active('admin')}">
720 732 <a class="menulink childs" title="${_('Admin settings')}" href="${h.route_path('admin_home')}">
721 733 <div class="menulabel">${_('Admin')} </div>
722 734 </a>
723 735 </li>
724 736 % endif
725 737
726 738 ## render extra user menu
727 739 ${usermenu(active=(active=='my_account'))}
728 740
729 % if c.debug_style:
730 <li>
731 <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}">
732 <div class="menulabel">${_('[Style]')}</div>
733 </a>
734 </li>
735 % endif
736 741 </ul>
737 742
738 743 <script type="text/javascript">
739 744 var visualShowPublicIcon = "${c.visual.show_public_icon}" == "True";
740 745
741 746 var formatRepoResult = function(result, container, query, escapeMarkup) {
742 747 return function(data, escapeMarkup) {
743 748 if (!data.repo_id){
744 749 return data.text; // optgroup text Repositories
745 750 }
746 751
747 752 var tmpl = '';
748 753 var repoType = data['repo_type'];
749 754 var repoName = data['text'];
750 755
751 756 if(data && data.type == 'repo'){
752 757 if(repoType === 'hg'){
753 758 tmpl += '<i class="icon-hg"></i> ';
754 759 }
755 760 else if(repoType === 'git'){
756 761 tmpl += '<i class="icon-git"></i> ';
757 762 }
758 763 else if(repoType === 'svn'){
759 764 tmpl += '<i class="icon-svn"></i> ';
760 765 }
761 766 if(data['private']){
762 767 tmpl += '<i class="icon-lock" ></i> ';
763 768 }
764 769 else if(visualShowPublicIcon){
765 770 tmpl += '<i class="icon-unlock-alt"></i> ';
766 771 }
767 772 }
768 773 tmpl += escapeMarkup(repoName);
769 774 return tmpl;
770 775
771 776 }(result, escapeMarkup);
772 777 };
773 778
774 779 var formatRepoGroupResult = function(result, container, query, escapeMarkup) {
775 780 return function(data, escapeMarkup) {
776 781 if (!data.repo_group_id){
777 782 return data.text; // optgroup text Repositories
778 783 }
779 784
780 785 var tmpl = '';
781 786 var repoGroupName = data['text'];
782 787
783 788 if(data){
784 789
785 790 tmpl += '<i class="icon-repo-group"></i> ';
786 791
787 792 }
788 793 tmpl += escapeMarkup(repoGroupName);
789 794 return tmpl;
790 795
791 796 }(result, escapeMarkup);
792 797 };
793 798
794 799 var escapeRegExChars = function (value) {
795 800 return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
796 801 };
797 802
798 803 var getRepoIcon = function(repo_type) {
799 804 if (repo_type === 'hg') {
800 805 return '<i class="icon-hg"></i> ';
801 806 }
802 807 else if (repo_type === 'git') {
803 808 return '<i class="icon-git"></i> ';
804 809 }
805 810 else if (repo_type === 'svn') {
806 811 return '<i class="icon-svn"></i> ';
807 812 }
808 813 return ''
809 814 };
810 815
811 816 var autocompleteMainFilterFormatResult = function (data, value, org_formatter) {
812 817
813 818 if (value.split(':').length === 2) {
814 819 value = value.split(':')[1]
815 820 }
816 821
817 822 var searchType = data['type'];
818 823 var searchSubType = data['subtype'];
819 824 var valueDisplay = data['value_display'];
820 825
821 826 var pattern = '(' + escapeRegExChars(value) + ')';
822 827
823 828 valueDisplay = Select2.util.escapeMarkup(valueDisplay);
824 829
825 830 // highlight match
826 831 if (searchType != 'text') {
827 832 valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
828 833 }
829 834
830 835 var icon = '';
831 836
832 837 if (searchType === 'hint') {
833 838 icon += '<i class="icon-repo-group"></i> ';
834 839 }
835 840 // full text search/hints
836 841 else if (searchType === 'search') {
837 842 icon += '<i class="icon-more"></i> ';
838 843 if (searchSubType !== undefined && searchSubType == 'repo') {
839 844 valueDisplay += '<div class="pull-right tag">repository</div>';
840 845 }
841 846 else if (searchSubType !== undefined && searchSubType == 'repo_group') {
842 847 valueDisplay += '<div class="pull-right tag">repo group</div>';
843 848 }
844 849 }
845 850 // repository
846 851 else if (searchType === 'repo') {
847 852
848 853 var repoIcon = getRepoIcon(data['repo_type']);
849 854 icon += repoIcon;
850 855
851 856 if (data['private']) {
852 857 icon += '<i class="icon-lock" ></i> ';
853 858 }
854 859 else if (visualShowPublicIcon) {
855 860 icon += '<i class="icon-unlock-alt"></i> ';
856 861 }
857 862 }
858 863 // repository groups
859 864 else if (searchType === 'repo_group') {
860 865 icon += '<i class="icon-repo-group"></i> ';
861 866 }
862 867 // user group
863 868 else if (searchType === 'user_group') {
864 869 icon += '<i class="icon-group"></i> ';
865 870 }
866 871 // user
867 872 else if (searchType === 'user') {
868 873 icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']);
869 874 }
870 875 // commit
871 876 else if (searchType === 'commit') {
872 877 var repo_data = data['repo_data'];
873 878 var repoIcon = getRepoIcon(repo_data['repository_type']);
874 879 if (repoIcon) {
875 880 icon += repoIcon;
876 881 } else {
877 882 icon += '<i class="icon-tag"></i>';
878 883 }
879 884 }
880 885 // file
881 886 else if (searchType === 'file') {
882 887 var repo_data = data['repo_data'];
883 888 var repoIcon = getRepoIcon(repo_data['repository_type']);
884 889 if (repoIcon) {
885 890 icon += repoIcon;
886 891 } else {
887 892 icon += '<i class="icon-tag"></i>';
888 893 }
889 894 }
890 895 // generic text
891 896 else if (searchType === 'text') {
892 897 icon = '';
893 898 }
894 899
895 900 var tmpl = '<div class="ac-container-wrap">{0}{1}</div>';
896 901 return tmpl.format(icon, valueDisplay);
897 902 };
898 903
899 904 var handleSelect = function(element, suggestion) {
900 905 if (suggestion.type === "hint") {
901 906 // we skip action
902 907 $('#main_filter').focus();
903 908 }
904 909 else if (suggestion.type === "text") {
905 910 // we skip action
906 911 $('#main_filter').focus();
907 912
908 913 } else {
909 914 window.location = suggestion['url'];
910 915 }
911 916 };
912 917
913 918 var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) {
914 919 if (queryLowerCase.split(':').length === 2) {
915 920 queryLowerCase = queryLowerCase.split(':')[1]
916 921 }
917 922 if (suggestion.type === "text") {
918 923 // special case we don't want to "skip" display for
919 924 return true
920 925 }
921 926 return suggestion.value_display.toLowerCase().indexOf(queryLowerCase) !== -1;
922 927 };
923 928
924 929 var cleanContext = {
925 930 repo_view_type: null,
926 931
927 932 repo_id: null,
928 933 repo_name: "",
929 934
930 935 repo_group_id: null,
931 936 repo_group_name: null
932 937 };
933 938 var removeGoToFilter = function () {
934 939 $('.searchTagHidable').hide();
935 940 $('#main_filter').autocomplete(
936 941 'setOptions', {params:{search_context: cleanContext}});
937 942 };
938 943
939 944 $('#main_filter').autocomplete({
940 945 serviceUrl: pyroutes.url('goto_switcher_data'),
941 946 params: {
942 947 "search_context": templateContext.search_context
943 948 },
944 949 minChars:2,
945 950 maxHeight:400,
946 951 deferRequestBy: 300, //miliseconds
947 952 tabDisabled: true,
948 953 autoSelectFirst: false,
949 954 containerClass: 'autocomplete-qfilter-suggestions',
950 955 formatResult: autocompleteMainFilterFormatResult,
951 956 lookupFilter: autocompleteMainFilterResult,
952 957 onSelect: function (element, suggestion) {
953 958 handleSelect(element, suggestion);
954 959 return false;
955 960 },
956 961 onSearchError: function (element, query, jqXHR, textStatus, errorThrown) {
957 962 if (jqXHR !== 'abort') {
958 963 alert("Error during search.\nError code: {0}".format(textStatus));
959 964 window.location = '';
960 965 }
961 966 }
962 967 });
963 968
964 969 showMainFilterBox = function () {
965 970 $('#main_filter_help').toggle();
966 971 };
967 972
968 973 $('#main_filter').on('keydown.autocomplete', function (e) {
969 974
970 975 var BACKSPACE = 8;
971 976 var el = $(e.currentTarget);
972 977 if(e.which === BACKSPACE){
973 978 var inputVal = el.val();
974 979 if (inputVal === ""){
975 980 removeGoToFilter()
976 981 }
977 982 }
978 983 });
979 984
980 985 </script>
981 986 <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script>
982 987 </%def>
983 988
984 989 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
985 990 <div class="modal-dialog">
986 991 <div class="modal-content">
987 992 <div class="modal-header">
988 993 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
989 994 <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4>
990 995 </div>
991 996 <div class="modal-body">
992 997 <div class="block-left">
993 998 <table class="keyboard-mappings">
994 999 <tbody>
995 1000 <tr>
996 1001 <th></th>
997 1002 <th>${_('Site-wide shortcuts')}</th>
998 1003 </tr>
999 1004 <%
1000 1005 elems = [
1001 1006 ('/', 'Use quick search box'),
1002 1007 ('g h', 'Goto home page'),
1003 1008 ('g g', 'Goto my private gists page'),
1004 1009 ('g G', 'Goto my public gists page'),
1005 1010 ('g 0-9', 'Goto bookmarked items from 0-9'),
1006 1011 ('n r', 'New repository page'),
1007 1012 ('n g', 'New gist page'),
1008 1013 ]
1009 1014 %>
1010 1015 %for key, desc in elems:
1011 1016 <tr>
1012 1017 <td class="keys">
1013 1018 <span class="key tag">${key}</span>
1014 1019 </td>
1015 1020 <td>${desc}</td>
1016 1021 </tr>
1017 1022 %endfor
1018 1023 </tbody>
1019 1024 </table>
1020 1025 </div>
1021 1026 <div class="block-left">
1022 1027 <table class="keyboard-mappings">
1023 1028 <tbody>
1024 1029 <tr>
1025 1030 <th></th>
1026 1031 <th>${_('Repositories')}</th>
1027 1032 </tr>
1028 1033 <%
1029 1034 elems = [
1030 1035 ('g s', 'Goto summary page'),
1031 1036 ('g c', 'Goto changelog page'),
1032 1037 ('g f', 'Goto files page'),
1033 1038 ('g F', 'Goto files page with file search activated'),
1034 1039 ('g p', 'Goto pull requests page'),
1035 1040 ('g o', 'Goto repository settings'),
1036 1041 ('g O', 'Goto repository permissions settings'),
1037 1042 ]
1038 1043 %>
1039 1044 %for key, desc in elems:
1040 1045 <tr>
1041 1046 <td class="keys">
1042 1047 <span class="key tag">${key}</span>
1043 1048 </td>
1044 1049 <td>${desc}</td>
1045 1050 </tr>
1046 1051 %endfor
1047 1052 </tbody>
1048 1053 </table>
1049 1054 </div>
1050 1055 </div>
1051 1056 <div class="modal-footer">
1052 1057 </div>
1053 1058 </div><!-- /.modal-content -->
1054 1059 </div><!-- /.modal-dialog -->
1055 1060 </div><!-- /.modal -->
1056 1061
General Comments 0
You need to be logged in to leave comments. Login now