# HG changeset patch # User Marcin Kuzminski # Date 2019-08-27 19:44:22 # Node ID c5a907e3aa5e2077f78426b14eeec3c36e92f2f9 # Parent 9bd5faf493f9e562acc0287cb8adb13f01ef9fd2 ui: added action link that repliaces current mix of actions in options and action buttons - this was part of new UI that we didn't ship in 4.17 - makes whole UX more consistent and has a single creation path for many different objects - this is ready for more actions in future - context actions change if we're in repo group or repo - new users has creation option available if their personal repository group exist. diff --git a/rhodecode/apps/home/tests/test_home.py b/rhodecode/apps/home/tests/test_home.py --- a/rhodecode/apps/home/tests/test_home.py +++ b/rhodecode/apps/home/tests/test_home.py @@ -47,7 +47,7 @@ class TestHomeController(TestController) self.log_user() response = self.app.get(route_path('home')) # if global permission is set - response.mustcontain('Add Repository') + response.mustcontain('New Repository') # search for objects inside the JavaScript JSON for repo in Repository.getAll(): diff --git a/rhodecode/public/css/navigation.less b/rhodecode/public/css/navigation.less --- a/rhodecode/public/css/navigation.less +++ b/rhodecode/public/css/navigation.less @@ -200,6 +200,7 @@ &#quick_login_li { padding-left: .5em; + margin-right: 0px; &:hover #quick_login_link { color: inherit; @@ -426,6 +427,56 @@ } } + +// new objects main action +.action-menu { + left: auto; + right: 0; + padding: 12px; + z-index: 999; + overflow: hidden; + background-color: #fff; + border: 1px solid @grey5; + color: @grey2; + box-shadow: @dropdown-shadow; + + .submenu-title { + font-weight: bold; + } + + .submenu-title:not(:first-of-type) { + padding-top: 10px; + } + + &.submenu { + min-width: 200px; + + ol { + padding:0; + } + + li { + display: block; + margin: 0; + padding: .2em .5em; + line-height: 1em; + + background-color: #fff; + list-style-type: none; + + a { + padding: 4px; + color: @grey4 !important; + border-bottom: none; + } + } + li:not(.submenu-title) a:hover{ + color: @grey2 !important; + } + } +} + + // Header Repository Switcher // Select2 Dropdown #select2-drop.select2-drop.repo-switcher-dropdown { diff --git a/rhodecode/templates/admin/gists/gist_index.mako b/rhodecode/templates/admin/gists/gist_index.mako --- a/rhodecode/templates/admin/gists/gist_index.mako +++ b/rhodecode/templates/admin/gists/gist_index.mako @@ -37,14 +37,6 @@ %endif - % if c.rhodecode_user.username != h.DEFAULT_USER: -
- - ${_(u'Create New Gist')} - -
- % endif -
+ <%def name="repo_group_menu(active=None)"> <% def is_active(selected): @@ -376,12 +374,11 @@ gr_name = c.repo_group.group_name if c.repo_group else None # create repositories with write permission on group is set to true - create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')() group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page') - group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page') %> +
@@ -390,35 +387,15 @@
@@ -430,6 +407,114 @@ <%def name="usermenu(active=False)"> + <% + not_anonymous = c.rhodecode_user.username != h.DEFAULT_USER + + gr_name = c.repo_group.group_name if (hasattr(c, 'repo_group') and c.repo_group) else None + # create repositories with write permission on group is set to true + + can_fork = c.is_super_admin or h.HasPermissionAny('hg.fork.repository')() + create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')() + group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page') + group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page') + + can_create_repos = c.is_super_admin or c.can_create_repo + can_create_repo_groups = c.is_super_admin or c.can_create_repo_group + + can_create_repos_in_group = c.is_super_admin or group_admin or (group_write and create_on_write) + can_create_repo_groups_in_group = c.is_super_admin or group_admin + %> + + % if not_anonymous: + <% + default_target_group = dict() + if c.rhodecode_user.personal_repo_group: + default_target_group = dict(parent_group=c.rhodecode_user.personal_repo_group.group_id) + %> + + ## create action +
  • + + + + + +
  • + + ## notifications +
  • + + ${c.unread_notifications} + +
  • + % endif + ## USER MENU
  • % if c.rhodecode_user.username == h.DEFAULT_USER: @@ -519,10 +604,7 @@ %endif - ## unread counter - + % endif
  • diff --git a/rhodecode/templates/index_base.mako b/rhodecode/templates/index_base.mako --- a/rhodecode/templates/index_base.mako +++ b/rhodecode/templates/index_base.mako @@ -12,20 +12,7 @@
    - %if c.rhodecode_user.username != h.DEFAULT_USER: -
    - %if not c.repo_group: - ## no repository group context here - %if c.is_super_admin or c.can_create_repo: - ${_('Add Repository')} - %endif - %if c.is_super_admin or c.can_create_repo_group: - ${_(u'Add Repository Group')} - %endif - %endif -
    - %endif