Commit a29db26c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Refactor and restyle team page for project

parent e9d8d074
......@@ -115,3 +115,7 @@ ul.nav.nav-projects-tabs {
}
}
}
.team_member_row form {
margin: 0px;
}
......@@ -4,7 +4,9 @@ class TeamMembersController < ProjectResourceController
before_filter :authorize_admin_project!, except: [:index, :show]
def index
@teams = UserTeam.scoped
@team = @project.users_projects.scoped
@team = @team.send(params[:type]) if %w(masters developers reporters guests).include?(params[:type])
@team = @team.sort_by(&:project_access).reverse.group_by(&:project_access)
end
def show
......
module ProjectsHelper
def grouper_project_members(project)
@project.users_projects.sort_by(&:project_access).reverse.group_by(&:project_access)
end
def grouper_project_teams(project)
@project.user_team_project_relationships.sort_by(&:greatest_access).reverse.group_by(&:greatest_access)
end
def remove_from_project_team_message(project, user)
"You are going to remove #{user.name} from #{project.name} project team. Are you sure?"
end
......
......@@ -26,6 +26,10 @@ class UserTeamProjectRelationship < ActiveRecord::Base
user_team.name
end
def human_max_access
UserTeam.access_roles.key(greatest_access)
end
private
def check_greatest_access
......
%li{id: dom_id(team), class: "user_team_row team_#{team.id}"}
.pull-right
- if can?(current_user, :admin_team_member, @project)
= link_to resign_project_team_path(@project, team), method: :delete, confirm: "Are you shure?", class: "btn btn-remove btn-tiny" do
%i.icon-minus.icon-white
%strong= link_to team.name, team_path(team), title: team.name, class: "dark"
%br
%small.cgray Members: #{team.members.count}
%small.cgray Max access: #{team_relation.human_max_access}
.ui-box
%ul.well-list
- @project.user_team_project_relationships.sort_by(&:team_name).each do |team_relation|
= render "team_members/assigned_team", team_relation: team_relation, team: team_relation.user_team
- team = team_rel.user_team
- allow_admin = can? current_user, :admin_team_member, @project
%li{id: dom_id(team), class: "user_team_row team_#{team.id}"}
.row
.span6
%strong= link_to team.name, team_path(team), title: team.name, class: "dark"
%br
%small.cgray Members: #{team.members.count}
.span5.pull-right
.pull-right
- if allow_admin
.left
= link_to resign_project_team_path(@project, team), method: :delete, confirm: "Are you shure?", class: "btn btn-remove small" do
%i.icon-minus.icon-white
- grouper_project_members(@project).each do |access, members|
- @team.each do |access, members|
.ui-box
%h5.title
= Project.access_options.key(access).pluralize
%small= members.size
%ul.well-list
- members.sort_by(&:user_name).each do |up|
= render(partial: 'team_members/show', locals: {member: up})
- members.sort_by(&:user_name).each do |team_member|
= render 'team_members/team_member', member: team_member
:javascript
......
......@@ -2,7 +2,7 @@
- allow_admin = can? current_user, :admin_project, @project
%li{id: dom_id(user), class: "team_member_row user_#{user.id}"}
.row
.span6
.span4
= link_to project_team_member_path(@project, user), title: user.name, class: "dark" do
= image_tag gravatar_icon(user.email, 40), class: "avatar s32"
= link_to project_team_member_path(@project, user), title: user.name, class: "dark" do
......@@ -10,18 +10,18 @@
%br
%small.cgray= user.email
.span5.pull-right
.span4.pull-right
- if allow_admin
.left
= form_for(member, as: :team_member, url: project_team_member_path(@project, member.user)) do |f|
= f.select :project_access, options_for_select(UsersProject.access_roles, member.project_access), {}, class: "medium project-access-select span2"
.pull-right
- if current_user == user
%span.btn.disabled This is you!
%span.label This is you!
- if @project.namespace_owner == user
%span.btn.disabled Owner
%span.label Owner
- elsif user.blocked
%span.btn.disabled.blocked Blocked
%span.label Blocked
- elsif allow_admin
= link_to project_team_member_path(@project, user), confirm: remove_from_project_team_message(@project, user), method: :delete, class: "btn-tiny btn btn-remove" do
%i.icon-minus.icon-white
......
- grouper_project_teams(@project).each do |access, teams|
.ui-box
%h5.title
= UserTeam.access_roles.key(access).pluralize
%small= teams.size
%ul.well-list
- teams.sort_by(&:team_name).each do |tofr|
= render(partial: 'team_members/show_team', locals: {team_rel: tofr})
:javascript
$(function(){
$('.repo-access-select, .project-access-select').live("change", function() {
$(this.form).submit();
});
})
......@@ -18,16 +18,33 @@
%hr
.clearfix
%div.team-table
= render partial: "team_members/team", locals: {project: @project}
.row
.span3
%ul.nav.nav-pills.nav-stacked
%li{class: ("active" if !params[:type])}
= link_to project_team_members_path(type: nil) do
All
%li{class: ("active" if params[:type] == 'masters')}
= link_to project_team_members_path(type: 'masters') do
Masters
%li{class: ("active" if params[:type] == 'developers')}
= link_to project_team_members_path(type: 'developers') do
Developers
%li{class: ("active" if params[:type] == 'reporters')}
= link_to project_team_members_path(type: 'reporters') do
Reporters
%li{class: ("active" if params[:type] == 'guests')}
= link_to project_team_members_path(type: 'guests') do
Guests
%h5
Assigned teams
(#{@project.user_teams.count})
%div
= render "team_members/assigned_teams", project: @project
.span9
%div.team-table
= render "team_members/team", project: @project
%h3.page_title
Assigned teams
(#{@project.user_teams.count})
%hr
.clearfix
%div.team-table
= render partial: "team_members/teams", locals: {project: @project}
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