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