Manage team from groups page. Phase 1
This commit is contained in:
parent
08fded3fac
commit
aaa1c94239
5 changed files with 66 additions and 15 deletions
|
@ -47,7 +47,12 @@ class GroupsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def people
|
def people
|
||||||
@users = group.users
|
@project = group.projects.find(params[:project_id]) if params[:project_id]
|
||||||
|
@users = @project ? @project.users : group.users
|
||||||
|
|
||||||
|
if @project
|
||||||
|
@team_member = @project.users_projects.new
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -21,8 +21,12 @@ class TeamMembersController < ProjectResourceController
|
||||||
params[:project_access]
|
params[:project_access]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if params[:redirect_to]
|
||||||
|
redirect_to params[:redirect_to]
|
||||||
|
else
|
||||||
redirect_to project_team_index_path(@project)
|
redirect_to project_team_index_path(@project)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@team_member = project.users_projects.find(params[:id])
|
@team_member = project.users_projects.find(params[:id])
|
||||||
|
|
18
app/views/groups/_new_member.html.haml
Normal file
18
app/views/groups/_new_member.html.haml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
= form_for @team_member, as: :team_member, url: project_team_members_path(@project, @team_member) do |f|
|
||||||
|
%fieldset
|
||||||
|
%legend= "New Team member(s) for #{@project.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.not_in_project(@project).all, :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, project_id: @project.id)
|
||||||
|
= f.submit 'Add', class: "btn save-btn"
|
||||||
|
|
14
app/views/groups/_people_filter.html.haml
Normal file
14
app/views/groups/_people_filter.html.haml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
= form_tag people_group_path(@group), method: 'get' do
|
||||||
|
%fieldset
|
||||||
|
%legend Projects:
|
||||||
|
%ul.nav.nav-pills.nav-stacked
|
||||||
|
- @projects.each do |project|
|
||||||
|
%li{class: ("active" if params[:project_id] == project.id.to_s)}
|
||||||
|
= link_to people_group_path(@group, project_id: project.id) do
|
||||||
|
= project.name_with_namespace
|
||||||
|
%small.right= project.users.count
|
||||||
|
|
||||||
|
%fieldset
|
||||||
|
%hr
|
||||||
|
= link_to "Reset", people_group_path(@group), class: 'btn right'
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
|
.row
|
||||||
|
.span3
|
||||||
|
= render 'people_filter'
|
||||||
|
.span9
|
||||||
|
- if @project && can?(current_user, :manage_group, @group)
|
||||||
|
= render "new_member"
|
||||||
.ui-box
|
.ui-box
|
||||||
%h5
|
%h5
|
||||||
People
|
Team
|
||||||
%small
|
%small
|
||||||
(#{@users.size})
|
(#{@users.size})
|
||||||
%ul.unstyled
|
%ul.unstyled
|
||||||
|
@ -9,6 +15,10 @@
|
||||||
= image_tag gravatar_icon(user.email, 16), class: "avatar s16"
|
= image_tag gravatar_icon(user.email, 16), class: "avatar s16"
|
||||||
%strong= user.name
|
%strong= user.name
|
||||||
%span.cgray= user.email
|
%span.cgray= user.email
|
||||||
|
- if @project
|
||||||
|
- if @project.owner == user
|
||||||
|
%span.btn.btn-small.disabled.right Project Owner
|
||||||
|
- else
|
||||||
- if @group.owner == user
|
- if @group.owner == user
|
||||||
%span.btn.btn-small.disabled.right Owner
|
%span.btn.btn-small.disabled.right Group Owner
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue