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 | 22 | params[:project_access] |
| 23 | 23 | ) |
| 24 | 24 | |
| 25 | - redirect_to team_project_path(@project) | |
| 25 | + redirect_to project_team_index_path(@project) | |
| 26 | 26 | end |
| 27 | 27 | |
| 28 | 28 | def update |
| ... | ... | @@ -32,7 +32,7 @@ class TeamMembersController < ApplicationController |
| 32 | 32 | unless @team_member.valid? |
| 33 | 33 | flash[:alert] = "User should have at least one role" |
| 34 | 34 | end |
| 35 | - redirect_to team_project_path(@project) | |
| 35 | + redirect_to project_team_index_path(@project) | |
| 36 | 36 | end |
| 37 | 37 | |
| 38 | 38 | def destroy |
| ... | ... | @@ -40,7 +40,7 @@ class TeamMembersController < ApplicationController |
| 40 | 40 | @team_member.destroy |
| 41 | 41 | |
| 42 | 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 | 44 | format.js { render nothing: true } |
| 45 | 45 | end |
| 46 | 46 | end | ... | ... |
app/helpers/application_helper.rb
| ... | ... | @@ -62,7 +62,7 @@ module ApplicationHelper |
| 62 | 62 | { label: "#{@project.name} / Wall", url: wall_project_path(@project) }, |
| 63 | 63 | { label: "#{@project.name} / Tree", url: tree_project_ref_path(@project, @project.root_ref) }, |
| 64 | 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 | 67 | end |
| 68 | 68 | ... | ... |
app/helpers/tab_helper.rb
| ... | ... | @@ -8,7 +8,7 @@ module TabHelper |
| 8 | 8 | end |
| 9 | 9 | |
| 10 | 10 | def project_tab_class |
| 11 | - [:show, :files, :team, :edit, :update].each do |action| | |
| 11 | + [:show, :files, :edit, :update].each do |action| | |
| 12 | 12 | return "current" if current_page?(controller: "projects", action: action, id: @project) |
| 13 | 13 | end |
| 14 | 14 | ... | ... |
app/views/projects/_project_head.html.haml
| ... | ... | @@ -3,8 +3,8 @@ |
| 3 | 3 | = link_to project_path(@project), class: "activities-tab tab" do |
| 4 | 4 | %i.icon-home |
| 5 | 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 | 8 | %i.icon-user |
| 9 | 9 | Team |
| 10 | 10 | %li{ class: "#{'active' if current_page?(files_project_path(@project)) }" } | ... | ... |
app/views/projects/_team.html.haml
| ... | ... | @@ -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 | -= 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
| ... | ... | @@ -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 @@ |
| 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 | 90 | # |
| 91 | 91 | resources :projects, constraints: { id: /[^\/]+/ }, except: [:new, :create, :index], path: "/" do |
| 92 | 92 | member do |
| 93 | - get "team" | |
| 94 | 93 | get "wall" |
| 95 | 94 | get "graph" |
| 96 | 95 | get "files" |
| ... | ... | @@ -192,6 +191,7 @@ Gitlab::Application.routes.draw do |
| 192 | 191 | get :patch |
| 193 | 192 | end |
| 194 | 193 | end |
| 194 | + resources :team, controller: 'team_members', only: [:index] | |
| 195 | 195 | resources :team_members |
| 196 | 196 | resources :milestones |
| 197 | 197 | resources :labels, only: [:index] | ... | ... |
features/steps/shared/paths.rb
| ... | ... | @@ -98,7 +98,7 @@ module SharedPaths |
| 98 | 98 | end |
| 99 | 99 | |
| 100 | 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 | 102 | end |
| 103 | 103 | |
| 104 | 104 | Then 'I visit project "Shop" wall page' do | ... | ... |
spec/routing/routing_spec.rb
| ... | ... | @@ -227,7 +227,6 @@ end |
| 227 | 227 | |
| 228 | 228 | # projects POST /projects(.:format) projects#create |
| 229 | 229 | # new_project GET /projects/new(.:format) projects#new |
| 230 | -# team_project GET /:id/team(.:format) projects#team | |
| 231 | 230 | # wall_project GET /:id/wall(.:format) projects#wall |
| 232 | 231 | # graph_project GET /:id/graph(.:format) projects#graph |
| 233 | 232 | # files_project GET /:id/files(.:format) projects#files |
| ... | ... | @@ -244,10 +243,6 @@ describe ProjectsController, "routing" do |
| 244 | 243 | get("/projects/new").should route_to('projects#new') |
| 245 | 244 | end |
| 246 | 245 | |
| 247 | - it "to #team" do | |
| 248 | - get("/gitlabhq/team").should route_to('projects#team', id: 'gitlabhq') | |
| 249 | - end | |
| 250 | - | |
| 251 | 246 | it "to #wall" do |
| 252 | 247 | get("/gitlabhq/wall").should route_to('projects#wall', id: 'gitlabhq') |
| 253 | 248 | end | ... | ... |