Commit 1c4e8663 authored by Robert Speicher's avatar Robert Speicher

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
parents ac4f8ebc 45421e1d
= render 'layouts/nav/group_settings'
.scrolling-tabs-container{ class: nav_control_class } .scrolling-tabs-container{ class: nav_control_class }
= render 'layouts/nav/group_settings'
.fade-left .fade-left
= icon('angle-left') = icon('angle-left')
.fade-right .fade-right
......
- if current_user - if current_user
- can_admin_group = can?(current_user, :admin_group, @group)
- can_edit = can?(current_user, :admin_group, @group) - can_edit = can?(current_user, :admin_group, @group)
- member = @group.members.find_by(user_id: current_user.id) - member = @group.members.find_by(user_id: current_user.id)
- can_leave = member && can?(current_user, :destroy_group_member, member) - can_leave = member && can?(current_user, :destroy_group_member, member)
.controls - if can_admin_group || can_edit || can_leave
.dropdown.group-settings-dropdown .controls
%a.dropdown-new.btn.btn-default#group-settings-button{href: '#', 'data-toggle' => 'dropdown'} .dropdown.group-settings-dropdown
= icon('cog') %a.dropdown-new.btn.btn-default#group-settings-button{href: '#', 'data-toggle' => 'dropdown'}
= icon('caret-down') = icon('cog')
%ul.dropdown-menu.dropdown-menu-align-right = icon('caret-down')
= nav_link(path: 'groups#projects') do %ul.dropdown-menu.dropdown-menu-align-right
= link_to 'Projects', projects_group_path(@group), title: 'Projects' - if can_admin_group
%li.divider = nav_link(path: 'groups#projects') do
- if can_edit = link_to 'Projects', projects_group_path(@group), title: 'Projects'
%li - if can_edit || can_leave
= link_to 'Edit Group', edit_group_path(@group) %li.divider
- if can_leave - if can_edit
%li %li
= link_to polymorphic_path([:leave, @group, :members]), = link_to 'Edit Group', edit_group_path(@group)
data: { confirm: leave_confirmation_message(@group) }, method: :delete, title: 'Leave group' do - if can_leave
Leave Group %li
= link_to polymorphic_path([:leave, @group, :members]),
data: { confirm: leave_confirmation_message(@group) }, method: :delete, title: 'Leave group' do
Leave Group
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment