summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-10-05 14:23:01 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-05 14:23:01 +0200
commit4e88ca12060df0c6e73a1eed74d6a7f6e42d7b58 (patch)
treeaa78d1c70415af2ab0a33ec6790b7217f7ecf9d0 /app
parent17dccc35ca4754405b87c87f81daec34e02ea7a1 (diff)
downloadgitlab-ce-4e88ca12060df0c6e73a1eed74d6a7f6e42d7b58.tar.gz
Hide "New subgroup" links when subgroups are not supported
Diffstat (limited to 'app')
-rw-r--r--app/views/groups/show.html.haml23
1 files changed, 13 insertions, 10 deletions
diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml
index c6e5e16e239..73c1cb9ce87 100644
--- a/app/views/groups/show.html.haml
+++ b/app/views/groups/show.html.haml
@@ -1,5 +1,6 @@
- @no_container = true
- breadcrumb_title "Details"
+- can_create_subgroups = can?(current_user, :create_subgroup, @group)
= content_for :meta_tags do
= auto_discovery_link_tag(:atom, group_url(@group, rss_url_options), title: "#{@group.name} activity")
@@ -16,8 +17,9 @@
- new_subgroup_label = _("New subgroup")
.btn-group.new-project-subgroup.droplab-dropdown.js-new-project-subgroup{ data: { project_path: new_project_path(namespace_id: @group.id), subgroup_path: new_group_path(parent_id: @group.id) } }
%input.btn.btn-success.dropdown-primary.js-new-group-child{ type: "button", value: new_project_label, data: { action: "new-project" } }
- %button.btn.btn-success.dropdown-toggle.js-dropdown-toggle{ type: "button", data: { "dropdown-trigger" => "#new-project-or-subgroup-dropdown" } }
- = icon("caret-down", class: "dropdown-btn-icon")
+ - if can_create_subgroups
+ %button.btn.btn-success.dropdown-toggle.js-dropdown-toggle{ type: "button", data: { "dropdown-trigger" => "#new-project-or-subgroup-dropdown" } }
+ = icon("caret-down", class: "dropdown-btn-icon")
%ul#new-project-or-subgroup-dropdown.dropdown-menu.dropdown-menu-align-right{ data: { dropdown: true } }
%li.droplab-item-selected{ role: "button", data: { value: "new-project", text: new_project_label } }
.menu-item
@@ -26,14 +28,15 @@
.description
%strong= new_project_label
%span= s_("GroupsTree|Create project under this group.")
- %li.divider.droplap-item-ignore
- %li{ role: "button", data: { value: "new-subgroup", text: new_subgroup_label } }
- .menu-item
- .icon-container
- = icon("check", class: "list-item-checkmark")
- .description
- %strong= new_subgroup_label
- %span= s_("GroupsTree|Create a subgroup under this group.")
+ - if can_create_subgroups
+ %li.divider.droplap-item-ignore
+ %li{ role: "button", data: { value: "new-subgroup", text: new_subgroup_label } }
+ .menu-item
+ .icon-container
+ = icon("check", class: "list-item-checkmark")
+ .description
+ %strong= new_subgroup_label
+ %span= s_("GroupsTree|Create a subgroup under this group.")
- if params[:filter].blank? && @children.empty?
= render "shared/groups/empty_state"