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