Commit fa9a8c38 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Remove team_member show page -> use user_path instead

parent 366bc320
...@@ -11,11 +11,6 @@ class TeamMembersController < ProjectResourceController ...@@ -11,11 +11,6 @@ class TeamMembersController < ProjectResourceController
@assigned_teams = @project.user_team_project_relationships @assigned_teams = @project.user_team_project_relationships
end end
def show
@user_project_relation = project.users_projects.find_by_user_id(member)
@events = member.recent_events.in_projects(project).limit(7)
end
def new def new
@user_project_relation = project.users_projects.new @user_project_relation = project.users_projects.new
end end
......
...@@ -81,12 +81,13 @@ class CommitDecorator < ApplicationDecorator ...@@ -81,12 +81,13 @@ class CommitDecorator < ApplicationDecorator
else else
source_name source_name
end end
team_member = @project.try(:team_member_by_name_or_email, source_name, source_email)
if team_member.nil? user = User.where('name like ? or email like ?', source_name, source_email).first
h.mail_to source_email, text.html_safe, class: "commit-#{options[:source]}-link"
if user.nil?
h.mail_to(source_email, text.html_safe, class: "commit-#{options[:source]}-link")
else else
h.link_to text, h.project_team_member_path(@project, team_member), class: "commit-#{options[:source]}-link" h.link_to(text.html_safe, h.user_path(user), class: "commit-#{options[:source]}-link")
end end
end end
end end
...@@ -32,17 +32,7 @@ module ProjectsHelper ...@@ -32,17 +32,7 @@ module ProjectsHelper
author_html = author_html.html_safe author_html = author_html.html_safe
tm = project.team_member_by_id(author) link_to(author_html, user_path(author), class: "author_link").html_safe
if tm
link_to author_html, project_team_member_path(project, tm.user_username), class: "author_link"
else
author_html
end.html_safe
end
def tm_path team_member
project_team_member_path(@project, team_member)
end end
def project_title project def project_title project
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
%h6 Participants: %h6 Participants:
%div %div
- @users.each do |user| - @users.each do |user|
= link_to tm_path(user.tm_of(@project)), class: 'float-link' do = link_to user, class: 'float-link' do
= user.avatar_image = user.avatar_image
= user.name = user.name
......
...@@ -3,12 +3,11 @@ ...@@ -3,12 +3,11 @@
%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
.span4 .span4
= link_to project_team_member_path(@project, user), title: user.name, class: "dark" do = link_to user, title: user.name, class: "dark" do
= image_tag gravatar_icon(user.email, 40), class: "avatar s32" = image_tag gravatar_icon(user.email, 32), class: "avatar s32"
= link_to project_team_member_path(@project, user), title: user.name, class: "dark" do
%strong= truncate(user.name, lenght: 40) %strong= truncate(user.name, lenght: 40)
%br %br
%small.cgray= user.email %small.cgray= user.username
.span4.pull-right .span4.pull-right
- if allow_admin - if allow_admin
...@@ -23,6 +22,6 @@ ...@@ -23,6 +22,6 @@
- elsif user.blocked? - elsif user.blocked?
%span.label 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", title: 'Remove user from team' do
%i.icon-minus.icon-white %i.icon-minus.icon-white
- allow_admin = can? current_user, :admin_project, @project
.team_member_show
- if can? current_user, :admin_project, @project
= link_to 'Remove from team', project_team_member_path(@project, @member), confirm: 'Are you sure?', method: :delete, class: "btn btn-remove pull-right"
.profile_avatar_holder
= image_tag gravatar_icon(@member.email, 60), class: "borders"
%h3.page_title
= @member.name
%small (@#{@member.username})
%hr
.back_link
%br
= link_to project_team_index_path(@project), class: "" do
&larr; To team list
%br
.row
.span6
%table.lite
%tr
%td Email
%td= mail_to @member.email
%tr
%td Skype
%td= @member.skype
- unless @member.linkedin.blank?
%tr
%td LinkedIn
%td= @member.linkedin
- unless @member.twitter.blank?
%tr
%td Twitter
%td= @member.twitter
- unless @member.bio.blank?
%tr
%td Bio
%td= @member.bio
.span6
%table.lite
%tr
%td Member since
%td= @user_project_relation.created_at.stamp("Aug 21, 2011")
%tr
%td
Project Access:
%small (#{link_to "read more", help_permissions_path, class: "vlink"})
%td
= form_for(@user_project_relation, as: :team_member, url: project_team_member_path(@project, @member)) do |f|
= f.select :project_access, options_for_select(Project.access_options, @user_project_relation.project_access), {}, class: "project-access-select", disabled: !allow_admin
%hr
= render @events
:javascript
$(function(){
$('.repo-access-select, .project-access-select').live("change", function() {
$(this.form).submit();
});
})
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
= link_to user_path(user.username), title: user.name, class: "dark" do = link_to user_path(user.username), title: user.name, class: "dark" do
%strong= truncate(user.name, lenght: 40) %strong= truncate(user.name, lenght: 40)
%br %br
%small.cgray= user.email %small.cgray= user.username
.span4 .span4
- if allow_admin - if allow_admin
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
%tr.member %tr.member
%td %td
= member.name = member.name
%small= "(#{member.email})" %small= "(#{member.username})"
%td= @team.human_default_projects_access(member) %td= @team.human_default_projects_access(member)
%td= @team.admin?(member) ? "Admin" : "Member" %td= @team.admin?(member) ? "Admin" : "Member"
%td %td
......
- allow_admin = can? current_user, :admin_project, @project
- user = @team_member.user
.team_member_show
- if can? current_user, :admin_project, @project
= 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"
.profile_avatar_holder
= image_tag gravatar_icon(user.email, 60), class: "borders"
%h3.page_title
= user.name
%small (@#{user.username})
%hr
.back_link
%br
= link_to project_team_index_path(@project), class: "" do
&larr; To team list
%br
.row
.span6
%table.lite
%tr
%td Email
%td= mail_to user.email
%tr
%td Skype
%td= user.skype
- unless user.linkedin.blank?
%tr
%td LinkedIn
%td= user.linkedin
- unless user.twitter.blank?
%tr
%td Twitter
%td= user.twitter
- unless user.bio.blank?
%tr
%td Bio
%td= user.bio
.span6
%table.lite
%tr
%td Member since
%td= @team_member.created_at.stamp("Aug 21, 2011")
%tr
%td
Project Access:
%small (#{link_to "read more", help_permissions_path, class: "vlink"})
%td
= form_for(@team_member, as: :team_member, url: project_team_member_path(@project, @team_member)) do |f|
= f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, class: "project-access-select", disabled: !allow_admin
%hr
= render @events
:javascript
$(function(){
$('.repo-access-select, .project-access-select').live("change", function() {
$(this.form).submit();
});
})
...@@ -3,21 +3,21 @@ ...@@ -3,21 +3,21 @@
Profile Profile
%ul.well-list %ul.well-list
%li %li
%strong Email %span.light Member since
%span.pull-right= mail_to user.email %strong= user.created_at.stamp("Aug 21, 2011")
- unless user.skype.blank? - unless user.skype.blank?
%li %li
%strong Skype %span.light Skype:
%span.pull-right= user.skype %strong= user.skype
- unless user.linkedin.blank? - unless user.linkedin.blank?
%li %li
%strong LinkedIn %span.light LinkedIn:
%span.pull-right= user.linkedin %strong= user.linkedin
- unless user.twitter.blank? - unless user.twitter.blank?
%li %li
%strong Twitter %span.light Twitter:
%span.pull-right= user.twitter %strong= user.twitter
- unless user.bio.blank? - unless user.bio.blank?
%li %li
%strong Bio %span.light Bio:
%span.pull-right= user.bio %span= user.bio
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
%i.icon-edit %i.icon-edit
Edit Profile Edit Profile
%br %br
%small @#{@user.username} %small #{@user.username}
%br %br
%small member since #{@user.created_at.stamp("Nov 12, 2031")} %small member since #{@user.created_at.stamp("Nov 12, 2031")}
.clearfix .clearfix
......
...@@ -23,13 +23,8 @@ Feature: Project Team management ...@@ -23,13 +23,8 @@ Feature: Project Team management
Then I visit project "Shop" team page Then I visit project "Shop" team page
And I should see "Sam" in team list as "Reporter" And I should see "Sam" in team list as "Reporter"
Scenario: View team member profile
Given I click link "Sam"
Then I should see "Sam" team profile
Scenario: Cancel team member Scenario: Cancel team member
Given I click link "Sam" Given I click cancel link for "Sam"
And I click link "Remove from team"
Then I visit project "Shop" team page Then I visit project "Shop" team page
And I should not see "Sam" in team list And I should not see "Sam" in team list
......
...@@ -5,13 +5,13 @@ class ProjectTeamManagement < Spinach::FeatureSteps ...@@ -5,13 +5,13 @@ class ProjectTeamManagement < Spinach::FeatureSteps
Then 'I should be able to see myself in team' do Then 'I should be able to see myself in team' do
page.should have_content(@user.name) page.should have_content(@user.name)
page.should have_content(@user.email) page.should have_content(@user.username)
end end
And 'I should see "Sam" in team list' do And 'I should see "Sam" in team list' do
user = User.find_by_name("Sam") user = User.find_by_name("Sam")
page.should have_content(user.name) page.should have_content(user.name)
page.should have_content(user.email) page.should have_content(user.username)
end end
Given 'I click link "New Team Member"' do Given 'I click link "New Team Member"' do
...@@ -52,17 +52,6 @@ class ProjectTeamManagement < Spinach::FeatureSteps ...@@ -52,17 +52,6 @@ class ProjectTeamManagement < Spinach::FeatureSteps
role_id.should == UsersProject.access_roles["Reporter"].to_s role_id.should == UsersProject.access_roles["Reporter"].to_s
end end
Given 'I click link "Sam"' do
first(:link, "Sam").click
end
Then 'I should see "Sam" team profile' do
user = User.find_by_name("Sam")
page.should have_content(user.name)
page.should have_content(user.email)
page.should have_content("To team list")
end
And 'I click link "Remove from team"' do And 'I click link "Remove from team"' do
click_link "Remove from team" click_link "Remove from team"
end end
...@@ -70,7 +59,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps ...@@ -70,7 +59,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps
And 'I should not see "Sam" in team list' do And 'I should not see "Sam" in team list' do
user = User.find_by_name("Sam") user = User.find_by_name("Sam")
page.should_not have_content(user.name) page.should_not have_content(user.name)
page.should_not have_content(user.email) page.should_not have_content(user.username)
end end
And 'gitlab user "Mike"' do And 'gitlab user "Mike"' do
...@@ -106,4 +95,10 @@ class ProjectTeamManagement < Spinach::FeatureSteps ...@@ -106,4 +95,10 @@ class ProjectTeamManagement < Spinach::FeatureSteps
select 'Website', from: 'source_project_id' select 'Website', from: 'source_project_id'
click_button 'Import' click_button 'Import'
end end
step 'I click cancel link for "Sam"' do
within "#user_#{User.find_by_name('Sam').id}" do
click_link('Remove user from team')
end
end
end end
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