Commit fa9a8c38473a83d2dcc1d015e10a9ff1c020b0d5
1 parent
366bc320
Exists in
master
and in
4 other branches
Remove team_member show page -> use user_path instead
Showing
13 changed files
with
34 additions
and
178 deletions
Show diff stats
app/controllers/team_members_controller.rb
| @@ -11,11 +11,6 @@ class TeamMembersController < ProjectResourceController | @@ -11,11 +11,6 @@ class TeamMembersController < ProjectResourceController | ||
| 11 | @assigned_teams = @project.user_team_project_relationships | 11 | @assigned_teams = @project.user_team_project_relationships |
| 12 | end | 12 | end |
| 13 | 13 | ||
| 14 | - def show | ||
| 15 | - @user_project_relation = project.users_projects.find_by_user_id(member) | ||
| 16 | - @events = member.recent_events.in_projects(project).limit(7) | ||
| 17 | - end | ||
| 18 | - | ||
| 19 | def new | 14 | def new |
| 20 | @user_project_relation = project.users_projects.new | 15 | @user_project_relation = project.users_projects.new |
| 21 | end | 16 | end |
app/decorators/commit_decorator.rb
| @@ -81,12 +81,13 @@ class CommitDecorator < ApplicationDecorator | @@ -81,12 +81,13 @@ class CommitDecorator < ApplicationDecorator | ||
| 81 | else | 81 | else |
| 82 | source_name | 82 | source_name |
| 83 | end | 83 | end |
| 84 | - team_member = @project.try(:team_member_by_name_or_email, source_name, source_email) | ||
| 85 | 84 | ||
| 86 | - if team_member.nil? | ||
| 87 | - h.mail_to source_email, text.html_safe, class: "commit-#{options[:source]}-link" | 85 | + user = User.where('name like ? or email like ?', source_name, source_email).first |
| 86 | + | ||
| 87 | + if user.nil? | ||
| 88 | + h.mail_to(source_email, text.html_safe, class: "commit-#{options[:source]}-link") | ||
| 88 | else | 89 | else |
| 89 | - h.link_to text, h.project_team_member_path(@project, team_member), class: "commit-#{options[:source]}-link" | 90 | + h.link_to(text.html_safe, h.user_path(user), class: "commit-#{options[:source]}-link") |
| 90 | end | 91 | end |
| 91 | end | 92 | end |
| 92 | end | 93 | end |
app/helpers/projects_helper.rb
| @@ -32,17 +32,7 @@ module ProjectsHelper | @@ -32,17 +32,7 @@ module ProjectsHelper | ||
| 32 | 32 | ||
| 33 | author_html = author_html.html_safe | 33 | author_html = author_html.html_safe |
| 34 | 34 | ||
| 35 | - tm = project.team_member_by_id(author) | ||
| 36 | - | ||
| 37 | - if tm | ||
| 38 | - link_to author_html, project_team_member_path(project, tm.user_username), class: "author_link" | ||
| 39 | - else | ||
| 40 | - author_html | ||
| 41 | - end.html_safe | ||
| 42 | - end | ||
| 43 | - | ||
| 44 | - def tm_path team_member | ||
| 45 | - project_team_member_path(@project, team_member) | 35 | + link_to(author_html, user_path(author), class: "author_link").html_safe |
| 46 | end | 36 | end |
| 47 | 37 | ||
| 48 | def project_title project | 38 | def project_title project |
app/views/milestones/show.html.haml
| @@ -87,7 +87,7 @@ | @@ -87,7 +87,7 @@ | ||
| 87 | %h6 Participants: | 87 | %h6 Participants: |
| 88 | %div | 88 | %div |
| 89 | - @users.each do |user| | 89 | - @users.each do |user| |
| 90 | - = link_to tm_path(user.tm_of(@project)), class: 'float-link' do | 90 | + = link_to user, class: 'float-link' do |
| 91 | = user.avatar_image | 91 | = user.avatar_image |
| 92 | = user.name | 92 | = user.name |
| 93 | 93 |
app/views/team_members/_team_member.html.haml
| @@ -3,12 +3,11 @@ | @@ -3,12 +3,11 @@ | ||
| 3 | %li{id: dom_id(user), class: "team_member_row user_#{user.id}"} | 3 | %li{id: dom_id(user), class: "team_member_row user_#{user.id}"} |
| 4 | .row | 4 | .row |
| 5 | .span4 | 5 | .span4 |
| 6 | - = link_to project_team_member_path(@project, user), title: user.name, class: "dark" do | ||
| 7 | - = image_tag gravatar_icon(user.email, 40), class: "avatar s32" | ||
| 8 | - = link_to project_team_member_path(@project, user), title: user.name, class: "dark" do | 6 | + = link_to user, title: user.name, class: "dark" do |
| 7 | + = image_tag gravatar_icon(user.email, 32), class: "avatar s32" | ||
| 9 | %strong= truncate(user.name, lenght: 40) | 8 | %strong= truncate(user.name, lenght: 40) |
| 10 | %br | 9 | %br |
| 11 | - %small.cgray= user.email | 10 | + %small.cgray= user.username |
| 12 | 11 | ||
| 13 | .span4.pull-right | 12 | .span4.pull-right |
| 14 | - if allow_admin | 13 | - if allow_admin |
| @@ -23,6 +22,6 @@ | @@ -23,6 +22,6 @@ | ||
| 23 | - elsif user.blocked? | 22 | - elsif user.blocked? |
| 24 | %span.label Blocked | 23 | %span.label Blocked |
| 25 | - elsif allow_admin | 24 | - elsif allow_admin |
| 26 | - = 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 | 25 | + = link_to project_team_member_path(@project, user), confirm: remove_from_project_team_message(@project, user), method: :delete, class: "btn-tiny btn btn-remove", title: 'Remove user from team' do |
| 27 | %i.icon-minus.icon-white | 26 | %i.icon-minus.icon-white |
| 28 | 27 |
app/views/team_members/show.html.haml
| @@ -1,59 +0,0 @@ | @@ -1,59 +0,0 @@ | ||
| 1 | -- allow_admin = can? current_user, :admin_project, @project | ||
| 2 | - | ||
| 3 | -.team_member_show | ||
| 4 | - - if can? current_user, :admin_project, @project | ||
| 5 | - = link_to 'Remove from team', project_team_member_path(@project, @member), confirm: 'Are you sure?', method: :delete, class: "btn btn-remove pull-right" | ||
| 6 | - .profile_avatar_holder | ||
| 7 | - = image_tag gravatar_icon(@member.email, 60), class: "borders" | ||
| 8 | - %h3.page_title | ||
| 9 | - = @member.name | ||
| 10 | - %small (@#{@member.username}) | ||
| 11 | - | ||
| 12 | - %hr | ||
| 13 | - .back_link | ||
| 14 | - %br | ||
| 15 | - = link_to project_team_index_path(@project), class: "" do | ||
| 16 | - ← To team list | ||
| 17 | - %br | ||
| 18 | - .row | ||
| 19 | - .span6 | ||
| 20 | - %table.lite | ||
| 21 | - %tr | ||
| 22 | - %td Email | ||
| 23 | - %td= mail_to @member.email | ||
| 24 | - %tr | ||
| 25 | - %td Skype | ||
| 26 | - %td= @member.skype | ||
| 27 | - - unless @member.linkedin.blank? | ||
| 28 | - %tr | ||
| 29 | - %td LinkedIn | ||
| 30 | - %td= @member.linkedin | ||
| 31 | - - unless @member.twitter.blank? | ||
| 32 | - %tr | ||
| 33 | - %td Twitter | ||
| 34 | - %td= @member.twitter | ||
| 35 | - - unless @member.bio.blank? | ||
| 36 | - %tr | ||
| 37 | - %td Bio | ||
| 38 | - %td= @member.bio | ||
| 39 | - .span6 | ||
| 40 | - %table.lite | ||
| 41 | - %tr | ||
| 42 | - %td Member since | ||
| 43 | - %td= @user_project_relation.created_at.stamp("Aug 21, 2011") | ||
| 44 | - %tr | ||
| 45 | - %td | ||
| 46 | - Project Access: | ||
| 47 | - %small (#{link_to "read more", help_permissions_path, class: "vlink"}) | ||
| 48 | - %td | ||
| 49 | - = form_for(@user_project_relation, as: :team_member, url: project_team_member_path(@project, @member)) do |f| | ||
| 50 | - = f.select :project_access, options_for_select(Project.access_options, @user_project_relation.project_access), {}, class: "project-access-select", disabled: !allow_admin | ||
| 51 | - %hr | ||
| 52 | - = render @events | ||
| 53 | -:javascript | ||
| 54 | - $(function(){ | ||
| 55 | - $('.repo-access-select, .project-access-select').live("change", function() { | ||
| 56 | - $(this.form).submit(); | ||
| 57 | - }); | ||
| 58 | - }) | ||
| 59 | - |
app/views/teams/members/_show.html.haml
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | = link_to user_path(user.username), title: user.name, class: "dark" do | 8 | = link_to user_path(user.username), title: user.name, class: "dark" do |
| 9 | %strong= truncate(user.name, lenght: 40) | 9 | %strong= truncate(user.name, lenght: 40) |
| 10 | %br | 10 | %br |
| 11 | - %small.cgray= user.email | 11 | + %small.cgray= user.username |
| 12 | 12 | ||
| 13 | .span4 | 13 | .span4 |
| 14 | - if allow_admin | 14 | - if allow_admin |
app/views/teams/members/new.html.haml
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | %tr.member | 15 | %tr.member |
| 16 | %td | 16 | %td |
| 17 | = member.name | 17 | = member.name |
| 18 | - %small= "(#{member.email})" | 18 | + %small= "(#{member.username})" |
| 19 | %td= @team.human_default_projects_access(member) | 19 | %td= @team.human_default_projects_access(member) |
| 20 | %td= @team.admin?(member) ? "Admin" : "Member" | 20 | %td= @team.admin?(member) ? "Admin" : "Member" |
| 21 | %td | 21 | %td |
app/views/teams/members/show.html.haml
| @@ -1,60 +0,0 @@ | @@ -1,60 +0,0 @@ | ||
| 1 | -- allow_admin = can? current_user, :admin_project, @project | ||
| 2 | -- user = @team_member.user | ||
| 3 | - | ||
| 4 | -.team_member_show | ||
| 5 | - - if can? current_user, :admin_project, @project | ||
| 6 | - = link_to 'Remove from team', project_team_member_path(project_id: @project, id: @team_member.id), confirm: 'Are you sure?', method: :delete, class: "pull-right btn btn-remove" | ||
| 7 | - .profile_avatar_holder | ||
| 8 | - = image_tag gravatar_icon(user.email, 60), class: "borders" | ||
| 9 | - %h3.page_title | ||
| 10 | - = user.name | ||
| 11 | - %small (@#{user.username}) | ||
| 12 | - | ||
| 13 | - %hr | ||
| 14 | - .back_link | ||
| 15 | - %br | ||
| 16 | - = link_to project_team_index_path(@project), class: "" do | ||
| 17 | - ← To team list | ||
| 18 | - %br | ||
| 19 | - .row | ||
| 20 | - .span6 | ||
| 21 | - %table.lite | ||
| 22 | - %tr | ||
| 23 | - %td Email | ||
| 24 | - %td= mail_to user.email | ||
| 25 | - %tr | ||
| 26 | - %td Skype | ||
| 27 | - %td= user.skype | ||
| 28 | - - unless user.linkedin.blank? | ||
| 29 | - %tr | ||
| 30 | - %td LinkedIn | ||
| 31 | - %td= user.linkedin | ||
| 32 | - - unless user.twitter.blank? | ||
| 33 | - %tr | ||
| 34 | - %td Twitter | ||
| 35 | - %td= user.twitter | ||
| 36 | - - unless user.bio.blank? | ||
| 37 | - %tr | ||
| 38 | - %td Bio | ||
| 39 | - %td= user.bio | ||
| 40 | - .span6 | ||
| 41 | - %table.lite | ||
| 42 | - %tr | ||
| 43 | - %td Member since | ||
| 44 | - %td= @team_member.created_at.stamp("Aug 21, 2011") | ||
| 45 | - %tr | ||
| 46 | - %td | ||
| 47 | - Project Access: | ||
| 48 | - %small (#{link_to "read more", help_permissions_path, class: "vlink"}) | ||
| 49 | - %td | ||
| 50 | - = form_for(@team_member, as: :team_member, url: project_team_member_path(@project, @team_member)) do |f| | ||
| 51 | - = f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, class: "project-access-select", disabled: !allow_admin | ||
| 52 | - %hr | ||
| 53 | - = render @events | ||
| 54 | -:javascript | ||
| 55 | - $(function(){ | ||
| 56 | - $('.repo-access-select, .project-access-select').live("change", function() { | ||
| 57 | - $(this.form).submit(); | ||
| 58 | - }); | ||
| 59 | - }) | ||
| 60 | - |
app/views/users/_profile.html.haml
| @@ -3,21 +3,21 @@ | @@ -3,21 +3,21 @@ | ||
| 3 | Profile | 3 | Profile |
| 4 | %ul.well-list | 4 | %ul.well-list |
| 5 | %li | 5 | %li |
| 6 | - %strong Email | ||
| 7 | - %span.pull-right= mail_to user.email | 6 | + %span.light Member since |
| 7 | + %strong= user.created_at.stamp("Aug 21, 2011") | ||
| 8 | - unless user.skype.blank? | 8 | - unless user.skype.blank? |
| 9 | %li | 9 | %li |
| 10 | - %strong Skype | ||
| 11 | - %span.pull-right= user.skype | 10 | + %span.light Skype: |
| 11 | + %strong= user.skype | ||
| 12 | - unless user.linkedin.blank? | 12 | - unless user.linkedin.blank? |
| 13 | %li | 13 | %li |
| 14 | - %strong LinkedIn | ||
| 15 | - %span.pull-right= user.linkedin | 14 | + %span.light LinkedIn: |
| 15 | + %strong= user.linkedin | ||
| 16 | - unless user.twitter.blank? | 16 | - unless user.twitter.blank? |
| 17 | %li | 17 | %li |
| 18 | - %strong Twitter | ||
| 19 | - %span.pull-right= user.twitter | 18 | + %span.light Twitter: |
| 19 | + %strong= user.twitter | ||
| 20 | - unless user.bio.blank? | 20 | - unless user.bio.blank? |
| 21 | %li | 21 | %li |
| 22 | - %strong Bio | ||
| 23 | - %span.pull-right= user.bio | 22 | + %span.light Bio: |
| 23 | + %span= user.bio |
app/views/users/show.html.haml
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | %i.icon-edit | 9 | %i.icon-edit |
| 10 | Edit Profile | 10 | Edit Profile |
| 11 | %br | 11 | %br |
| 12 | - %small @#{@user.username} | 12 | + %small #{@user.username} |
| 13 | %br | 13 | %br |
| 14 | %small member since #{@user.created_at.stamp("Nov 12, 2031")} | 14 | %small member since #{@user.created_at.stamp("Nov 12, 2031")} |
| 15 | .clearfix | 15 | .clearfix |
features/project/team_management.feature
| @@ -23,13 +23,8 @@ Feature: Project Team management | @@ -23,13 +23,8 @@ Feature: Project Team management | ||
| 23 | Then I visit project "Shop" team page | 23 | Then I visit project "Shop" team page |
| 24 | And I should see "Sam" in team list as "Reporter" | 24 | And I should see "Sam" in team list as "Reporter" |
| 25 | 25 | ||
| 26 | - Scenario: View team member profile | ||
| 27 | - Given I click link "Sam" | ||
| 28 | - Then I should see "Sam" team profile | ||
| 29 | - | ||
| 30 | Scenario: Cancel team member | 26 | Scenario: Cancel team member |
| 31 | - Given I click link "Sam" | ||
| 32 | - And I click link "Remove from team" | 27 | + Given I click cancel link for "Sam" |
| 33 | Then I visit project "Shop" team page | 28 | Then I visit project "Shop" team page |
| 34 | And I should not see "Sam" in team list | 29 | And I should not see "Sam" in team list |
| 35 | 30 |
features/steps/project/project_team_management.rb
| @@ -5,13 +5,13 @@ class ProjectTeamManagement < Spinach::FeatureSteps | @@ -5,13 +5,13 @@ class ProjectTeamManagement < Spinach::FeatureSteps | ||
| 5 | 5 | ||
| 6 | Then 'I should be able to see myself in team' do | 6 | Then 'I should be able to see myself in team' do |
| 7 | page.should have_content(@user.name) | 7 | page.should have_content(@user.name) |
| 8 | - page.should have_content(@user.email) | 8 | + page.should have_content(@user.username) |
| 9 | end | 9 | end |
| 10 | 10 | ||
| 11 | And 'I should see "Sam" in team list' do | 11 | And 'I should see "Sam" in team list' do |
| 12 | user = User.find_by_name("Sam") | 12 | user = User.find_by_name("Sam") |
| 13 | page.should have_content(user.name) | 13 | page.should have_content(user.name) |
| 14 | - page.should have_content(user.email) | 14 | + page.should have_content(user.username) |
| 15 | end | 15 | end |
| 16 | 16 | ||
| 17 | Given 'I click link "New Team Member"' do | 17 | Given 'I click link "New Team Member"' do |
| @@ -52,17 +52,6 @@ class ProjectTeamManagement < Spinach::FeatureSteps | @@ -52,17 +52,6 @@ class ProjectTeamManagement < Spinach::FeatureSteps | ||
| 52 | role_id.should == UsersProject.access_roles["Reporter"].to_s | 52 | role_id.should == UsersProject.access_roles["Reporter"].to_s |
| 53 | end | 53 | end |
| 54 | 54 | ||
| 55 | - Given 'I click link "Sam"' do | ||
| 56 | - first(:link, "Sam").click | ||
| 57 | - end | ||
| 58 | - | ||
| 59 | - Then 'I should see "Sam" team profile' do | ||
| 60 | - user = User.find_by_name("Sam") | ||
| 61 | - page.should have_content(user.name) | ||
| 62 | - page.should have_content(user.email) | ||
| 63 | - page.should have_content("To team list") | ||
| 64 | - end | ||
| 65 | - | ||
| 66 | And 'I click link "Remove from team"' do | 55 | And 'I click link "Remove from team"' do |
| 67 | click_link "Remove from team" | 56 | click_link "Remove from team" |
| 68 | end | 57 | end |
| @@ -70,7 +59,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps | @@ -70,7 +59,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps | ||
| 70 | And 'I should not see "Sam" in team list' do | 59 | And 'I should not see "Sam" in team list' do |
| 71 | user = User.find_by_name("Sam") | 60 | user = User.find_by_name("Sam") |
| 72 | page.should_not have_content(user.name) | 61 | page.should_not have_content(user.name) |
| 73 | - page.should_not have_content(user.email) | 62 | + page.should_not have_content(user.username) |
| 74 | end | 63 | end |
| 75 | 64 | ||
| 76 | And 'gitlab user "Mike"' do | 65 | And 'gitlab user "Mike"' do |
| @@ -106,4 +95,10 @@ class ProjectTeamManagement < Spinach::FeatureSteps | @@ -106,4 +95,10 @@ class ProjectTeamManagement < Spinach::FeatureSteps | ||
| 106 | select 'Website', from: 'source_project_id' | 95 | select 'Website', from: 'source_project_id' |
| 107 | click_button 'Import' | 96 | click_button 'Import' |
| 108 | end | 97 | end |
| 98 | + | ||
| 99 | + step 'I click cancel link for "Sam"' do | ||
| 100 | + within "#user_#{User.find_by_name('Sam').id}" do | ||
| 101 | + click_link('Remove user from team') | ||
| 102 | + end | ||
| 103 | + end | ||
| 109 | end | 104 | end |