summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-12-26 12:51:48 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-12-26 14:19:42 +0200
commit10de4e3bb612a529480c93da53849d95e98a8633 (patch)
treec2aaa48b506a8e9318f504f57aad9fc43aabc251
parent9410f215eab0ba49051d2a00f0b4174f5dc13a6f (diff)
downloadgitlab-ce-10de4e3bb612a529480c93da53849d95e98a8633.tar.gz
Show nested groups tab on group page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--app/controllers/groups_controller.rb2
-rw-r--r--app/views/groups/show.html.haml10
-rw-r--r--changelogs/unreleased/dz-nested-group-misc.yml4
-rw-r--r--spec/features/groups_spec.rb13
4 files changed, 29 insertions, 0 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index efe9c001bcf..e061df2f819 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -42,6 +42,8 @@ class GroupsController < Groups::ApplicationController
@notification_setting = current_user.notification_settings_for(group)
end
+ @nested_groups = group.children
+
setup_projects
respond_to do |format|
diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml
index 52ce26a20b1..a3cd333373e 100644
--- a/app/views/groups/show.html.haml
+++ b/app/views/groups/show.html.haml
@@ -32,6 +32,10 @@
%li
= link_to "#shared", 'data-toggle' => 'tab' do
Shared Projects
+ - if @nested_groups.present?
+ %li
+ = link_to "#groups", 'data-toggle' => 'tab' do
+ Nested Groups
.nav-controls
= form_tag request.path, method: :get, class: 'project-filter-form', id: 'project-filter-form' do |f|
= search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'projects-list-filter form-control', spellcheck: false
@@ -47,3 +51,9 @@
- if @shared_projects.present?
.tab-pane#shared
= render "shared_projects", projects: @shared_projects
+
+ - if @nested_groups.present?
+ .tab-pane#groups
+ %ul.content-list
+ - @nested_groups.each do |group|
+ = render 'shared/groups/group', group: group
diff --git a/changelogs/unreleased/dz-nested-group-misc.yml b/changelogs/unreleased/dz-nested-group-misc.yml
new file mode 100644
index 00000000000..9c9d0b1c644
--- /dev/null
+++ b/changelogs/unreleased/dz-nested-group-misc.yml
@@ -0,0 +1,4 @@
+---
+title: Show nested groups tab on group page
+merge_request: 8308
+author:
diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb
index 4b19886274e..d865a71f04b 100644
--- a/spec/features/groups_spec.rb
+++ b/spec/features/groups_spec.rb
@@ -107,4 +107,17 @@ feature 'Group', feature: true do
expect(page).to have_css('.group-home-desc a[rel]')
end
end
+
+ describe 'group page with nested groups', js: true do
+ let!(:group) { create(:group) }
+ let!(:nested_group) { create(:group, parent: group) }
+ let!(:path) { group_path(group) }
+
+ it 'has nested groups tab with nested groups inside' do
+ visit path
+ click_link 'Nested Groups'
+
+ expect(page).to have_content(nested_group.full_name)
+ end
+ end
end