diff --git a/app/controllers/teams_controller.rb b/app/controllers/teams_controller.rb index 73c2fb43326d2c8c95171afcc74c150e17788b9e..57ab2a88e036e01e7d64e98068bead7120b514d1 100644 --- a/app/controllers/teams_controller.rb +++ b/app/controllers/teams_controller.rb @@ -17,7 +17,7 @@ class TeamsController < ApplicationController def edit projects - @avaliable_projects = current_user.admin? ? Project.without_team(user_team) : current_user.owned_projects.without_team(user_team) + @avaliable_projects = current_user.owned_projects.without_team(user_team) end def update diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml index 77421f2d4b60bac16dc7ad3c1d725bc65dd2a40d..9c4b91b1bfa3b71076cf0b42aefd0f52de49f9b7 100644 --- a/app/views/admin/groups/show.html.haml +++ b/app/views/admin/groups/show.html.haml @@ -65,6 +65,18 @@ = select_tag :project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span2"} %hr = submit_tag 'Add user to projects in group', class: "btn btn-create" + .ui-box + %h5.title + Users from Group projects + %small + (#{@group.users.count}) + %ul.well-list + - @group.users.sort_by(&:name).each do |user| + %li{class: dom_class(user)} + %strong + = link_to user.name, admin_user_path(user) + %span.pull-right.light + = pluralize user.authorized_projects.in_namespace(@group).count, 'project' .span6 .ui-box @@ -73,7 +85,7 @@ %small (#{@group.projects.count}) %ul.well-list - - @group.projects.each do |project| + - @group.projects.sort_by(&:name).each do |project| %li %strong = link_to project.name_with_namespace, [:admin, project] diff --git a/features/admin/groups.feature b/features/admin/groups.feature index 28f35e3a8316ad15c7f79d7260a24a59fae93c60..054dccfd64c443c109008e271ee5377b7fa91f22 100644 --- a/features/admin/groups.feature +++ b/features/admin/groups.feature @@ -11,6 +11,7 @@ Feature: Admin Groups Then I should be redirected to group page And I should see newly created group + @javascript Scenario: Add user into projects in group When I visit admin group page When I select user "John" from user list as "Reporter" diff --git a/features/steps/admin/admin_groups.rb b/features/steps/admin/admin_groups.rb index a2b49070f9f65b5c256f53184cc639af2f3b89eb..d780d9c96d9e40517104ab71cd775b3a85eb4426 100644 --- a/features/steps/admin/admin_groups.rb +++ b/features/steps/admin/admin_groups.rb @@ -2,6 +2,7 @@ class AdminGroups < Spinach::FeatureSteps include SharedAuthentication include SharedPaths include SharedActiveTab + include Select2Helper When 'I visit admin group page' do visit admin_group_path(current_group) @@ -40,8 +41,8 @@ class AdminGroups < Spinach::FeatureSteps When 'I select user "John" from user list as "Reporter"' do user = User.find_by_name("John") + select2(user.id, from: "#user_ids", multiple: true) within "#new_team_member" do - select user.name, from: "user_ids" select "Reporter", from: "project_access" end click_button "Add user to projects in group" @@ -49,8 +50,6 @@ class AdminGroups < Spinach::FeatureSteps Then 'I should see "John" in team list in every project as "Reporter"' do user = User.find_by_name("John") - projects_with_access = find(".user_#{user.id} .projects_access") - projects_with_access.should have_link("Reporter") end protected