summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-03-13 19:16:36 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-03-13 19:16:36 +0200
commitfa9a8c38473a83d2dcc1d015e10a9ff1c020b0d5 (patch)
tree019b6d3a0fd2a61e88c539f0031480d81acb3a43
parent366bc3201329dedb2af5ddc567130b4d8d6832f9 (diff)
downloadgitlab-ce-fa9a8c38473a83d2dcc1d015e10a9ff1c020b0d5.tar.gz
Remove team_member show page -> use user_path instead
-rw-r--r--app/controllers/team_members_controller.rb5
-rw-r--r--app/decorators/commit_decorator.rb9
-rw-r--r--app/helpers/projects_helper.rb12
-rw-r--r--app/views/milestones/show.html.haml2
-rw-r--r--app/views/team_members/_team_member.html.haml9
-rw-r--r--app/views/team_members/show.html.haml59
-rw-r--r--app/views/teams/members/_show.html.haml2
-rw-r--r--app/views/teams/members/new.html.haml2
-rw-r--r--app/views/teams/members/show.html.haml60
-rw-r--r--app/views/users/_profile.html.haml20
-rw-r--r--app/views/users/show.html.haml2
-rw-r--r--features/project/team_management.feature7
-rw-r--r--features/steps/project/project_team_management.rb23
13 files changed, 34 insertions, 178 deletions
diff --git a/app/controllers/team_members_controller.rb b/app/controllers/team_members_controller.rb
index 04348dc7977..7de5a68d55a 100644
--- a/app/controllers/team_members_controller.rb
+++ b/app/controllers/team_members_controller.rb
@@ -11,11 +11,6 @@ class TeamMembersController < ProjectResourceController
@assigned_teams = @project.user_team_project_relationships
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
@user_project_relation = project.users_projects.new
end
diff --git a/app/decorators/commit_decorator.rb b/app/decorators/commit_decorator.rb
index a066b2e4a26..0337d8d43ce 100644
--- a/app/decorators/commit_decorator.rb
+++ b/app/decorators/commit_decorator.rb
@@ -81,12 +81,13 @@ class CommitDecorator < ApplicationDecorator
else
source_name
end
- team_member = @project.try(:team_member_by_name_or_email, source_name, source_email)
- if team_member.nil?
- h.mail_to source_email, text.html_safe, class: "commit-#{options[:source]}-link"
+ user = User.where('name like ? or email like ?', source_name, source_email).first
+
+ if user.nil?
+ h.mail_to(source_email, text.html_safe, class: "commit-#{options[:source]}-link")
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
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 2c7984c071e..e6427ea84c0 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -32,17 +32,7 @@ module ProjectsHelper
author_html = author_html.html_safe
- tm = project.team_member_by_id(author)
-
- 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)
+ link_to(author_html, user_path(author), class: "author_link").html_safe
end
def project_title project
diff --git a/app/views/milestones/show.html.haml b/app/views/milestones/show.html.haml
index c2b09542246..95874ae8f34 100644
--- a/app/views/milestones/show.html.haml
+++ b/app/views/milestones/show.html.haml
@@ -87,7 +87,7 @@
%h6 Participants:
%div
- @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.name
diff --git a/app/views/team_members/_team_member.html.haml b/app/views/team_members/_team_member.html.haml
index e0485f408bc..2b0709beb92 100644
--- a/app/views/team_members/_team_member.html.haml
+++ b/app/views/team_members/_team_member.html.haml
@@ -3,12 +3,11 @@
%li{id: dom_id(user), class: "team_member_row user_#{user.id}"}
.row
.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
+ = link_to user, title: user.name, class: "dark" do
+ = image_tag gravatar_icon(user.email, 32), class: "avatar s32"
%strong= truncate(user.name, lenght: 40)
%br
- %small.cgray= user.email
+ %small.cgray= user.username
.span4.pull-right
- if allow_admin
@@ -23,6 +22,6 @@
- elsif user.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
+ = 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
diff --git a/app/views/team_members/show.html.haml b/app/views/team_members/show.html.haml
deleted file mode 100644
index 192948eff7d..00000000000
--- a/app/views/team_members/show.html.haml
+++ /dev/null
@@ -1,59 +0,0 @@
-- 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();
- });
- })
-
diff --git a/app/views/teams/members/_show.html.haml b/app/views/teams/members/_show.html.haml
index 59758109036..1a323043d09 100644
--- a/app/views/teams/members/_show.html.haml
+++ b/app/views/teams/members/_show.html.haml
@@ -8,7 +8,7 @@
= link_to user_path(user.username), title: user.name, class: "dark" do
%strong= truncate(user.name, lenght: 40)
%br
- %small.cgray= user.email
+ %small.cgray= user.username
.span4
- if allow_admin
diff --git a/app/views/teams/members/new.html.haml b/app/views/teams/members/new.html.haml
index 083e137e0ae..fd948d0cb86 100644
--- a/app/views/teams/members/new.html.haml
+++ b/app/views/teams/members/new.html.haml
@@ -15,7 +15,7 @@
%tr.member
%td
= member.name
- %small= "(#{member.email})"
+ %small= "(#{member.username})"
%td= @team.human_default_projects_access(member)
%td= @team.admin?(member) ? "Admin" : "Member"
%td
diff --git a/app/views/teams/members/show.html.haml b/app/views/teams/members/show.html.haml
deleted file mode 100644
index f760c2dae3a..00000000000
--- a/app/views/teams/members/show.html.haml
+++ /dev/null
@@ -1,60 +0,0 @@
-- 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();
- });
- })
-
diff --git a/app/views/users/_profile.html.haml b/app/views/users/_profile.html.haml
index de08bc46e70..fba3660bfd3 100644
--- a/app/views/users/_profile.html.haml
+++ b/app/views/users/_profile.html.haml
@@ -3,21 +3,21 @@
Profile
%ul.well-list
%li
- %strong Email
- %span.pull-right= mail_to user.email
+ %span.light Member since
+ %strong= user.created_at.stamp("Aug 21, 2011")
- unless user.skype.blank?
%li
- %strong Skype
- %span.pull-right= user.skype
+ %span.light Skype:
+ %strong= user.skype
- unless user.linkedin.blank?
%li
- %strong LinkedIn
- %span.pull-right= user.linkedin
+ %span.light LinkedIn:
+ %strong= user.linkedin
- unless user.twitter.blank?
%li
- %strong Twitter
- %span.pull-right= user.twitter
+ %span.light Twitter:
+ %strong= user.twitter
- unless user.bio.blank?
%li
- %strong Bio
- %span.pull-right= user.bio
+ %span.light Bio:
+ %span= user.bio
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index 9341737a5ee..10bd90b166a 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -9,7 +9,7 @@
%i.icon-edit
Edit Profile
%br
- %small @#{@user.username}
+ %small #{@user.username}
%br
%small member since #{@user.created_at.stamp("Nov 12, 2031")}
.clearfix
diff --git a/features/project/team_management.feature b/features/project/team_management.feature
index 0ac37620b4e..d106a543e80 100644
--- a/features/project/team_management.feature
+++ b/features/project/team_management.feature
@@ -23,13 +23,8 @@ Feature: Project Team management
Then I visit project "Shop" team page
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
- Given I click link "Sam"
- And I click link "Remove from team"
+ Given I click cancel link for "Sam"
Then I visit project "Shop" team page
And I should not see "Sam" in team list
diff --git a/features/steps/project/project_team_management.rb b/features/steps/project/project_team_management.rb
index 435894134b0..fb7666bc994 100644
--- a/features/steps/project/project_team_management.rb
+++ b/features/steps/project/project_team_management.rb
@@ -5,13 +5,13 @@ class ProjectTeamManagement < Spinach::FeatureSteps
Then 'I should be able to see myself in team' do
page.should have_content(@user.name)
- page.should have_content(@user.email)
+ page.should have_content(@user.username)
end
And 'I should see "Sam" in team list' do
user = User.find_by_name("Sam")
page.should have_content(user.name)
- page.should have_content(user.email)
+ page.should have_content(user.username)
end
Given 'I click link "New Team Member"' do
@@ -52,17 +52,6 @@ class ProjectTeamManagement < Spinach::FeatureSteps
role_id.should == UsersProject.access_roles["Reporter"].to_s
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
click_link "Remove from team"
end
@@ -70,7 +59,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps
And 'I should not see "Sam" in team list' do
user = User.find_by_name("Sam")
page.should_not have_content(user.name)
- page.should_not have_content(user.email)
+ page.should_not have_content(user.username)
end
And 'gitlab user "Mike"' do
@@ -106,4 +95,10 @@ class ProjectTeamManagement < Spinach::FeatureSteps
select 'Website', from: 'source_project_id'
click_button 'Import'
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