Manage team from groups page. Phase 1

This commit is contained in:
Dmitriy Zaporozhets 2012-11-29 20:14:05 +03:00
parent 08fded3fac
commit aaa1c94239
5 changed files with 66 additions and 15 deletions

View file

@ -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

View file

@ -21,7 +21,11 @@ class TeamMembersController < ProjectResourceController
params[:project_access] 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 end
def update def update

View 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"

View 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'

View file

@ -1,14 +1,24 @@
.ui-box .row
%h5 .span3
People = render 'people_filter'
%small .span9
(#{@users.size}) - if @project && can?(current_user, :manage_group, @group)
%ul.unstyled = render "new_member"
- @users.each do |user| .ui-box
%li.wll %h5
= image_tag gravatar_icon(user.email, 16), class: "avatar s16" Team
%strong= user.name %small
%span.cgray= user.email (#{@users.size})
- if @group.owner == user %ul.unstyled
%span.btn.btn-small.disabled.right Owner - @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