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