Commit 95bd93fe1aad3efbe2c8cc7b255a98ddb27d2d35
1 parent
8cfb197d
Exists in
master
and in
4 other branches
Remove Projects#team action
Uses TeamMembers#index instead, to be more RESTful
Showing
13 changed files
with
42 additions
and
49 deletions
Show diff stats
app/controllers/team_members_controller.rb
@@ -22,7 +22,7 @@ class TeamMembersController < ApplicationController | @@ -22,7 +22,7 @@ class TeamMembersController < ApplicationController | ||
22 | params[:project_access] | 22 | params[:project_access] |
23 | ) | 23 | ) |
24 | 24 | ||
25 | - redirect_to team_project_path(@project) | 25 | + redirect_to project_team_index_path(@project) |
26 | end | 26 | end |
27 | 27 | ||
28 | def update | 28 | def update |
@@ -32,7 +32,7 @@ class TeamMembersController < ApplicationController | @@ -32,7 +32,7 @@ class TeamMembersController < ApplicationController | ||
32 | unless @team_member.valid? | 32 | unless @team_member.valid? |
33 | flash[:alert] = "User should have at least one role" | 33 | flash[:alert] = "User should have at least one role" |
34 | end | 34 | end |
35 | - redirect_to team_project_path(@project) | 35 | + redirect_to project_team_index_path(@project) |
36 | end | 36 | end |
37 | 37 | ||
38 | def destroy | 38 | def destroy |
@@ -40,7 +40,7 @@ class TeamMembersController < ApplicationController | @@ -40,7 +40,7 @@ class TeamMembersController < ApplicationController | ||
40 | @team_member.destroy | 40 | @team_member.destroy |
41 | 41 | ||
42 | respond_to do |format| | 42 | respond_to do |format| |
43 | - format.html { redirect_to team_project_path(@project) } | 43 | + format.html { redirect_to project_team_index_path(@project) } |
44 | format.js { render nothing: true } | 44 | format.js { render nothing: true } |
45 | end | 45 | end |
46 | end | 46 | end |
app/helpers/application_helper.rb
@@ -62,7 +62,7 @@ module ApplicationHelper | @@ -62,7 +62,7 @@ module ApplicationHelper | ||
62 | { label: "#{@project.name} / Wall", url: wall_project_path(@project) }, | 62 | { label: "#{@project.name} / Wall", url: wall_project_path(@project) }, |
63 | { label: "#{@project.name} / Tree", url: tree_project_ref_path(@project, @project.root_ref) }, | 63 | { label: "#{@project.name} / Tree", url: tree_project_ref_path(@project, @project.root_ref) }, |
64 | { label: "#{@project.name} / Commits", url: project_commits_path(@project) }, | 64 | { label: "#{@project.name} / Commits", url: project_commits_path(@project) }, |
65 | - { label: "#{@project.name} / Team", url: team_project_path(@project) } | 65 | + { label: "#{@project.name} / Team", url: project_team_index_path(@project) } |
66 | ] | 66 | ] |
67 | end | 67 | end |
68 | 68 |
app/helpers/tab_helper.rb
@@ -8,7 +8,7 @@ module TabHelper | @@ -8,7 +8,7 @@ module TabHelper | ||
8 | end | 8 | end |
9 | 9 | ||
10 | def project_tab_class | 10 | def project_tab_class |
11 | - [:show, :files, :team, :edit, :update].each do |action| | 11 | + [:show, :files, :edit, :update].each do |action| |
12 | return "current" if current_page?(controller: "projects", action: action, id: @project) | 12 | return "current" if current_page?(controller: "projects", action: action, id: @project) |
13 | end | 13 | end |
14 | 14 |
app/views/projects/_project_head.html.haml
@@ -3,8 +3,8 @@ | @@ -3,8 +3,8 @@ | ||
3 | = link_to project_path(@project), class: "activities-tab tab" do | 3 | = link_to project_path(@project), class: "activities-tab tab" do |
4 | %i.icon-home | 4 | %i.icon-home |
5 | Show | 5 | Show |
6 | - %li{ class: " #{'active' if (controller.controller_name == "team_members") || current_page?(team_project_path(@project)) }" } | ||
7 | - = link_to team_project_path(@project), class: "team-tab tab" do | 6 | + %li{ class: " #{'active' if (controller.controller_name == "team_members") || current_page?(project_team_index_path(@project)) }" } |
7 | + = link_to project_team_index_path(@project), class: "team-tab tab" do | ||
8 | %i.icon-user | 8 | %i.icon-user |
9 | Team | 9 | Team |
10 | %li{ class: "#{'active' if current_page?(files_project_path(@project)) }" } | 10 | %li{ class: "#{'active' if current_page?(files_project_path(@project)) }" } |
app/views/projects/_team.html.haml
@@ -1,18 +0,0 @@ | @@ -1,18 +0,0 @@ | ||
1 | -- grouper_project_members(@project).each do |access, members| | ||
2 | - %table | ||
3 | - %thead | ||
4 | - %tr | ||
5 | - %th.span7 | ||
6 | - = Project.access_options.key(access).pluralize | ||
7 | - %th | ||
8 | - %tbody | ||
9 | - - members.each do |up| | ||
10 | - = render(partial: 'team_members/show', locals: {member: up}) | ||
11 | - | ||
12 | - | ||
13 | -:javascript | ||
14 | - $(function(){ | ||
15 | - $('.repo-access-select, .project-access-select').live("change", function() { | ||
16 | - $(this.form).submit(); | ||
17 | - }); | ||
18 | - }) |
app/views/projects/team.html.haml
@@ -1,15 +0,0 @@ | @@ -1,15 +0,0 @@ | ||
1 | -= render "project_head" | ||
2 | -%h3.page_title | ||
3 | - Team Members | ||
4 | - %small (#{@project.users_projects.count}) | ||
5 | - | ||
6 | -- if can? current_user, :admin_team_member, @project | ||
7 | - %p.slead | ||
8 | - = link_to new_project_team_member_path(@project), class: "btn small right", title: "New Team Member" do | ||
9 | - New Team Member | ||
10 | - Read more about project permissions | ||
11 | - %strong= link_to "here", help_permissions_path, class: "vlink" | ||
12 | - | ||
13 | - | ||
14 | -= render partial: "team", locals: {project: @project} | ||
15 | - |
app/views/team_members/_form.html.haml
@@ -20,4 +20,4 @@ | @@ -20,4 +20,4 @@ | ||
20 | 20 | ||
21 | .actions | 21 | .actions |
22 | = f.submit 'Save', class: "btn save-btn" | 22 | = f.submit 'Save', class: "btn save-btn" |
23 | - = link_to "Cancel", team_project_path(@project), class: "btn cancel-btn" | 23 | + = link_to "Cancel", project_team_index_path(@project), class: "btn cancel-btn" |
@@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
1 | +- grouper_project_members(@project).each do |access, members| | ||
2 | + %table | ||
3 | + %thead | ||
4 | + %tr | ||
5 | + %th.span7 | ||
6 | + = Project.access_options.key(access).pluralize | ||
7 | + %th | ||
8 | + %tbody | ||
9 | + - members.each do |up| | ||
10 | + = render(partial: 'team_members/show', locals: {member: up}) | ||
11 | + | ||
12 | + | ||
13 | +:javascript | ||
14 | + $(function(){ | ||
15 | + $('.repo-access-select, .project-access-select').live("change", function() { | ||
16 | + $(this.form).submit(); | ||
17 | + }); | ||
18 | + }) |
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | += render "projects/project_head" | ||
2 | +%h3.page_title | ||
3 | + Team Members | ||
4 | + %small (#{@project.users_projects.count}) | ||
5 | + | ||
6 | +- if can? current_user, :admin_team_member, @project | ||
7 | + %p.slead | ||
8 | + = link_to new_project_team_member_path(@project), class: "btn small right", title: "New Team Member" do | ||
9 | + New Team Member | ||
10 | + Read more about project permissions | ||
11 | + %strong= link_to "here", help_permissions_path, class: "vlink" | ||
12 | + | ||
13 | += render partial: "team_members/team", locals: {project: @project} |
app/views/team_members/show.html.haml
config/routes.rb
@@ -90,7 +90,6 @@ Gitlab::Application.routes.draw do | @@ -90,7 +90,6 @@ Gitlab::Application.routes.draw do | ||
90 | # | 90 | # |
91 | resources :projects, constraints: { id: /[^\/]+/ }, except: [:new, :create, :index], path: "/" do | 91 | resources :projects, constraints: { id: /[^\/]+/ }, except: [:new, :create, :index], path: "/" do |
92 | member do | 92 | member do |
93 | - get "team" | ||
94 | get "wall" | 93 | get "wall" |
95 | get "graph" | 94 | get "graph" |
96 | get "files" | 95 | get "files" |
@@ -192,6 +191,7 @@ Gitlab::Application.routes.draw do | @@ -192,6 +191,7 @@ Gitlab::Application.routes.draw do | ||
192 | get :patch | 191 | get :patch |
193 | end | 192 | end |
194 | end | 193 | end |
194 | + resources :team, controller: 'team_members', only: [:index] | ||
195 | resources :team_members | 195 | resources :team_members |
196 | resources :milestones | 196 | resources :milestones |
197 | resources :labels, only: [:index] | 197 | resources :labels, only: [:index] |
features/steps/shared/paths.rb
@@ -98,7 +98,7 @@ module SharedPaths | @@ -98,7 +98,7 @@ module SharedPaths | ||
98 | end | 98 | end |
99 | 99 | ||
100 | Then 'I visit project "Shop" team page' do | 100 | Then 'I visit project "Shop" team page' do |
101 | - visit team_project_path(Project.find_by_name("Shop")) | 101 | + visit project_team_index_path(Project.find_by_name("Shop")) |
102 | end | 102 | end |
103 | 103 | ||
104 | Then 'I visit project "Shop" wall page' do | 104 | Then 'I visit project "Shop" wall page' do |
spec/routing/routing_spec.rb
@@ -227,7 +227,6 @@ end | @@ -227,7 +227,6 @@ end | ||
227 | 227 | ||
228 | # projects POST /projects(.:format) projects#create | 228 | # projects POST /projects(.:format) projects#create |
229 | # new_project GET /projects/new(.:format) projects#new | 229 | # new_project GET /projects/new(.:format) projects#new |
230 | -# team_project GET /:id/team(.:format) projects#team | ||
231 | # wall_project GET /:id/wall(.:format) projects#wall | 230 | # wall_project GET /:id/wall(.:format) projects#wall |
232 | # graph_project GET /:id/graph(.:format) projects#graph | 231 | # graph_project GET /:id/graph(.:format) projects#graph |
233 | # files_project GET /:id/files(.:format) projects#files | 232 | # files_project GET /:id/files(.:format) projects#files |
@@ -244,10 +243,6 @@ describe ProjectsController, "routing" do | @@ -244,10 +243,6 @@ describe ProjectsController, "routing" do | ||
244 | get("/projects/new").should route_to('projects#new') | 243 | get("/projects/new").should route_to('projects#new') |
245 | end | 244 | end |
246 | 245 | ||
247 | - it "to #team" do | ||
248 | - get("/gitlabhq/team").should route_to('projects#team', id: 'gitlabhq') | ||
249 | - end | ||
250 | - | ||
251 | it "to #wall" do | 246 | it "to #wall" do |
252 | get("/gitlabhq/wall").should route_to('projects#wall', id: 'gitlabhq') | 247 | get("/gitlabhq/wall").should route_to('projects#wall', id: 'gitlabhq') |
253 | end | 248 | end |