Show More
@@ -47,7 +47,7 b' class TestHomeController(TestController)' | |||
|
47 | 47 | self.log_user() |
|
48 | 48 | response = self.app.get(route_path('home')) |
|
49 | 49 | # if global permission is set |
|
50 |
response.mustcontain(' |
|
|
50 | response.mustcontain('New Repository') | |
|
51 | 51 | |
|
52 | 52 | # search for objects inside the JavaScript JSON |
|
53 | 53 | for repo in Repository.getAll(): |
@@ -200,6 +200,7 b'' | |||
|
200 | 200 | |
|
201 | 201 | &#quick_login_li { |
|
202 | 202 | padding-left: .5em; |
|
203 | margin-right: 0px; | |
|
203 | 204 | |
|
204 | 205 | &:hover #quick_login_link { |
|
205 | 206 | color: inherit; |
@@ -426,6 +427,56 b'' | |||
|
426 | 427 | } |
|
427 | 428 | } |
|
428 | 429 | |
|
430 | ||
|
431 | // new objects main action | |
|
432 | .action-menu { | |
|
433 | left: auto; | |
|
434 | right: 0; | |
|
435 | padding: 12px; | |
|
436 | z-index: 999; | |
|
437 | overflow: hidden; | |
|
438 | background-color: #fff; | |
|
439 | border: 1px solid @grey5; | |
|
440 | color: @grey2; | |
|
441 | box-shadow: @dropdown-shadow; | |
|
442 | ||
|
443 | .submenu-title { | |
|
444 | font-weight: bold; | |
|
445 | } | |
|
446 | ||
|
447 | .submenu-title:not(:first-of-type) { | |
|
448 | padding-top: 10px; | |
|
449 | } | |
|
450 | ||
|
451 | &.submenu { | |
|
452 | min-width: 200px; | |
|
453 | ||
|
454 | ol { | |
|
455 | padding:0; | |
|
456 | } | |
|
457 | ||
|
458 | li { | |
|
459 | display: block; | |
|
460 | margin: 0; | |
|
461 | padding: .2em .5em; | |
|
462 | line-height: 1em; | |
|
463 | ||
|
464 | background-color: #fff; | |
|
465 | list-style-type: none; | |
|
466 | ||
|
467 | a { | |
|
468 | padding: 4px; | |
|
469 | color: @grey4 !important; | |
|
470 | border-bottom: none; | |
|
471 | } | |
|
472 | } | |
|
473 | li:not(.submenu-title) a:hover{ | |
|
474 | color: @grey2 !important; | |
|
475 | } | |
|
476 | } | |
|
477 | } | |
|
478 | ||
|
479 | ||
|
429 | 480 | // Header Repository Switcher |
|
430 | 481 | // Select2 Dropdown |
|
431 | 482 | #select2-drop.select2-drop.repo-switcher-dropdown { |
@@ -37,14 +37,6 b'' | |||
|
37 | 37 | %endif |
|
38 | 38 | </ul> |
|
39 | 39 |
|
|
40 | % if c.rhodecode_user.username != h.DEFAULT_USER: | |
|
41 | <div class="pull-right"> | |
|
42 | <a class="btn btn-primary" href="${h.route_path('gists_new')}" > | |
|
43 | ${_(u'Create New Gist')} | |
|
44 | </a> | |
|
45 | </div> | |
|
46 | % endif | |
|
47 | ||
|
48 | 40 | <div class="grid-quick-filter"> |
|
49 | 41 | <ul class="grid-filter-box"> |
|
50 | 42 | <li class="grid-filter-box-icon"> |
@@ -29,13 +29,6 b'' | |||
|
29 | 29 | <!-- box / title --> |
|
30 | 30 | <div class="title"> |
|
31 | 31 | ${self.breadcrumbs()} |
|
32 | %if c.rhodecode_user.username != h.DEFAULT_USER: | |
|
33 | <ul class="links"> | |
|
34 | <li> | |
|
35 | <a href="${h.route_path('gists_new')}" class="btn btn-primary">${_(u'Create New Gist')}</a> | |
|
36 | </li> | |
|
37 | </ul> | |
|
38 | %endif | |
|
39 | 32 | </div> |
|
40 | 33 | |
|
41 | 34 | <div class="table"> |
@@ -271,6 +271,10 b'' | |||
|
271 | 271 | def is_active(selected): |
|
272 | 272 | if selected == active: |
|
273 | 273 | return "active" |
|
274 | ## determine if we have "any" option available | |
|
275 | can_lock = h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking | |
|
276 | has_actions = can_lock | |
|
277 | ||
|
274 | 278 | %> |
|
275 | 279 | % if c.rhodecode_db_repo.archived: |
|
276 | 280 | <div class="alert alert-warning text-center"> |
@@ -313,19 +317,12 b'' | |||
|
313 | 317 | <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> |
|
314 | 318 | %endif |
|
315 | 319 |
|
|
316 | ## determine if we have "any" option available | |
|
317 | <% | |
|
318 | can_lock = h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking | |
|
319 | has_actions = (c.rhodecode_user.username != h.DEFAULT_USER and c.rhodecode_db_repo.repo_type in ['git','hg'] ) or can_lock | |
|
320 | %> | |
|
321 | 320 | <li class="${is_active('options')}"> |
|
322 | 321 | % if has_actions: |
|
323 | 322 | <a class="menulink dropdown"> |
|
324 | 323 | <div class="menulabel">${_('Options')}<div class="show_more"></div></div> |
|
325 | 324 | </a> |
|
326 | 325 | <ul class="submenu"> |
|
327 | <li><a href="${h.route_path('repo_fork_new',repo_name=c.repo_name)}">${_('Fork this repository')}</a></li> | |
|
328 | <li><a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a></li> | |
|
329 | 326 | %if can_lock: |
|
330 | 327 | %if c.rhodecode_db_repo.locked[0]: |
|
331 | 328 | <li><a class="locking_del" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Unlock Repository')}</a></li> |
@@ -368,6 +365,7 b'' | |||
|
368 | 365 | </div> |
|
369 | 366 | </%def> |
|
370 | 367 | |
|
368 | ||
|
371 | 369 | <%def name="repo_group_menu(active=None)"> |
|
372 | 370 | <% |
|
373 | 371 | def is_active(selected): |
@@ -376,12 +374,11 b'' | |||
|
376 | 374 | |
|
377 | 375 | gr_name = c.repo_group.group_name if c.repo_group else None |
|
378 | 376 | # create repositories with write permission on group is set to true |
|
379 | create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')() | |
|
380 | 377 | group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page') |
|
381 | group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page') | |
|
382 | 378 | |
|
383 | 379 | %> |
|
384 | 380 | |
|
381 | ||
|
385 | 382 | <!--- REPO GROUP CONTEXT BAR --> |
|
386 | 383 | <div id="context-bar"> |
|
387 | 384 | <div class="wrapper"> |
@@ -390,35 +387,15 b'' | |||
|
390 | 387 | </div> |
|
391 | 388 | |
|
392 | 389 | <ul id="context-pages" class="navigation horizontal-list"> |
|
393 | <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> | |
|
390 | <li class="${is_active('home')}"> | |
|
391 | <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> | |
|
392 | </li> | |
|
394 | 393 | % if c.is_super_admin or group_admin: |
|
395 | <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> | |
|
394 | <li class="${is_active('settings')}"> | |
|
395 | <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> | |
|
396 | </li> | |
|
396 | 397 | % endif |
|
397 | ## determine if we have "any" option available | |
|
398 | <% | |
|
399 | can_create_repos = c.is_super_admin or group_admin or (group_write and create_on_write) | |
|
400 | can_create_repo_groups = c.is_super_admin or group_admin | |
|
401 | has_actions = can_create_repos or can_create_repo_groups | |
|
402 | %> | |
|
403 | <li class="${is_active('options')}"> | |
|
404 | % if has_actions: | |
|
405 | <a class="menulink dropdown"> | |
|
406 | <div class="menulabel">${_('Options')} <div class="show_more"></div></div> | |
|
407 | </a> | |
|
408 | <ul class="submenu"> | |
|
409 | %if can_create_repos: | |
|
410 | <li><a href="${h.route_path('repo_new',_query=dict(parent_group=c.repo_group.group_id))}">${_('Add Repository')}</a></li> | |
|
411 | %endif | |
|
412 | %if can_create_repo_groups: | |
|
413 | <li><a href="${h.route_path('repo_group_new',_query=dict(parent_group=c.repo_group.group_id))}">${_(u'Add Repository Group')}</a></li> | |
|
414 | %endif | |
|
415 | </ul> | |
|
416 | % else: | |
|
417 | <a class="menulink disabled"> | |
|
418 | <div class="menulabel">${_('Options')} <div class="show_more"></div></div> | |
|
419 | </a> | |
|
420 | % endif | |
|
421 | </li> | |
|
398 | ||
|
422 | 399 | </ul> |
|
423 | 400 | </div> |
|
424 | 401 | <div class="clear"></div> |
@@ -430,6 +407,114 b'' | |||
|
430 | 407 | |
|
431 | 408 | |
|
432 | 409 | <%def name="usermenu(active=False)"> |
|
410 | <% | |
|
411 | not_anonymous = c.rhodecode_user.username != h.DEFAULT_USER | |
|
412 | ||
|
413 | gr_name = c.repo_group.group_name if (hasattr(c, 'repo_group') and c.repo_group) else None | |
|
414 | # create repositories with write permission on group is set to true | |
|
415 | ||
|
416 | can_fork = c.is_super_admin or h.HasPermissionAny('hg.fork.repository')() | |
|
417 | create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')() | |
|
418 | group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page') | |
|
419 | group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page') | |
|
420 | ||
|
421 | can_create_repos = c.is_super_admin or c.can_create_repo | |
|
422 | can_create_repo_groups = c.is_super_admin or c.can_create_repo_group | |
|
423 | ||
|
424 | can_create_repos_in_group = c.is_super_admin or group_admin or (group_write and create_on_write) | |
|
425 | can_create_repo_groups_in_group = c.is_super_admin or group_admin | |
|
426 | %> | |
|
427 | ||
|
428 | % if not_anonymous: | |
|
429 | <% | |
|
430 | default_target_group = dict() | |
|
431 | if c.rhodecode_user.personal_repo_group: | |
|
432 | default_target_group = dict(parent_group=c.rhodecode_user.personal_repo_group.group_id) | |
|
433 | %> | |
|
434 | ||
|
435 | ## create action | |
|
436 | <li> | |
|
437 | <a href="#create-actions" onclick="return false;" class="menulink childs"> | |
|
438 | <i class="icon-plus-circled"></i> | |
|
439 | </a> | |
|
440 | ||
|
441 | <div class="action-menu submenu"> | |
|
442 | ||
|
443 | <ol> | |
|
444 | ## scope of within a repository | |
|
445 | % if hasattr(c, 'rhodecode_db_repo') and c.rhodecode_db_repo: | |
|
446 | <li class="submenu-title">${_('This Repository')}</li> | |
|
447 | <li> | |
|
448 | <a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a> | |
|
449 | </li> | |
|
450 | % if can_fork: | |
|
451 | <li> | |
|
452 | <a href="${h.route_path('repo_fork_new',repo_name=c.repo_name,_query=default_target_group)}">${_('Fork this repository')}</a> | |
|
453 | </li> | |
|
454 | % endif | |
|
455 | % endif | |
|
456 | ||
|
457 | ## scope of within repository groups | |
|
458 | % if hasattr(c, 'repo_group') and c.repo_group and (can_create_repos_in_group or can_create_repo_groups_in_group): | |
|
459 | <li class="submenu-title">${_('This Repository Group')}</li> | |
|
460 | ||
|
461 | % if can_create_repos_in_group: | |
|
462 | <li> | |
|
463 | <a href="${h.route_path('repo_new',_query=default_target_group)}">${_('New Repository')}</a> | |
|
464 | </li> | |
|
465 | % endif | |
|
466 | ||
|
467 | % if can_create_repo_groups_in_group: | |
|
468 | <li> | |
|
469 | <a href="${h.route_path('repo_group_new',_query=default_target_group)}">${_(u'New Repository Group')}</a> | |
|
470 | </li> | |
|
471 | % endif | |
|
472 | % endif | |
|
473 | ||
|
474 | ## personal group | |
|
475 | % if c.rhodecode_user.personal_repo_group: | |
|
476 | <li class="submenu-title">Personal Group</li> | |
|
477 | ||
|
478 | <li> | |
|
479 | <a href="${h.route_path('repo_new',_query=dict(parent_group=c.rhodecode_user.personal_repo_group.group_id))}" >${_('New Repository')} </a> | |
|
480 | </li> | |
|
481 | ||
|
482 | <li> | |
|
483 | <a href="${h.route_path('repo_group_new',_query=dict(parent_group=c.rhodecode_user.personal_repo_group.group_id))}">${_('New Repository Group')} </a> | |
|
484 | </li> | |
|
485 | % endif | |
|
486 | ||
|
487 | ## Global actions | |
|
488 | <li class="submenu-title">RhodeCode</li> | |
|
489 | % if can_create_repos: | |
|
490 | <li> | |
|
491 | <a href="${h.route_path('repo_new')}" >${_('New Repository')}</a> | |
|
492 | </li> | |
|
493 | % endif | |
|
494 | ||
|
495 | % if can_create_repo_groups: | |
|
496 | <li> | |
|
497 | <a href="${h.route_path('repo_group_new')}" >${_(u'New Repository Group')}</a> | |
|
498 | </li> | |
|
499 | % endif | |
|
500 | ||
|
501 | <li> | |
|
502 | <a href="${h.route_path('gists_new')}">${_(u'New Gist')}</a> | |
|
503 | </li> | |
|
504 | ||
|
505 | </ol> | |
|
506 | ||
|
507 | </div> | |
|
508 | </li> | |
|
509 | ||
|
510 | ## notifications | |
|
511 | <li> | |
|
512 | <a class="${('empty' if c.unread_notifications == 0 else '')}" href="${h.route_path('notifications_show_all')}"> | |
|
513 | ${c.unread_notifications} | |
|
514 | </a> | |
|
515 | </li> | |
|
516 | % endif | |
|
517 | ||
|
433 | 518 | ## USER MENU |
|
434 | 519 | <li id="quick_login_li" class="${'active' if active else ''}"> |
|
435 | 520 | % if c.rhodecode_user.username == h.DEFAULT_USER: |
@@ -519,10 +604,7 b'' | |||
|
519 | 604 | %endif |
|
520 | 605 | </div> |
|
521 | 606 | </div> |
|
522 | ## unread counter | |
|
523 | <div class="pill_container"> | |
|
524 | <a class="menu_link_notifications ${'empty' if c.unread_notifications == 0 else ''}" href="${h.route_path('notifications_show_all')}">${c.unread_notifications}</a> | |
|
525 | </div> | |
|
607 | ||
|
526 | 608 |
|
|
527 | 609 | </li> |
|
528 | 610 | </%def> |
@@ -12,20 +12,7 b'' | |||
|
12 | 12 | <div class="box"> |
|
13 | 13 | <!-- box / title --> |
|
14 | 14 | <div class="title"> |
|
15 | %if c.rhodecode_user.username != h.DEFAULT_USER: | |
|
16 | <div class="block-right"> | |
|
17 | %if not c.repo_group: | |
|
18 | ## no repository group context here | |
|
19 | %if c.is_super_admin or c.can_create_repo: | |
|
20 | <a href="${h.route_path('repo_new')}" class="btn btn-small btn-success btn-primary">${_('Add Repository')}</a> | |
|
21 | %endif | |
|
22 | 15 |
|
|
23 | %if c.is_super_admin or c.can_create_repo_group: | |
|
24 | <a href="${h.route_path('repo_group_new')}" class="btn btn-small btn-default">${_(u'Add Repository Group')}</a> | |
|
25 | %endif | |
|
26 | %endif | |
|
27 | </div> | |
|
28 | %endif | |
|
29 | 16 | </div> |
|
30 | 17 | <!-- end box / title --> |
|
31 | 18 | <div class="table"> |
General Comments 0
You need to be logged in to leave comments.
Login now