Add functional in user section
This commit is contained in:
parent
9c574464a6
commit
25c5763780
|
@ -53,9 +53,18 @@ class GroupsController < ApplicationController
|
|||
|
||||
if @project
|
||||
@team_member = @project.users_projects.new
|
||||
else
|
||||
@team_member = UsersProject.new
|
||||
end
|
||||
end
|
||||
|
||||
def team_members
|
||||
@group.projects.each do |p|
|
||||
p.add_users_ids_to_team(params[:user_ids], params[:project_access])
|
||||
end
|
||||
redirect_to people_group_path(@group), notice: 'Users was successfully added.'
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def group
|
||||
|
|
18
app/views/groups/_new_group_member.html.haml
Normal file
18
app/views/groups/_new_group_member.html.haml
Normal file
|
@ -0,0 +1,18 @@
|
|||
= form_for @team_member, as: :team_member, url: team_members_group_path(@group, @team_member) do |f|
|
||||
%fieldset
|
||||
%legend= "New Team member(s) for projects in #{@group.name}"
|
||||
|
||||
%h6 1. Choose people you want in the team
|
||||
.clearfix
|
||||
= f.label :user_ids, "People"
|
||||
.input= select_tag(:user_ids, options_from_collection_for_select(User.active, :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true})
|
||||
|
||||
%h6 2. Set access level for them
|
||||
.clearfix
|
||||
= f.label :project_access, "Project Access"
|
||||
.input= select_tag :project_access, options_for_select(Project.access_options, @team_member.project_access), class: "project-access-select chosen"
|
||||
|
||||
.form-actions
|
||||
= hidden_field_tag :redirect_to, people_group_path(@group)
|
||||
= f.submit 'Add', class: "btn save-btn"
|
||||
|
|
@ -17,4 +17,4 @@
|
|||
%span.cgray= user.email
|
||||
- if @group.owner == user
|
||||
%span.btn.btn-small.disabled.right Group Owner
|
||||
|
||||
= render "new_group_member"
|
||||
|
|
|
@ -103,6 +103,7 @@ Gitlab::Application.routes.draw do
|
|||
get :merge_requests
|
||||
get :search
|
||||
get :people
|
||||
put :team_members
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -17,3 +17,10 @@ Feature: Groups
|
|||
Given project from group has merge requests assigned to me
|
||||
When I visit group merge requests page
|
||||
Then I should see merge requests from this group assigned to me
|
||||
|
||||
Scenario: I should add user to projects in Group
|
||||
Given I have new user "John"
|
||||
When I visit group page
|
||||
When I visit group people page
|
||||
When I select user "John" from list with role "Reporter"
|
||||
Then I should see user "John" in team list
|
||||
|
|
|
@ -32,6 +32,25 @@ class Groups < Spinach::FeatureSteps
|
|||
end
|
||||
end
|
||||
|
||||
Given 'I have new user "John"' do
|
||||
create(:user, name: "John")
|
||||
end
|
||||
|
||||
When 'I select user "John" from list with role "Reporter"' do
|
||||
user = User.find_by_name("John")
|
||||
within "#new_team_member" do
|
||||
select user.name, :from => "user_ids"
|
||||
select "Reporter", :from => "project_access"
|
||||
end
|
||||
click_button "Add"
|
||||
end
|
||||
|
||||
Then 'I should see user "John" in team list' do
|
||||
user = User.find_by_name("John")
|
||||
projects_with_access = find(".ui-box .well-list li")
|
||||
projects_with_access.should have_content("John")
|
||||
end
|
||||
|
||||
Given 'project from group has issues assigned to me' do
|
||||
create :issue,
|
||||
project: project,
|
||||
|
|
|
@ -21,6 +21,10 @@ module SharedPaths
|
|||
visit merge_requests_group_path(current_group)
|
||||
end
|
||||
|
||||
When 'I visit group people page' do
|
||||
visit people_group_path(current_group)
|
||||
end
|
||||
|
||||
# ----------------------------------------
|
||||
# Dashboard
|
||||
# ----------------------------------------
|
||||
|
|
Loading…
Reference in a new issue