Commit aaa1c942 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Manage team from groups page. Phase 1

parent 08fded3f
......@@ -47,7 +47,12 @@ class GroupsController < ApplicationController
end
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
protected
......
......@@ -21,7 +21,11 @@ class TeamMembersController < ProjectResourceController
params[:project_access]
)
redirect_to project_team_index_path(@project)
if params[:redirect_to]
redirect_to params[:redirect_to]
else
redirect_to project_team_index_path(@project)
end
end
def update
......
= 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"
= 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'
.ui-box
%h5
People
%small
(#{@users.size})
%ul.unstyled
- @users.each do |user|
%li.wll
= image_tag gravatar_icon(user.email, 16), class: "avatar s16"
%strong= user.name
%span.cgray= user.email
- if @group.owner == user
%span.btn.btn-small.disabled.right Owner
.row
.span3
= render 'people_filter'
.span9
- if @project && can?(current_user, :manage_group, @group)
= render "new_member"
.ui-box
%h5
Team
%small
(#{@users.size})
%ul.unstyled
- @users.each do |user|
%li.wll
= image_tag gravatar_icon(user.email, 16), class: "avatar s16"
%strong= user.name
%span.cgray= user.email
- if @project
- if @project.owner == user
%span.btn.btn-small.disabled.right Project Owner
- else
- if @group.owner == user
%span.btn.btn-small.disabled.right Group Owner
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment