##// END OF EJS Templates
added discreet class to repo-group-description to match repo fork description styling
Liviu -
r3617:a2e5c386 new-ui
parent child Browse files
Show More
@@ -1,942 +1,942 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">
194 194 <div class="title-main">
195 195 ## SVN/HG/GIT icons
196 196 %if h.is_hg(repo_instance):
197 197 <i class="icon-hg"></i>
198 198 %endif
199 199 %if h.is_git(repo_instance):
200 200 <i class="icon-git"></i>
201 201 %endif
202 202 %if h.is_svn(repo_instance):
203 203 <i class="icon-svn"></i>
204 204 %endif
205 205
206 206 ## public/private
207 207 %if repo_instance.private:
208 208 <i class="icon-repo-private"></i>
209 209 %else:
210 210 <i class="icon-repo-public"></i>
211 211 %endif
212 212
213 213 ## repo name with group name
214 214 ${h.breadcrumb_repo_link(repo_instance)}
215 215
216 216 </div>
217 217
218 218 ## FORKED
219 219 %if repo_instance.fork:
220 220 <p class="discreet">
221 221 <i class="icon-code-fork"></i> ${_('Fork of')}
222 222 ${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))}
223 223 </p>
224 224 %endif
225 225
226 226 ## IMPORTED FROM REMOTE
227 227 %if repo_instance.clone_uri:
228 228 <p class="discreet">
229 229 <i class="icon-code-fork"></i> ${_('Clone from')}
230 230 <a href="${h.safe_str(h.hide_credentials(repo_instance.clone_uri))}">${h.hide_credentials(repo_instance.clone_uri)}</a>
231 231 </p>
232 232 %endif
233 233
234 234 ## LOCKING STATUS
235 235 %if repo_instance.locked[0]:
236 236 <p class="locking_locked discreet">
237 237 <i class="icon-repo-lock"></i>
238 238 ${_('Repository locked by %(user)s') % {'user': h.person_by_id(repo_instance.locked[0])}}
239 239 </p>
240 240 %elif repo_instance.enable_locking:
241 241 <p class="locking_unlocked discreet">
242 242 <i class="icon-repo-unlock"></i>
243 243 ${_('Repository not locked. Pull repository to lock it.')}
244 244 </p>
245 245 %endif
246 246
247 247 </div>
248 248 </%def>
249 249
250 250 <%def name="repo_menu(active=None)">
251 251 <%
252 252 def is_active(selected):
253 253 if selected == active:
254 254 return "active"
255 255 %>
256 256
257 257 <!--- REPO CONTEXT BAR -->
258 258 <div id="context-bar">
259 259 <div class="wrapper">
260 260
261 261 <div class="title">
262 262 ${self.repo_page_title(c.rhodecode_db_repo)}
263 263 </div>
264 264
265 265 <ul id="context-pages" class="navigation horizontal-list">
266 266 <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>
267 267 <li class="${is_active('changelog')}"><a class="menulink" href="${h.route_path('repo_changelog', repo_name=c.repo_name)}"><div class="menulabel">${_('Changelog')}</div></a></li>
268 268 <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>
269 269 <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>
270 270
271 271 ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()"
272 272 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
273 273 <li class="${is_active('showpullrequest')}">
274 274 <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)}">
275 275 <div class="menulabel">
276 276 %if c.repository_pull_requests == 1:
277 277 ${c.repository_pull_requests} ${_('Pull Request')}
278 278 %else:
279 279 ${c.repository_pull_requests} ${_('Pull Requests')}
280 280 %endif
281 281 </div>
282 282 </a>
283 283 </li>
284 284 %endif
285 285
286 286 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
287 287 <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>
288 288 %endif
289 289
290 290 <li class="${is_active('options')}">
291 291 <a class="menulink dropdown">
292 292 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
293 293 </a>
294 294 <ul class="submenu">
295 295
296 296 %if c.rhodecode_db_repo.fork:
297 297 <li>
298 298 <a title="${h.tooltip(_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name))}"
299 299 href="${h.route_path('repo_compare',
300 300 repo_name=c.rhodecode_db_repo.fork.repo_name,
301 301 source_ref_type=c.rhodecode_db_repo.landing_rev[0],
302 302 source_ref=c.rhodecode_db_repo.landing_rev[1],
303 303 target_repo=c.repo_name,target_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_rev[0],
304 304 target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1],
305 305 _query=dict(merge=1))}"
306 306 >
307 307 ${_('Compare fork')}
308 308 </a>
309 309 </li>
310 310 %endif
311 311
312 312 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking:
313 313 %if c.rhodecode_db_repo.locked[0]:
314 314 <li><a class="locking_del" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Unlock')}</a></li>
315 315 %else:
316 316 <li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock')}</a></li>
317 317 %endif
318 318 %endif
319 319 %if c.rhodecode_user.username != h.DEFAULT_USER:
320 320 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
321 321 <li><a href="${h.route_path('repo_fork_new',repo_name=c.repo_name)}">${_('Fork')}</a></li>
322 322 <li><a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a></li>
323 323 %endif
324 324 %endif
325 325 </ul>
326 326 </li>
327 327 </ul>
328 328 </div>
329 329 <div class="clear"></div>
330 330 </div>
331 331 % if c.rhodecode_db_repo.archived:
332 332 <div class="alert alert-warning text-center">
333 333 <strong>${_('This repository has been archived. It is now read-only.')}</strong>
334 334 </div>
335 335 % endif
336 336 <!--- REPO END CONTEXT BAR -->
337 337
338 338 </%def>
339 339
340 340 <%def name="repo_group_page_title(repo_group_instance)">
341 341 <div class="title-content">
342 342 <div class="title-main">
343 343 ## Repository Group icon
344 344 <i class="icon-folder-close"></i>
345 345
346 346 ## repo name with group name
347 347 ${h.breadcrumb_repo_group_link(repo_group_instance)}
348 348 </div>
349 349
350 350 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
351 <div class="repo-group-desc">
351 <div class="repo-group-desc discreet">
352 352 ${dt.repo_group_desc(repo_group_instance.description_safe, repo_group_instance.personal, c.visual.stylify_metatags)}
353 353 </div>
354 354
355 355 </div>
356 356 </%def>
357 357
358 358 <%def name="repo_group_menu(active=None)">
359 359 <%
360 360 def is_active(selected):
361 361 if selected == active:
362 362 return "active"
363 363
364 364 gr_name = c.repo_group.group_name if c.repo_group else None
365 365 # create repositories with write permission on group is set to true
366 366 create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
367 367 group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page')
368 368 group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page')
369 369
370 370 %>
371 371
372 372 <!--- REPO GROUP CONTEXT BAR -->
373 373 <div id="context-bar">
374 374 <div class="wrapper">
375 375 <div class="title">
376 376 ${self.repo_group_page_title(c.repo_group)}
377 377 </div>
378 378
379 379 <ul id="context-pages" class="navigation horizontal-list">
380 380 <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>
381 381 % if c.is_super_admin or group_admin:
382 382 <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>
383 383 % endif
384 384
385 385 <li class="${is_active('options')}">
386 386 <a class="menulink dropdown">
387 387 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
388 388 </a>
389 389 <ul class="submenu">
390 390 %if c.is_super_admin or group_admin or (group_write and create_on_write):
391 391 <li><a href="${h.route_path('repo_new',_query=dict(parent_group=c.repo_group.group_id))}">${_('Add Repository')}</a></li>
392 392 %endif
393 393 %if c.is_super_admin or group_admin:
394 394 <li><a href="${h.route_path('repo_group_new',_query=dict(parent_group=c.repo_group.group_id))}">${_(u'Add Parent Group')}</a></li>
395 395 %endif
396 396 </ul>
397 397 </li>
398 398 </ul>
399 399 </div>
400 400 <div class="clear"></div>
401 401 </div>
402 402
403 403 <!--- REPO GROUP CONTEXT BAR -->
404 404
405 405 </%def>
406 406
407 407
408 408 <%def name="usermenu(active=False)">
409 409 ## USER MENU
410 410 <li id="quick_login_li" class="${'active' if active else ''}">
411 411 % if c.rhodecode_user.username == h.DEFAULT_USER:
412 412 <a id="quick_login_link" class="menulink childs" href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">
413 413 ${gravatar(c.rhodecode_user.email, 20)}
414 414 <span class="user">
415 415 <span>${_('Sign in')}</span>
416 416 </span>
417 417 </a>
418 418 % else:
419 419 ## logged in user
420 420 <a id="quick_login_link" class="menulink childs">
421 421 ${gravatar(c.rhodecode_user.email, 20)}
422 422 <span class="user">
423 423 <span class="menu_link_user">${c.rhodecode_user.username}</span>
424 424 <div class="show_more"></div>
425 425 </span>
426 426 </a>
427 427 ## subnav with menu for logged in user
428 428 <div class="user-menu submenu">
429 429 <div id="quick_login">
430 430 %if c.rhodecode_user.username != h.DEFAULT_USER:
431 431 <div class="">
432 432 <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div>
433 433 <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
434 434 <div class="email">${c.rhodecode_user.email}</div>
435 435 </div>
436 436 <div class="">
437 437 <ol class="links">
438 438 <li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li>
439 439 % if c.rhodecode_user.personal_repo_group:
440 440 <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>
441 441 % endif
442 442 <li>${h.link_to(_(u'Pull Requests'), h.route_path('my_account_pullrequests'))}</li>
443 443 ## bookmark-items
444 444 <li class="bookmark-items">
445 445 ${_('Bookmarks')}
446 446 <div class="pull-right">
447 447 <a href="${h.route_path('my_account_bookmarks')}">${_('Manage')}</a>
448 448 </div>
449 449 </li>
450 450 % if not c.bookmark_items:
451 451 <li>
452 452 <a href="${h.route_path('my_account_bookmarks')}">${_('No Bookmarks yet.')}</a>
453 453 </li>
454 454 % endif
455 455 % for item in c.bookmark_items:
456 456 <li>
457 457 % if item.repository:
458 458 <div>
459 459 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
460 460 <code>${item.position}</code>
461 461 % if item.repository.repo_type == 'hg':
462 462 <i class="icon-hg" title="${_('Repository')}" style="font-size: 16px"></i>
463 463 % elif item.repository.repo_type == 'git':
464 464 <i class="icon-git" title="${_('Repository')}" style="font-size: 16px"></i>
465 465 % elif item.repository.repo_type == 'svn':
466 466 <i class="icon-svn" title="${_('Repository')}" style="font-size: 16px"></i>
467 467 % endif
468 468 ${(item.title or h.shorter(item.repository.repo_name, 30))}
469 469 </a>
470 470 </div>
471 471 % elif item.repository_group:
472 472 <div>
473 473 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
474 474 <code>${item.position}</code>
475 475 <i class="icon-folder-close" title="${_('Repository group')}" style="font-size: 16px"></i>
476 476 ${(item.title or h.shorter(item.repository_group.group_name, 30))}
477 477 </a>
478 478 </div>
479 479 % else:
480 480 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
481 481 <code>${item.position}</code>
482 482 ${item.title}
483 483 </a>
484 484 % endif
485 485 </li>
486 486 % endfor
487 487
488 488 <li class="logout">
489 489 ${h.secure_form(h.route_path('logout'), request=request)}
490 490 ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")}
491 491 ${h.end_form()}
492 492 </li>
493 493 </ol>
494 494 </div>
495 495 %endif
496 496 </div>
497 497 </div>
498 498 ## unread counter
499 499 <div class="pill_container">
500 500 <a class="menu_link_notifications ${'empty' if c.unread_notifications == 0 else ''}" href="${h.route_path('notifications_show_all')}">${c.unread_notifications}</a>
501 501 </div>
502 502 % endif
503 503 </li>
504 504 </%def>
505 505
506 506 <%def name="menu_items(active=None)">
507 507 <%
508 508 def is_active(selected):
509 509 if selected == active:
510 510 return "active"
511 511 return ""
512 512 %>
513 513
514 514 <ul id="quick" class="main_nav navigation horizontal-list">
515 515 ## notice box for important system messages
516 516 <li style="display: none">
517 517 <a class="notice-box" href="#openNotice" onclick="showNoticeBox(); return false">
518 518 <div class="menulabel-notice" >
519 519 0
520 520 </div>
521 521 </a>
522 522 </li>
523 523
524 524 ## Main filter
525 525 <li>
526 526 <div class="menulabel main_filter_box">
527 527 <div class="main_filter_input_box">
528 528 <ul class="searchItems">
529 529
530 530 % if c.template_context['search_context']['repo_id']:
531 531 <li class="searchTag searchTagFilter searchTagHidable" >
532 532 ##<a href="${h.route_path('search_repo',repo_name=c.template_context['search_context']['repo_name'])}">
533 533 <span class="tag">
534 534 This repo
535 535 <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-delete"></i></a>
536 536 </span>
537 537 ##</a>
538 538 </li>
539 539 % elif c.template_context['search_context']['repo_group_id']:
540 540 <li class="searchTag searchTagFilter searchTagHidable">
541 541 ##<a href="${h.route_path('search_repo_group',repo_group_name=c.template_context['search_context']['repo_group_name'])}">
542 542 <span class="tag">
543 543 This group
544 544 <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-delete"></i></a>
545 545 </span>
546 546 ##</a>
547 547 </li>
548 548 % endif
549 549
550 550 <li class="searchTagInput">
551 551 <input class="main_filter_input" id="main_filter" size="15" type="text" name="main_filter" placeholder="${_('search / go to...')}" value="" />
552 552 </li>
553 553 <li class="searchTag searchTagHelp">
554 554 <a href="#showFilterHelp" onclick="showMainFilterBox(); return false">?</a>
555 555 </li>
556 556 </ul>
557 557 </div>
558 558 </div>
559 559
560 560 <div id="main_filter_help" style="display: none">
561 561 - Use '/' key to quickly access this field.
562 562
563 563 - Enter a name of repository, or repository group for quick search.
564 564
565 565 - Prefix query to allow special search:
566 566
567 567 user:admin, to search for usernames, always global
568 568
569 569 user_group:devops, to search for user groups, always global
570 570
571 571 commit:efced4, to search for commits, scoped to repositories or groups
572 572
573 573 file:models.py, to search for file paths, scoped to repositories or groups
574 574
575 575 % if c.template_context['search_context']['repo_id']:
576 576 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>
577 577 % elif c.template_context['search_context']['repo_group_id']:
578 578 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>
579 579 % else:
580 580 For advanced full text search visit: <a href="${h.route_path('search')}">global search</a>
581 581 % endif
582 582 </div>
583 583 </li>
584 584
585 585 ## ROOT MENU
586 586 <li class="${is_active('home')}">
587 587 <a class="menulink" title="${_('Home')}" href="${h.route_path('home')}">
588 588 <div class="menulabel">${_('Home')}</div>
589 589 </a>
590 590 </li>
591 591
592 592 %if c.rhodecode_user.username != h.DEFAULT_USER:
593 593 <li class="${is_active('journal')}">
594 594 <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}">
595 595 <div class="menulabel">${_('Journal')}</div>
596 596 </a>
597 597 </li>
598 598 %else:
599 599 <li class="${is_active('journal')}">
600 600 <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}">
601 601 <div class="menulabel">${_('Public journal')}</div>
602 602 </a>
603 603 </li>
604 604 %endif
605 605
606 606 <li class="${is_active('gists')}">
607 607 <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}">
608 608 <div class="menulabel">${_('Gists')}</div>
609 609 </a>
610 610 </li>
611 611
612 612 % if c.is_super_admin or c.is_delegated_admin:
613 613 <li class="${is_active('admin')}">
614 614 <a class="menulink childs" title="${_('Admin settings')}" href="${h.route_path('admin_home')}">
615 615 <div class="menulabel">${_('Admin')} </div>
616 616 </a>
617 617 </li>
618 618 % endif
619 619
620 620 ## render extra user menu
621 621 ${usermenu(active=(active=='my_account'))}
622 622
623 623 % if c.debug_style:
624 624 <li>
625 625 <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}">
626 626 <div class="menulabel">${_('[Style]')}</div>
627 627 </a>
628 628 </li>
629 629 % endif
630 630 </ul>
631 631
632 632 <script type="text/javascript">
633 633 var visualShowPublicIcon = "${c.visual.show_public_icon}" == "True";
634 634
635 635 var formatRepoResult = function(result, container, query, escapeMarkup) {
636 636 return function(data, escapeMarkup) {
637 637 if (!data.repo_id){
638 638 return data.text; // optgroup text Repositories
639 639 }
640 640
641 641 var tmpl = '';
642 642 var repoType = data['repo_type'];
643 643 var repoName = data['text'];
644 644
645 645 if(data && data.type == 'repo'){
646 646 if(repoType === 'hg'){
647 647 tmpl += '<i class="icon-hg"></i> ';
648 648 }
649 649 else if(repoType === 'git'){
650 650 tmpl += '<i class="icon-git"></i> ';
651 651 }
652 652 else if(repoType === 'svn'){
653 653 tmpl += '<i class="icon-svn"></i> ';
654 654 }
655 655 if(data['private']){
656 656 tmpl += '<i class="icon-lock" ></i> ';
657 657 }
658 658 else if(visualShowPublicIcon){
659 659 tmpl += '<i class="icon-unlock-alt"></i> ';
660 660 }
661 661 }
662 662 tmpl += escapeMarkup(repoName);
663 663 return tmpl;
664 664
665 665 }(result, escapeMarkup);
666 666 };
667 667
668 668 var formatRepoGroupResult = function(result, container, query, escapeMarkup) {
669 669 return function(data, escapeMarkup) {
670 670 if (!data.repo_group_id){
671 671 return data.text; // optgroup text Repositories
672 672 }
673 673
674 674 var tmpl = '';
675 675 var repoGroupName = data['text'];
676 676
677 677 if(data){
678 678
679 679 tmpl += '<i class="icon-folder-close"></i> ';
680 680
681 681 }
682 682 tmpl += escapeMarkup(repoGroupName);
683 683 return tmpl;
684 684
685 685 }(result, escapeMarkup);
686 686 };
687 687
688 688 var escapeRegExChars = function (value) {
689 689 return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
690 690 };
691 691
692 692 var getRepoIcon = function(repo_type) {
693 693 if (repo_type === 'hg') {
694 694 return '<i class="icon-hg"></i> ';
695 695 }
696 696 else if (repo_type === 'git') {
697 697 return '<i class="icon-git"></i> ';
698 698 }
699 699 else if (repo_type === 'svn') {
700 700 return '<i class="icon-svn"></i> ';
701 701 }
702 702 return ''
703 703 };
704 704
705 705 var autocompleteMainFilterFormatResult = function (data, value, org_formatter) {
706 706
707 707 if (value.split(':').length === 2) {
708 708 value = value.split(':')[1]
709 709 }
710 710
711 711 var searchType = data['type'];
712 712 var valueDisplay = data['value_display'];
713 713
714 714 var pattern = '(' + escapeRegExChars(value) + ')';
715 715
716 716 valueDisplay = Select2.util.escapeMarkup(valueDisplay);
717 717
718 718 // highlight match
719 719 if (searchType != 'text') {
720 720 valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
721 721 }
722 722
723 723 var icon = '';
724 724
725 725 if (searchType === 'hint') {
726 726 icon += '<i class="icon-folder-close"></i> ';
727 727 }
728 728 // full text search
729 729 else if (searchType === 'search') {
730 730 icon += '<i class="icon-more"></i> ';
731 731 }
732 732 // repository
733 733 else if (searchType === 'repo') {
734 734
735 735 var repoIcon = getRepoIcon(data['repo_type']);
736 736 icon += repoIcon;
737 737
738 738 if (data['private']) {
739 739 icon += '<i class="icon-lock" ></i> ';
740 740 }
741 741 else if (visualShowPublicIcon) {
742 742 icon += '<i class="icon-unlock-alt"></i> ';
743 743 }
744 744 }
745 745 // repository groups
746 746 else if (searchType === 'repo_group') {
747 747 icon += '<i class="icon-folder-close"></i> ';
748 748 }
749 749 // user group
750 750 else if (searchType === 'user_group') {
751 751 icon += '<i class="icon-group"></i> ';
752 752 }
753 753 // user
754 754 else if (searchType === 'user') {
755 755 icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']);
756 756 }
757 757 // commit
758 758 else if (searchType === 'commit') {
759 759 var repo_data = data['repo_data'];
760 760 var repoIcon = getRepoIcon(repo_data['repository_type']);
761 761 if (repoIcon) {
762 762 icon += repoIcon;
763 763 } else {
764 764 icon += '<i class="icon-tag"></i>';
765 765 }
766 766 }
767 767 // file
768 768 else if (searchType === 'file') {
769 769 var repo_data = data['repo_data'];
770 770 var repoIcon = getRepoIcon(repo_data['repository_type']);
771 771 if (repoIcon) {
772 772 icon += repoIcon;
773 773 } else {
774 774 icon += '<i class="icon-tag"></i>';
775 775 }
776 776 }
777 777 // generic text
778 778 else if (searchType === 'text') {
779 779 icon = '';
780 780 }
781 781
782 782 var tmpl = '<div class="ac-container-wrap">{0}{1}</div>';
783 783 return tmpl.format(icon, valueDisplay);
784 784 };
785 785
786 786 var handleSelect = function(element, suggestion) {
787 787 if (suggestion.type === "hint") {
788 788 // we skip action
789 789 $('#main_filter').focus();
790 790 }
791 791 else if (suggestion.type === "text") {
792 792 // we skip action
793 793 $('#main_filter').focus();
794 794
795 795 } else {
796 796 window.location = suggestion['url'];
797 797 }
798 798 };
799 799
800 800 var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) {
801 801 if (queryLowerCase.split(':').length === 2) {
802 802 queryLowerCase = queryLowerCase.split(':')[1]
803 803 }
804 804 if (suggestion.type === "text") {
805 805 // special case we don't want to "skip" display for
806 806 return true
807 807 }
808 808 return suggestion.value_display.toLowerCase().indexOf(queryLowerCase) !== -1;
809 809 };
810 810
811 811 var cleanContext = {
812 812 repo_view_type: null,
813 813
814 814 repo_id: null,
815 815 repo_name: "",
816 816
817 817 repo_group_id: null,
818 818 repo_group_name: null
819 819 };
820 820 var removeGoToFilter = function () {
821 821 $('.searchTagHidable').hide();
822 822 $('#main_filter').autocomplete(
823 823 'setOptions', {params:{search_context: cleanContext}});
824 824 };
825 825
826 826 $('#main_filter').autocomplete({
827 827 serviceUrl: pyroutes.url('goto_switcher_data'),
828 828 params: {
829 829 "search_context": templateContext.search_context
830 830 },
831 831 minChars:2,
832 832 maxHeight:400,
833 833 deferRequestBy: 300, //miliseconds
834 834 tabDisabled: true,
835 835 autoSelectFirst: false,
836 836 formatResult: autocompleteMainFilterFormatResult,
837 837 lookupFilter: autocompleteMainFilterResult,
838 838 onSelect: function (element, suggestion) {
839 839 handleSelect(element, suggestion);
840 840 return false;
841 841 },
842 842 onSearchError: function (element, query, jqXHR, textStatus, errorThrown) {
843 843 if (jqXHR !== 'abort') {
844 844 alert("Error during search.\nError code: {0}".format(textStatus));
845 845 window.location = '';
846 846 }
847 847 }
848 848 });
849 849
850 850 showMainFilterBox = function () {
851 851 $('#main_filter_help').toggle();
852 852 };
853 853
854 854 $('#main_filter').on('keydown.autocomplete', function (e) {
855 855
856 856 var BACKSPACE = 8;
857 857 var el = $(e.currentTarget);
858 858 if(e.which === BACKSPACE){
859 859 var inputVal = el.val();
860 860 if (inputVal === ""){
861 861 removeGoToFilter()
862 862 }
863 863 }
864 864 });
865 865
866 866 </script>
867 867 <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script>
868 868 </%def>
869 869
870 870 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
871 871 <div class="modal-dialog">
872 872 <div class="modal-content">
873 873 <div class="modal-header">
874 874 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
875 875 <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4>
876 876 </div>
877 877 <div class="modal-body">
878 878 <div class="block-left">
879 879 <table class="keyboard-mappings">
880 880 <tbody>
881 881 <tr>
882 882 <th></th>
883 883 <th>${_('Site-wide shortcuts')}</th>
884 884 </tr>
885 885 <%
886 886 elems = [
887 887 ('/', 'Use quick search box'),
888 888 ('g h', 'Goto home page'),
889 889 ('g g', 'Goto my private gists page'),
890 890 ('g G', 'Goto my public gists page'),
891 891 ('g 0-9', 'Goto bookmarked items from 0-9'),
892 892 ('n r', 'New repository page'),
893 893 ('n g', 'New gist page'),
894 894 ]
895 895 %>
896 896 %for key, desc in elems:
897 897 <tr>
898 898 <td class="keys">
899 899 <span class="key tag">${key}</span>
900 900 </td>
901 901 <td>${desc}</td>
902 902 </tr>
903 903 %endfor
904 904 </tbody>
905 905 </table>
906 906 </div>
907 907 <div class="block-left">
908 908 <table class="keyboard-mappings">
909 909 <tbody>
910 910 <tr>
911 911 <th></th>
912 912 <th>${_('Repositories')}</th>
913 913 </tr>
914 914 <%
915 915 elems = [
916 916 ('g s', 'Goto summary page'),
917 917 ('g c', 'Goto changelog page'),
918 918 ('g f', 'Goto files page'),
919 919 ('g F', 'Goto files page with file search activated'),
920 920 ('g p', 'Goto pull requests page'),
921 921 ('g o', 'Goto repository settings'),
922 922 ('g O', 'Goto repository permissions settings'),
923 923 ]
924 924 %>
925 925 %for key, desc in elems:
926 926 <tr>
927 927 <td class="keys">
928 928 <span class="key tag">${key}</span>
929 929 </td>
930 930 <td>${desc}</td>
931 931 </tr>
932 932 %endfor
933 933 </tbody>
934 934 </table>
935 935 </div>
936 936 </div>
937 937 <div class="modal-footer">
938 938 </div>
939 939 </div><!-- /.modal-content -->
940 940 </div><!-- /.modal-dialog -->
941 941 </div><!-- /.modal -->
942 942
General Comments 0
You need to be logged in to leave comments. Login now