From b7c30cae4eedab5e8e41d9764ac08ca12361d054 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 1 Mar 2017 15:31:56 +0200 Subject: [PATCH 1/3] Add filter and sorting to dashboard groups page Signed-off-by: Dmitriy Zaporozhets --- app/assets/javascripts/application.js | 1 + app/assets/javascripts/groups_list.js | 50 +++++++++++++++++++ .../dashboard/groups_controller.rb | 14 +++++- app/controllers/explore/groups_controller.rb | 11 +++- app/helpers/explore_helper.rb | 14 ++++-- app/views/dashboard/_groups_head.html.haml | 7 ++- app/views/dashboard/groups/_groups.html.haml | 7 +++ app/views/dashboard/groups/index.html.haml | 8 ++- app/views/explore/groups/_groups.html.haml | 6 +++ app/views/explore/groups/index.html.haml | 41 +++------------ app/views/shared/groups/_dropdown.html.haml | 18 +++++++ .../unreleased/dz-dashboard-groups-search.yml | 4 ++ spec/features/dashboard/groups_list_spec.rb | 34 +++++++++++++ spec/features/explore/groups_list_spec.rb | 33 ++++++++++++ 14 files changed, 202 insertions(+), 46 deletions(-) create mode 100644 app/assets/javascripts/groups_list.js create mode 100644 app/views/dashboard/groups/_groups.html.haml create mode 100644 app/views/explore/groups/_groups.html.haml create mode 100644 app/views/shared/groups/_dropdown.html.haml create mode 100644 changelogs/unreleased/dz-dashboard-groups-search.yml create mode 100644 spec/features/dashboard/groups_list_spec.rb create mode 100644 spec/features/explore/groups_list_spec.rb diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index c51860d1604..44e02a01a3a 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -177,6 +177,7 @@ require('./project_select'); require('./project_show'); require('./project_variables'); require('./projects_list'); +require('./groups_list'); require('./render_gfm'); require('./render_math'); require('./right_sidebar'); diff --git a/app/assets/javascripts/groups_list.js b/app/assets/javascripts/groups_list.js new file mode 100644 index 00000000000..5358121b063 --- /dev/null +++ b/app/assets/javascripts/groups_list.js @@ -0,0 +1,50 @@ +/* eslint-disable func-names, space-before-function-paren, object-shorthand, quotes, no-var, one-var, one-var-declaration-per-line, prefer-arrow-callback, consistent-return, no-unused-vars, camelcase, prefer-template, comma-dangle, max-len */ + +(function() { + window.GroupsList = { + init: function() { + $(".groups-list-filter").off('keyup'); + this.initSearch(); + return this.initPagination(); + }, + initSearch: function() { + var debounceFilter, groupsListFilter; + groupsListFilter = $('.groups-list-filter'); + debounceFilter = _.debounce(window.GroupsList.filterResults, 500); + return groupsListFilter.on('keyup', function(e) { + if (groupsListFilter.val() !== '') { + return debounceFilter(); + } + }); + }, + filterResults: function() { + var form, group_filter_url, search; + $('.groups-list-holder').fadeTo(250, 0.5); + form = null; + form = $("form#group-filter-form"); + search = $(".groups-list-filter").val(); + group_filter_url = form.attr('action') + '?' + form.serialize(); + return $.ajax({ + type: "GET", + url: form.attr('action'), + data: form.serialize(), + complete: function() { + return $('.groups-list-holder').fadeTo(250, 1); + }, + success: function(data) { + $('.groups-list-holder').replaceWith(data.html); + return history.replaceState({ + page: group_filter_url + // Change url so if user reload a page - search results are saved + }, document.title, group_filter_url); + }, + dataType: "json" + }); + }, + initPagination: function() { + return $('.groups-list-holder .pagination').on('ajax:success', function(e, data) { + return $('.groups-list-holder').replaceWith(data.html); + }); + } + }; +}).call(window); diff --git a/app/controllers/dashboard/groups_controller.rb b/app/controllers/dashboard/groups_controller.rb index 0b7cf8167f0..d03265e9f20 100644 --- a/app/controllers/dashboard/groups_controller.rb +++ b/app/controllers/dashboard/groups_controller.rb @@ -1,5 +1,17 @@ class Dashboard::GroupsController < Dashboard::ApplicationController def index - @group_members = current_user.group_members.includes(source: :route).page(params[:page]) + @group_members = current_user.group_members.includes(source: :route).joins(:group) + @group_members = @group_members.merge(Group.search(params[:filter_groups])) if params[:filter_groups].present? + @group_members = @group_members.merge(Group.sort(@sort = params[:sort])) + @group_members = @group_members.page(params[:page]) + + respond_to do |format| + format.html + format.json do + render json: { + html: view_to_html_string("dashboard/groups/_groups", locals: { group_members: @group_members }) + } + end + end end end diff --git a/app/controllers/explore/groups_controller.rb b/app/controllers/explore/groups_controller.rb index a962f9a0937..68228c095da 100644 --- a/app/controllers/explore/groups_controller.rb +++ b/app/controllers/explore/groups_controller.rb @@ -1,8 +1,17 @@ class Explore::GroupsController < Explore::ApplicationController def index @groups = GroupsFinder.new.execute(current_user) - @groups = @groups.search(params[:search]) if params[:search].present? + @groups = @groups.search(params[:filter_groups]) if params[:filter_groups].present? @groups = @groups.sort(@sort = params[:sort]) @groups = @groups.page(params[:page]) + + respond_to do |format| + format.html + format.json do + render json: { + html: view_to_html_string("explore/groups/_groups", locals: { groups: @groups }) + } + end + end end end diff --git a/app/helpers/explore_helper.rb b/app/helpers/explore_helper.rb index 2b1f3825adc..bbcb52f7eaf 100644 --- a/app/helpers/explore_helper.rb +++ b/app/helpers/explore_helper.rb @@ -9,12 +9,20 @@ module ExploreHelper } options = exist_opts.merge(options) - path = request.path - path << "?#{options.to_param}" - path + request_path_with_options(options) + end + + def filter_groups_path(options = {}) + request_path_with_options(options) end def explore_controller? controller.class.name.split("::").first == "Explore" end + + private + + def request_path_with_options(options = {}) + request.path + "?#{options.to_param}" + end end diff --git a/app/views/dashboard/_groups_head.html.haml b/app/views/dashboard/_groups_head.html.haml index 23c145ebbb4..d49913f39c5 100644 --- a/app/views/dashboard/_groups_head.html.haml +++ b/app/views/dashboard/_groups_head.html.haml @@ -6,7 +6,10 @@ = nav_link(page: explore_groups_path) do = link_to explore_groups_path, title: 'Explore groups' do Explore Groups - - if current_user.can_create_group? - .nav-controls + .nav-controls + = form_tag request.path, method: :get, class: 'group-filter-form', id: 'group-filter-form' do |f| + = search_field_tag :filter_groups, params[:filter_groups], placeholder: 'Filter by name...', class: 'group-filter-form-field form-control input-short groups-list-filter', spellcheck: false, id: 'group-filter-form-field', tabindex: "2" + = render 'shared/groups/dropdown' + - if current_user.can_create_group? = link_to new_group_path, class: "btn btn-new" do New Group diff --git a/app/views/dashboard/groups/_groups.html.haml b/app/views/dashboard/groups/_groups.html.haml new file mode 100644 index 00000000000..750559d3d24 --- /dev/null +++ b/app/views/dashboard/groups/_groups.html.haml @@ -0,0 +1,7 @@ +.groups-list-holder + %ul.content-list + - @group_members.each do |group_member| + - group = group_member.group + = render 'shared/groups/group', group: group, group_member: group_member + + = paginate @group_members, theme: 'gitlab' diff --git a/app/views/dashboard/groups/index.html.haml b/app/views/dashboard/groups/index.html.haml index 1a679c51774..75af02b9edf 100644 --- a/app/views/dashboard/groups/index.html.haml +++ b/app/views/dashboard/groups/index.html.haml @@ -5,9 +5,7 @@ - if @group_members.empty? = render 'empty_state' - else - %ul.content-list - - @group_members.each do |group_member| - - group = group_member.group - = render 'shared/groups/group', group: group, group_member: group_member + = render 'groups' - = paginate @group_members, theme: 'gitlab' +:javascript + GroupsList.init(); diff --git a/app/views/explore/groups/_groups.html.haml b/app/views/explore/groups/_groups.html.haml new file mode 100644 index 00000000000..8a8c2a740f1 --- /dev/null +++ b/app/views/explore/groups/_groups.html.haml @@ -0,0 +1,6 @@ +.groups-list-holder + %ul.content-list + - @groups.each do |group| + = render 'shared/groups/group', group: group + + = paginate @groups, theme: 'gitlab' diff --git a/app/views/explore/groups/index.html.haml b/app/views/explore/groups/index.html.haml index 73cf6e87eb4..10383613c2b 100644 --- a/app/views/explore/groups/index.html.haml +++ b/app/views/explore/groups/index.html.haml @@ -6,40 +6,13 @@ - else = render 'explore/head' -.row-content-block.clearfix - .pull-left - = form_tag explore_groups_path, method: :get, class: 'form-inline form-tiny' do |f| - = hidden_field_tag :sort, @sort - .form-group - = search_field_tag :search, params[:search], placeholder: "Filter by name", class: "form-control search-text-input", id: "groups_search", spellcheck: false - .form-group - = button_tag 'Search', class: "btn btn-default" - - .pull-right - .dropdown.inline - %button.dropdown-toggle{ type: 'button', 'data-toggle' => 'dropdown' } - %span.light - - if @sort.present? - = sort_options_hash[@sort] - - else - = sort_title_recently_created - = icon('chevron-down') - %ul.dropdown-menu.dropdown-menu-align-right - %li - = link_to explore_groups_path(sort: sort_value_recently_created) do - = sort_title_recently_created - = link_to explore_groups_path(sort: sort_value_oldest_created) do - = sort_title_oldest_created - = link_to explore_groups_path(sort: sort_value_recently_updated) do - = sort_title_recently_updated - = link_to explore_groups_path(sort: sort_value_oldest_updated) do - = sort_title_oldest_updated - -%ul.content-list - - @groups.each do |group| - = render 'shared/groups/group', group: group - - unless @groups.present? - .nothing-here-block No public groups +- if @groups.present? + = render 'groups' +- else + .nothing-here-block No public groups = paginate @groups, theme: "gitlab" + +:javascript + GroupsList.init(); diff --git a/app/views/shared/groups/_dropdown.html.haml b/app/views/shared/groups/_dropdown.html.haml new file mode 100644 index 00000000000..37589b634fa --- /dev/null +++ b/app/views/shared/groups/_dropdown.html.haml @@ -0,0 +1,18 @@ +.dropdown.inline + %button.dropdown-toggle{ type: 'button', 'data-toggle' => 'dropdown' } + %span.light + - if @sort.present? + = sort_options_hash[@sort] + - else + = sort_title_recently_created + = icon('chevron-down') + %ul.dropdown-menu.dropdown-menu-align-right + %li + = link_to filter_groups_path(sort: sort_value_recently_created) do + = sort_title_recently_created + = link_to filter_groups_path(sort: sort_value_oldest_created) do + = sort_title_oldest_created + = link_to filter_groups_path(sort: sort_value_recently_updated) do + = sort_title_recently_updated + = link_to filter_groups_path(sort: sort_value_oldest_updated) do + = sort_title_oldest_updated diff --git a/changelogs/unreleased/dz-dashboard-groups-search.yml b/changelogs/unreleased/dz-dashboard-groups-search.yml new file mode 100644 index 00000000000..c473cba774d --- /dev/null +++ b/changelogs/unreleased/dz-dashboard-groups-search.yml @@ -0,0 +1,4 @@ +--- +title: Add filter and sorting to dashboard groups page +merge_request: 9619 +author: diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb new file mode 100644 index 00000000000..8cdd14ba1bb --- /dev/null +++ b/spec/features/dashboard/groups_list_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper' + +RSpec.describe 'Dashboard Groups page', js: true, feature: true do + include WaitForAjax + + let!(:user) { create :user } + let!(:group) { create(:group) } + let!(:nested_group) { create(:group, :nested) } + let!(:another_group) { create(:group) } + + before do + group.add_owner(user) + nested_group.add_owner(user) + + login_as(user) + + visit dashboard_groups_path + end + + it 'shows groups user is member of' do + expect(page).to have_content(group.full_name) + expect(page).to have_content(nested_group.full_name) + expect(page).not_to have_content(another_group.full_name) + end + + it 'filters groups' do + fill_in 'filter_groups', with: group.name + wait_for_ajax + + expect(page).to have_content(group.full_name) + expect(page).not_to have_content(nested_group.full_name) + expect(page).not_to have_content(another_group.full_name) + end +end diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb new file mode 100644 index 00000000000..2ab97a8928b --- /dev/null +++ b/spec/features/explore/groups_list_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +RSpec.describe 'Explore Groups page', js: true, feature: true do + include WaitForAjax + + let!(:user) { create :user } + let!(:group) { create(:group) } + let!(:public_group) { create(:group, :public) } + let!(:private_group) { create(:group, :private) } + + before do + group.add_owner(user) + + login_as(user) + + visit explore_groups_path + end + + it 'shows groups user is member of' do + expect(page).to have_content(group.full_name) + expect(page).to have_content(public_group.full_name) + expect(page).not_to have_content(private_group.full_name) + end + + it 'filters groups' do + fill_in 'filter_groups', with: group.name + wait_for_ajax + + expect(page).to have_content(group.full_name) + expect(page).not_to have_content(public_group.full_name) + expect(page).not_to have_content(private_group.full_name) + end +end From 0a10d85927a62bfbe953656d55d50b3a3e7ffa01 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Thu, 2 Mar 2017 11:05:48 +0000 Subject: [PATCH 2/3] Update JS to use new standards --- app/assets/javascripts/application.js | 1 - app/assets/javascripts/dispatcher.js.es6 | 6 ++ app/assets/javascripts/groups_list.js | 95 ++++++++++---------- app/views/dashboard/_groups_head.html.haml | 2 +- app/views/dashboard/groups/_groups.html.haml | 2 +- app/views/dashboard/groups/index.html.haml | 3 - app/views/explore/groups/_groups.html.haml | 2 +- app/views/explore/groups/index.html.haml | 3 - config/webpack.config.js | 1 + spec/features/dashboard/groups_list_spec.rb | 13 +++ spec/features/explore/groups_list_spec.rb | 13 +++ 11 files changed, 82 insertions(+), 59 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 44e02a01a3a..c51860d1604 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -177,7 +177,6 @@ require('./project_select'); require('./project_show'); require('./project_variables'); require('./projects_list'); -require('./groups_list'); require('./render_gfm'); require('./render_math'); require('./right_sidebar'); diff --git a/app/assets/javascripts/dispatcher.js.es6 b/app/assets/javascripts/dispatcher.js.es6 index 0f678492d4c..fc25122aedc 100644 --- a/app/assets/javascripts/dispatcher.js.es6 +++ b/app/assets/javascripts/dispatcher.js.es6 @@ -35,6 +35,8 @@ /* global Labels */ /* global Shortcuts */ +import GroupsList from './groups_list'; + const ShortcutsBlob = require('./shortcuts_blob'); const UserCallout = require('./user_callout'); @@ -96,6 +98,10 @@ const UserCallout = require('./user_callout'); case 'dashboard:todos:index': new gl.Todos(); break; + case 'dashboard:groups:index': + case 'explore:groups:index': + new GroupsList(); + break; case 'projects:milestones:new': case 'projects:milestones:edit': case 'projects:milestones:update': diff --git a/app/assets/javascripts/groups_list.js b/app/assets/javascripts/groups_list.js index 5358121b063..0ef81e49444 100644 --- a/app/assets/javascripts/groups_list.js +++ b/app/assets/javascripts/groups_list.js @@ -1,50 +1,47 @@ -/* eslint-disable func-names, space-before-function-paren, object-shorthand, quotes, no-var, one-var, one-var-declaration-per-line, prefer-arrow-callback, consistent-return, no-unused-vars, camelcase, prefer-template, comma-dangle, max-len */ +/** + * Based on project list search. + * Makes search request for groups when user types a value in the search input. + * Updates the html content of the page with the received one. + */ +export default class GroupsList { + constructor() { + this.groupsListFilterElement = document.querySelector('.js-groups-list-filter'); + this.groupsListHolderElement = document.querySelector('.js-groups-list-holder'); -(function() { - window.GroupsList = { - init: function() { - $(".groups-list-filter").off('keyup'); - this.initSearch(); - return this.initPagination(); - }, - initSearch: function() { - var debounceFilter, groupsListFilter; - groupsListFilter = $('.groups-list-filter'); - debounceFilter = _.debounce(window.GroupsList.filterResults, 500); - return groupsListFilter.on('keyup', function(e) { - if (groupsListFilter.val() !== '') { - return debounceFilter(); - } - }); - }, - filterResults: function() { - var form, group_filter_url, search; - $('.groups-list-holder').fadeTo(250, 0.5); - form = null; - form = $("form#group-filter-form"); - search = $(".groups-list-filter").val(); - group_filter_url = form.attr('action') + '?' + form.serialize(); - return $.ajax({ - type: "GET", - url: form.attr('action'), - data: form.serialize(), - complete: function() { - return $('.groups-list-holder').fadeTo(250, 1); - }, - success: function(data) { - $('.groups-list-holder').replaceWith(data.html); - return history.replaceState({ - page: group_filter_url - // Change url so if user reload a page - search results are saved - }, document.title, group_filter_url); - }, - dataType: "json" - }); - }, - initPagination: function() { - return $('.groups-list-holder .pagination').on('ajax:success', function(e, data) { - return $('.groups-list-holder').replaceWith(data.html); - }); - } - }; -}).call(window); + this.initSearch(); + } + + initSearch() { + this.debounceFilter = _.debounce(this.filterResults.bind(this), 500); + + this.groupsListFilterElement.removeEventListener('input', this.debounceFilter); + this.groupsListFilterElement.addEventListener('input', this.debounceFilter); + } + + filterResults() { + const form = document.querySelector('form#group-filter-form'); + const groupFilterUrl = `${form.getAttribute('action')}?${$(form).serialize()}`; + + $(this.groupsListHolderElement).fadeTo(250, 0.5); + + return $.ajax({ + url: form.getAttribute('action'), + data: $(form).serialize(), + type: 'GET', + dataType: 'json', + context: this, + complete() { + $(this.groupsListHolderElement).fadeTo(250, 1); + }, + success(data) { + this.groupsListHolderElement.innerHTML = data.html; + + // Change url so if user reload a page - search results are saved + return window.history.replaceState({ + page: groupFilterUrl, + + }, document.title, groupFilterUrl); + }, + }); + } +} diff --git a/app/views/dashboard/_groups_head.html.haml b/app/views/dashboard/_groups_head.html.haml index d49913f39c5..c6d5937a3c3 100644 --- a/app/views/dashboard/_groups_head.html.haml +++ b/app/views/dashboard/_groups_head.html.haml @@ -8,7 +8,7 @@ Explore Groups .nav-controls = form_tag request.path, method: :get, class: 'group-filter-form', id: 'group-filter-form' do |f| - = search_field_tag :filter_groups, params[:filter_groups], placeholder: 'Filter by name...', class: 'group-filter-form-field form-control input-short groups-list-filter', spellcheck: false, id: 'group-filter-form-field', tabindex: "2" + = search_field_tag :filter_groups, params[:filter_groups], placeholder: 'Filter by name...', class: 'group-filter-form-field form-control input-short js-groups-list-filter', spellcheck: false, id: 'group-filter-form-field', tabindex: "2" = render 'shared/groups/dropdown' - if current_user.can_create_group? = link_to new_group_path, class: "btn btn-new" do diff --git a/app/views/dashboard/groups/_groups.html.haml b/app/views/dashboard/groups/_groups.html.haml index 750559d3d24..7385e1725f0 100644 --- a/app/views/dashboard/groups/_groups.html.haml +++ b/app/views/dashboard/groups/_groups.html.haml @@ -1,4 +1,4 @@ -.groups-list-holder +.js-groups-list-holder %ul.content-list - @group_members.each do |group_member| - group = group_member.group diff --git a/app/views/dashboard/groups/index.html.haml b/app/views/dashboard/groups/index.html.haml index 75af02b9edf..73ab2c95ff9 100644 --- a/app/views/dashboard/groups/index.html.haml +++ b/app/views/dashboard/groups/index.html.haml @@ -6,6 +6,3 @@ = render 'empty_state' - else = render 'groups' - -:javascript - GroupsList.init(); diff --git a/app/views/explore/groups/_groups.html.haml b/app/views/explore/groups/_groups.html.haml index 8a8c2a740f1..794c6d1d170 100644 --- a/app/views/explore/groups/_groups.html.haml +++ b/app/views/explore/groups/_groups.html.haml @@ -1,4 +1,4 @@ -.groups-list-holder +.js-groups-list-holder %ul.content-list - @groups.each do |group| = render 'shared/groups/group', group: group diff --git a/app/views/explore/groups/index.html.haml b/app/views/explore/groups/index.html.haml index 10383613c2b..7f1bacc91cb 100644 --- a/app/views/explore/groups/index.html.haml +++ b/app/views/explore/groups/index.html.haml @@ -13,6 +13,3 @@ .nothing-here-block No public groups = paginate @groups, theme: "gitlab" - -:javascript - GroupsList.init(); diff --git a/config/webpack.config.js b/config/webpack.config.js index a71ec0c5f52..e91794208e6 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -28,6 +28,7 @@ var config = { environments_folder: './environments/folder/environments_folder_bundle.js', filtered_search: './filtered_search/filtered_search_bundle.js', graphs: './graphs/graphs_bundle.js', + groups_list: './groups_list.js', issuable: './issuable/issuable_bundle.js', merge_conflicts: './merge_conflicts/merge_conflicts_bundle.js', merge_request_widget: './merge_request_widget/ci_bundle.js', diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb index 8cdd14ba1bb..c1d5e4069c2 100644 --- a/spec/features/dashboard/groups_list_spec.rb +++ b/spec/features/dashboard/groups_list_spec.rb @@ -31,4 +31,17 @@ RSpec.describe 'Dashboard Groups page', js: true, feature: true do expect(page).not_to have_content(nested_group.full_name) expect(page).not_to have_content(another_group.full_name) end + + it 'resets search when user cleans the input' do + fill_in 'filter_groups', with: group.name + wait_for_ajax + + fill_in 'filter_groups', with: "" + wait_for_ajax + + expect(page).to have_content(group.full_name) + expect(page).to have_content(public_group.full_name) + expect(page).not_to have_content(private_group.full_name) + expect(page.all('.js-groups-list-holder .content-list li').length).to eq 2 + end end diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb index 2ab97a8928b..7b23115c527 100644 --- a/spec/features/explore/groups_list_spec.rb +++ b/spec/features/explore/groups_list_spec.rb @@ -30,4 +30,17 @@ RSpec.describe 'Explore Groups page', js: true, feature: true do expect(page).not_to have_content(public_group.full_name) expect(page).not_to have_content(private_group.full_name) end + + it 'resets search when user cleans the input' do + fill_in 'filter_groups', with: group.name + wait_for_ajax + + fill_in 'filter_groups', with: "" + wait_for_ajax + + expect(page).to have_content(group.full_name) + expect(page).to have_content(public_group.full_name) + expect(page).not_to have_content(private_group.full_name) + expect(page.all('.js-groups-list-holder .content-list li').length).to eq 2 + end end From f440bfd247fe6e69bc913ec60e3535fda4797031 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 2 Mar 2017 14:10:37 +0200 Subject: [PATCH 3/3] Improve groups list specs Signed-off-by: Dmitriy Zaporozhets --- app/views/dashboard/groups/_groups.html.haml | 3 +-- spec/features/dashboard/groups_list_spec.rb | 6 +++--- spec/features/explore/groups_list_spec.rb | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/views/dashboard/groups/_groups.html.haml b/app/views/dashboard/groups/_groups.html.haml index 7385e1725f0..6c3bf1a2b3b 100644 --- a/app/views/dashboard/groups/_groups.html.haml +++ b/app/views/dashboard/groups/_groups.html.haml @@ -1,7 +1,6 @@ .js-groups-list-holder %ul.content-list - @group_members.each do |group_member| - - group = group_member.group - = render 'shared/groups/group', group: group, group_member: group_member + = render 'shared/groups/group', group: group_member.group, group_member: group_member = paginate @group_members, theme: 'gitlab' diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb index c1d5e4069c2..ca04107d33a 100644 --- a/spec/features/dashboard/groups_list_spec.rb +++ b/spec/features/dashboard/groups_list_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -RSpec.describe 'Dashboard Groups page', js: true, feature: true do +describe 'Dashboard Groups page', js: true, feature: true do include WaitForAjax let!(:user) { create :user } @@ -40,8 +40,8 @@ RSpec.describe 'Dashboard Groups page', js: true, feature: true do wait_for_ajax expect(page).to have_content(group.full_name) - expect(page).to have_content(public_group.full_name) - expect(page).not_to have_content(private_group.full_name) + expect(page).to have_content(nested_group.full_name) + expect(page).not_to have_content(another_group.full_name) expect(page.all('.js-groups-list-holder .content-list li').length).to eq 2 end end diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb index 7b23115c527..773ae4b38bc 100644 --- a/spec/features/explore/groups_list_spec.rb +++ b/spec/features/explore/groups_list_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -RSpec.describe 'Explore Groups page', js: true, feature: true do +describe 'Explore Groups page', js: true, feature: true do include WaitForAjax let!(:user) { create :user }