diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-02-18 23:21:24 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-02-18 23:21:24 +0400 |
commit | ba937b2b3d81a7a9d3097387150fe8c8f2d784ca (patch) | |
tree | 082e75a5295ca42c510a07261649482d148fa0cf /app | |
parent | a29db26cc99cb7406d1f9d7fe91650e6e2dd8294 (diff) |
Dont show assigned_teams block unless any. Show count in filter
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/team_members_controller.rb | 2 | ||||
-rw-r--r-- | app/views/team_members/_assigned_teams.html.haml | 2 | ||||
-rw-r--r-- | app/views/team_members/_team.html.haml | 10 | ||||
-rw-r--r-- | app/views/team_members/_team_member.html.haml | 2 | ||||
-rw-r--r-- | app/views/team_members/index.html.haml | 18 |
5 files changed, 17 insertions, 17 deletions
diff --git a/app/controllers/team_members_controller.rb b/app/controllers/team_members_controller.rb index 81d818e9386..04348dc7977 100644 --- a/app/controllers/team_members_controller.rb +++ b/app/controllers/team_members_controller.rb @@ -7,6 +7,8 @@ class TeamMembersController < ProjectResourceController @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) + + @assigned_teams = @project.user_team_project_relationships end def show diff --git a/app/views/team_members/_assigned_teams.html.haml b/app/views/team_members/_assigned_teams.html.haml index c06b826f918..91c6d8f7157 100644 --- a/app/views/team_members/_assigned_teams.html.haml +++ b/app/views/team_members/_assigned_teams.html.haml @@ -1,4 +1,4 @@ .ui-box %ul.well-list - - @project.user_team_project_relationships.sort_by(&:team_name).each do |team_relation| + - assigned_teams.sort_by(&:team_name).each do |team_relation| = render "team_members/assigned_team", team_relation: team_relation, team: team_relation.user_team diff --git a/app/views/team_members/_team.html.haml b/app/views/team_members/_team.html.haml index 9f68fb78203..2ec8c1a8451 100644 --- a/app/views/team_members/_team.html.haml +++ b/app/views/team_members/_team.html.haml @@ -1,4 +1,4 @@ -- @team.each do |access, members| +- team.each do |access, members| .ui-box %h5.title = Project.access_options.key(access).pluralize @@ -6,11 +6,3 @@ %ul.well-list - members.sort_by(&:user_name).each do |team_member| = render 'team_members/team_member', member: team_member - - -:javascript - $(function(){ - $('.repo-access-select, .project-access-select').live("change", function() { - $(this.form).submit(); - }); - }) diff --git a/app/views/team_members/_team_member.html.haml b/app/views/team_members/_team_member.html.haml index 7ee51246ceb..e7cba0b349c 100644 --- a/app/views/team_members/_team_member.html.haml +++ b/app/views/team_members/_team_member.html.haml @@ -14,7 +14,7 @@ - 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" + = f.select :project_access, options_for_select(UsersProject.access_roles, member.project_access), {}, class: "medium project-access-select span2 trigger-submit" .pull-right - if current_user == user %span.label This is you! diff --git a/app/views/team_members/index.html.haml b/app/views/team_members/index.html.haml index ac9e46a1fac..6958ec4cfcc 100644 --- a/app/views/team_members/index.html.haml +++ b/app/views/team_members/index.html.haml @@ -27,24 +27,30 @@ %li{class: ("active" if params[:type] == 'masters')} = link_to project_team_members_path(type: 'masters') do Masters + %span.pull-right= @project.users_projects.masters.count %li{class: ("active" if params[:type] == 'developers')} = link_to project_team_members_path(type: 'developers') do Developers + %span.pull-right= @project.users_projects.developers.count %li{class: ("active" if params[:type] == 'reporters')} = link_to project_team_members_path(type: 'reporters') do Reporters + %span.pull-right= @project.users_projects.reporters.count %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 + %span.pull-right= @project.users_projects.guests.count + + - if @assigned_teams.present? + %h5 + Assigned teams + (#{@project.user_teams.count}) + %div + = render "team_members/assigned_teams", assigned_teams: @assigned_teams .span9 %div.team-table - = render "team_members/team", project: @project + = render "team_members/team", team: @team |