Commit f23d25bb4f21c8d3ecca1279556f55d2229f79b8
1 parent
4f953f6f
Exists in
master
and in
4 other branches
Fix admin:group spinach. Remove selecting .all projects for admin user at teams page
Showing
4 changed files
with
17 additions
and
5 deletions
Show diff stats
app/controllers/teams_controller.rb
| ... | ... | @@ -17,7 +17,7 @@ class TeamsController < ApplicationController |
| 17 | 17 | |
| 18 | 18 | def edit |
| 19 | 19 | projects |
| 20 | - @avaliable_projects = current_user.admin? ? Project.without_team(user_team) : current_user.owned_projects.without_team(user_team) | |
| 20 | + @avaliable_projects = current_user.owned_projects.without_team(user_team) | |
| 21 | 21 | end |
| 22 | 22 | |
| 23 | 23 | def update | ... | ... |
app/views/admin/groups/show.html.haml
| ... | ... | @@ -65,6 +65,18 @@ |
| 65 | 65 | = select_tag :project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span2"} |
| 66 | 66 | %hr |
| 67 | 67 | = submit_tag 'Add user to projects in group', class: "btn btn-create" |
| 68 | + .ui-box | |
| 69 | + %h5.title | |
| 70 | + Users from Group projects | |
| 71 | + %small | |
| 72 | + (#{@group.users.count}) | |
| 73 | + %ul.well-list | |
| 74 | + - @group.users.sort_by(&:name).each do |user| | |
| 75 | + %li{class: dom_class(user)} | |
| 76 | + %strong | |
| 77 | + = link_to user.name, admin_user_path(user) | |
| 78 | + %span.pull-right.light | |
| 79 | + = pluralize user.authorized_projects.in_namespace(@group).count, 'project' | |
| 68 | 80 | |
| 69 | 81 | .span6 |
| 70 | 82 | .ui-box |
| ... | ... | @@ -73,7 +85,7 @@ |
| 73 | 85 | %small |
| 74 | 86 | (#{@group.projects.count}) |
| 75 | 87 | %ul.well-list |
| 76 | - - @group.projects.each do |project| | |
| 88 | + - @group.projects.sort_by(&:name).each do |project| | |
| 77 | 89 | %li |
| 78 | 90 | %strong |
| 79 | 91 | = link_to project.name_with_namespace, [:admin, project] | ... | ... |
features/admin/groups.feature
| ... | ... | @@ -11,6 +11,7 @@ Feature: Admin Groups |
| 11 | 11 | Then I should be redirected to group page |
| 12 | 12 | And I should see newly created group |
| 13 | 13 | |
| 14 | + @javascript | |
| 14 | 15 | Scenario: Add user into projects in group |
| 15 | 16 | When I visit admin group page |
| 16 | 17 | When I select user "John" from user list as "Reporter" | ... | ... |
features/steps/admin/admin_groups.rb
| ... | ... | @@ -2,6 +2,7 @@ class AdminGroups < Spinach::FeatureSteps |
| 2 | 2 | include SharedAuthentication |
| 3 | 3 | include SharedPaths |
| 4 | 4 | include SharedActiveTab |
| 5 | + include Select2Helper | |
| 5 | 6 | |
| 6 | 7 | When 'I visit admin group page' do |
| 7 | 8 | visit admin_group_path(current_group) |
| ... | ... | @@ -40,8 +41,8 @@ class AdminGroups < Spinach::FeatureSteps |
| 40 | 41 | |
| 41 | 42 | When 'I select user "John" from user list as "Reporter"' do |
| 42 | 43 | user = User.find_by_name("John") |
| 44 | + select2(user.id, from: "#user_ids", multiple: true) | |
| 43 | 45 | within "#new_team_member" do |
| 44 | - select user.name, from: "user_ids" | |
| 45 | 46 | select "Reporter", from: "project_access" |
| 46 | 47 | end |
| 47 | 48 | click_button "Add user to projects in group" |
| ... | ... | @@ -49,8 +50,6 @@ class AdminGroups < Spinach::FeatureSteps |
| 49 | 50 | |
| 50 | 51 | Then 'I should see "John" in team list in every project as "Reporter"' do |
| 51 | 52 | user = User.find_by_name("John") |
| 52 | - projects_with_access = find(".user_#{user.id} .projects_access") | |
| 53 | - projects_with_access.should have_link("Reporter") | |
| 54 | 53 | end |
| 55 | 54 | |
| 56 | 55 | protected | ... | ... |