Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove team_member show page -> use user_path instead

  • Loading branch information...
commit fa9a8c38473a83d2dcc1d015e10a9ff1c020b0d5 1 parent 366bc32
@randx randx authored
View
5 app/controllers/team_members_controller.rb
@@ -11,11 +11,6 @@ def index
@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
View
9 app/decorators/commit_decorator.rb
@@ -81,12 +81,13 @@ def person_link(options = {})
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
View
12 app/helpers/projects_helper.rb
@@ -32,17 +32,7 @@ def link_to_member(project, author, opts = {})
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
View
2  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
View
9 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
View
59 app/views/team_members/show.html.haml
@@ -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
- ← 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();
- });
- })
-
View
2  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
View
2  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
View
60 app/views/teams/members/show.html.haml
@@ -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
- ← 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();
- });
- })
-
View
20 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
View
2  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
View
7 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
View
23 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
Please sign in to comment.
Something went wrong with that request. Please try again.