Refactor and restyle team page for project
This commit is contained in:
parent
e9d8d074a1
commit
a29db26cc9
11 changed files with 60 additions and 58 deletions
|
@ -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]
|
before_filter :authorize_admin_project!, except: [:index, :show]
|
||||||
|
|
||||||
def index
|
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
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -1,12 +1,4 @@
|
||||||
module ProjectsHelper
|
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)
|
def remove_from_project_team_message(project, user)
|
||||||
"You are going to remove #{user.name} from #{project.name} project team. Are you sure?"
|
"You are going to remove #{user.name} from #{project.name} project team. Are you sure?"
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,6 +26,10 @@ class UserTeamProjectRelationship < ActiveRecord::Base
|
||||||
user_team.name
|
user_team.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def human_max_access
|
||||||
|
UserTeam.access_roles.key(greatest_access)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def check_greatest_access
|
def check_greatest_access
|
||||||
|
|
10
app/views/team_members/_assigned_team.html.haml
Normal file
10
app/views/team_members/_assigned_team.html.haml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
%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}
|
4
app/views/team_members/_assigned_teams.html.haml
Normal file
4
app/views/team_members/_assigned_teams.html.haml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
.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
|
|
@ -1,15 +0,0 @@
|
||||||
- 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
|
|
|
@ -1,11 +1,11 @@
|
||||||
- grouper_project_members(@project).each do |access, members|
|
- @team.each do |access, members|
|
||||||
.ui-box
|
.ui-box
|
||||||
%h5.title
|
%h5.title
|
||||||
= Project.access_options.key(access).pluralize
|
= Project.access_options.key(access).pluralize
|
||||||
%small= members.size
|
%small= members.size
|
||||||
%ul.well-list
|
%ul.well-list
|
||||||
- members.sort_by(&:user_name).each do |up|
|
- members.sort_by(&:user_name).each do |team_member|
|
||||||
= render(partial: 'team_members/show', locals: {member: up})
|
= render 'team_members/team_member', member: team_member
|
||||||
|
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
- allow_admin = can? current_user, :admin_project, @project
|
- allow_admin = can? current_user, :admin_project, @project
|
||||||
%li{id: dom_id(user), class: "team_member_row user_#{user.id}"}
|
%li{id: dom_id(user), class: "team_member_row user_#{user.id}"}
|
||||||
.row
|
.row
|
||||||
.span6
|
.span4
|
||||||
= link_to project_team_member_path(@project, user), title: user.name, class: "dark" do
|
= link_to project_team_member_path(@project, user), title: user.name, class: "dark" do
|
||||||
= image_tag gravatar_icon(user.email, 40), class: "avatar s32"
|
= image_tag gravatar_icon(user.email, 40), class: "avatar s32"
|
||||||
= link_to project_team_member_path(@project, user), title: user.name, class: "dark" do
|
= link_to project_team_member_path(@project, user), title: user.name, class: "dark" do
|
||||||
|
@ -10,18 +10,18 @@
|
||||||
%br
|
%br
|
||||||
%small.cgray= user.email
|
%small.cgray= user.email
|
||||||
|
|
||||||
.span5.pull-right
|
.span4.pull-right
|
||||||
- if allow_admin
|
- if allow_admin
|
||||||
.left
|
.left
|
||||||
= form_for(member, as: :team_member, url: project_team_member_path(@project, member.user)) do |f|
|
= 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"
|
= f.select :project_access, options_for_select(UsersProject.access_roles, member.project_access), {}, class: "medium project-access-select span2"
|
||||||
.pull-right
|
.pull-right
|
||||||
- if current_user == user
|
- if current_user == user
|
||||||
%span.btn.disabled This is you!
|
%span.label This is you!
|
||||||
- if @project.namespace_owner == user
|
- if @project.namespace_owner == user
|
||||||
%span.btn.disabled Owner
|
%span.label Owner
|
||||||
- elsif user.blocked
|
- elsif user.blocked
|
||||||
%span.btn.disabled.blocked Blocked
|
%span.label Blocked
|
||||||
- elsif allow_admin
|
- 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
|
= 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
|
%i.icon-minus.icon-white
|
|
@ -1,16 +0,0 @@
|
||||||
- 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
|
%hr
|
||||||
|
|
||||||
.clearfix
|
.clearfix
|
||||||
%div.team-table
|
.row
|
||||||
= render partial: "team_members/team", locals: {project: @project}
|
.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}
|
|
||||||
|
|
Loading…
Reference in a new issue