diff options
author | Robert Speicher <robert@gitlab.com> | 2016-08-31 22:16:13 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-08-31 22:16:13 +0000 |
commit | 1c4e866348e0c782d2e5374209508785ac812c7a (patch) | |
tree | 0576292905d79525e278ff881fb1cb9f0c17852b | |
parent | ac4f8ebc759a31e4e03c31e076794f8703e2a412 (diff) | |
parent | 45421e1da8953d5faca96f277a142576559f3109 (diff) | |
download | gitlab-ce-1c4e866348e0c782d2e5374209508785ac812c7a.tar.gz |
Merge branch 'control-dropdown-permissions' into 'master'
Hide group control nav if no options present
## What does this MR do?
Hides the group nav controls if no options present in the dropdown.
Also fixed the alignment of the dropdown to match the project page.
## What are the relevant issue numbers?
Closes #19120
See merge request !5155
-rw-r--r-- | app/views/layouts/nav/_group.html.haml | 2 | ||||
-rw-r--r-- | app/views/layouts/nav/_group_settings.html.haml | 38 |
2 files changed, 22 insertions, 18 deletions
diff --git a/app/views/layouts/nav/_group.html.haml b/app/views/layouts/nav/_group.html.haml index d7d36c84b6c..27ac1760166 100644 --- a/app/views/layouts/nav/_group.html.haml +++ b/app/views/layouts/nav/_group.html.haml @@ -1,5 +1,5 @@ += render 'layouts/nav/group_settings' .scrolling-tabs-container{ class: nav_control_class } - = render 'layouts/nav/group_settings' .fade-left = icon('angle-left') .fade-right diff --git a/app/views/layouts/nav/_group_settings.html.haml b/app/views/layouts/nav/_group_settings.html.haml index bf9a7ecb786..75275afc0f3 100644 --- a/app/views/layouts/nav/_group_settings.html.haml +++ b/app/views/layouts/nav/_group_settings.html.haml @@ -1,22 +1,26 @@ - if current_user + - can_admin_group = can?(current_user, :admin_group, @group) - can_edit = can?(current_user, :admin_group, @group) - member = @group.members.find_by(user_id: current_user.id) - can_leave = member && can?(current_user, :destroy_group_member, member) - .controls - .dropdown.group-settings-dropdown - %a.dropdown-new.btn.btn-default#group-settings-button{href: '#', 'data-toggle' => 'dropdown'} - = icon('cog') - = icon('caret-down') - %ul.dropdown-menu.dropdown-menu-align-right - = nav_link(path: 'groups#projects') do - = link_to 'Projects', projects_group_path(@group), title: 'Projects' - %li.divider - - if can_edit - %li - = link_to 'Edit Group', edit_group_path(@group) - - if can_leave - %li - = link_to polymorphic_path([:leave, @group, :members]), - data: { confirm: leave_confirmation_message(@group) }, method: :delete, title: 'Leave group' do - Leave Group + - if can_admin_group || can_edit || can_leave + .controls + .dropdown.group-settings-dropdown + %a.dropdown-new.btn.btn-default#group-settings-button{href: '#', 'data-toggle' => 'dropdown'} + = icon('cog') + = icon('caret-down') + %ul.dropdown-menu.dropdown-menu-align-right + - if can_admin_group + = nav_link(path: 'groups#projects') do + = link_to 'Projects', projects_group_path(@group), title: 'Projects' + - if can_edit || can_leave + %li.divider + - if can_edit + %li + = link_to 'Edit Group', edit_group_path(@group) + - if can_leave + %li + = link_to polymorphic_path([:leave, @group, :members]), + data: { confirm: leave_confirmation_message(@group) }, method: :delete, title: 'Leave group' do + Leave Group |