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