From 95bd93fe1aad3efbe2c8cc7b255a98ddb27d2d35 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sun, 16 Sep 2012 09:21:20 -0400 Subject: [PATCH] Remove Projects#team action --- app/controllers/team_members_controller.rb | 6 +++--- app/helpers/application_helper.rb | 2 +- app/helpers/tab_helper.rb | 2 +- app/views/projects/_project_head.html.haml | 4 ++-- app/views/projects/_team.html.haml | 18 ------------------ app/views/projects/team.html.haml | 15 --------------- app/views/team_members/_form.html.haml | 2 +- app/views/team_members/_team.html.haml | 18 ++++++++++++++++++ app/views/team_members/index.html.haml | 13 +++++++++++++ app/views/team_members/show.html.haml | 2 +- config/routes.rb | 2 +- features/steps/shared/paths.rb | 2 +- spec/routing/routing_spec.rb | 5 ----- 13 files changed, 42 insertions(+), 49 deletions(-) delete mode 100644 app/views/projects/_team.html.haml delete mode 100644 app/views/projects/team.html.haml create mode 100644 app/views/team_members/_team.html.haml create mode 100644 app/views/team_members/index.html.haml diff --git a/app/controllers/team_members_controller.rb b/app/controllers/team_members_controller.rb index 606cb97..27f40b5 100644 --- a/app/controllers/team_members_controller.rb +++ b/app/controllers/team_members_controller.rb @@ -22,7 +22,7 @@ class TeamMembersController < ApplicationController params[:project_access] ) - redirect_to team_project_path(@project) + redirect_to project_team_index_path(@project) end def update @@ -32,7 +32,7 @@ class TeamMembersController < ApplicationController unless @team_member.valid? flash[:alert] = "User should have at least one role" end - redirect_to team_project_path(@project) + redirect_to project_team_index_path(@project) end def destroy @@ -40,7 +40,7 @@ class TeamMembersController < ApplicationController @team_member.destroy respond_to do |format| - format.html { redirect_to team_project_path(@project) } + format.html { redirect_to project_team_index_path(@project) } format.js { render nothing: true } end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3e43584..0938dc2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -62,7 +62,7 @@ module ApplicationHelper { label: "#{@project.name} / Wall", url: wall_project_path(@project) }, { label: "#{@project.name} / Tree", url: tree_project_ref_path(@project, @project.root_ref) }, { label: "#{@project.name} / Commits", url: project_commits_path(@project) }, - { label: "#{@project.name} / Team", url: team_project_path(@project) } + { label: "#{@project.name} / Team", url: project_team_index_path(@project) } ] end diff --git a/app/helpers/tab_helper.rb b/app/helpers/tab_helper.rb index 1740864..b5d7ccb 100644 --- a/app/helpers/tab_helper.rb +++ b/app/helpers/tab_helper.rb @@ -8,7 +8,7 @@ module TabHelper end def project_tab_class - [:show, :files, :team, :edit, :update].each do |action| + [:show, :files, :edit, :update].each do |action| return "current" if current_page?(controller: "projects", action: action, id: @project) end diff --git a/app/views/projects/_project_head.html.haml b/app/views/projects/_project_head.html.haml index ba64ee7..4f38bef 100644 --- a/app/views/projects/_project_head.html.haml +++ b/app/views/projects/_project_head.html.haml @@ -3,8 +3,8 @@ = link_to project_path(@project), class: "activities-tab tab" do %i.icon-home Show - %li{ class: " #{'active' if (controller.controller_name == "team_members") || current_page?(team_project_path(@project)) }" } - = link_to team_project_path(@project), class: "team-tab tab" do + %li{ class: " #{'active' if (controller.controller_name == "team_members") || current_page?(project_team_index_path(@project)) }" } + = link_to project_team_index_path(@project), class: "team-tab tab" do %i.icon-user Team %li{ class: "#{'active' if current_page?(files_project_path(@project)) }" } diff --git a/app/views/projects/_team.html.haml b/app/views/projects/_team.html.haml deleted file mode 100644 index a0c88b5..0000000 --- a/app/views/projects/_team.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -- grouper_project_members(@project).each do |access, members| - %table - %thead - %tr - %th.span7 - = Project.access_options.key(access).pluralize - %th - %tbody - - members.each do |up| - = render(partial: 'team_members/show', locals: {member: up}) - - -:javascript - $(function(){ - $('.repo-access-select, .project-access-select').live("change", function() { - $(this.form).submit(); - }); - }) diff --git a/app/views/projects/team.html.haml b/app/views/projects/team.html.haml deleted file mode 100644 index e8a825c..0000000 --- a/app/views/projects/team.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -= render "project_head" -%h3.page_title - Team Members - %small (#{@project.users_projects.count}) - -- if can? current_user, :admin_team_member, @project - %p.slead - = link_to new_project_team_member_path(@project), class: "btn small right", title: "New Team Member" do - New Team Member - Read more about project permissions - %strong= link_to "here", help_permissions_path, class: "vlink" - - -= render partial: "team", locals: {project: @project} - diff --git a/app/views/team_members/_form.html.haml b/app/views/team_members/_form.html.haml index 3736bfe..9216713 100644 --- a/app/views/team_members/_form.html.haml +++ b/app/views/team_members/_form.html.haml @@ -20,4 +20,4 @@ .actions = f.submit 'Save', class: "btn save-btn" - = link_to "Cancel", team_project_path(@project), class: "btn cancel-btn" + = link_to "Cancel", project_team_index_path(@project), class: "btn cancel-btn" diff --git a/app/views/team_members/_team.html.haml b/app/views/team_members/_team.html.haml new file mode 100644 index 0000000..a0c88b5 --- /dev/null +++ b/app/views/team_members/_team.html.haml @@ -0,0 +1,18 @@ +- grouper_project_members(@project).each do |access, members| + %table + %thead + %tr + %th.span7 + = Project.access_options.key(access).pluralize + %th + %tbody + - members.each do |up| + = render(partial: 'team_members/show', locals: {member: up}) + + +:javascript + $(function(){ + $('.repo-access-select, .project-access-select').live("change", function() { + $(this.form).submit(); + }); + }) diff --git a/app/views/team_members/index.html.haml b/app/views/team_members/index.html.haml new file mode 100644 index 0000000..b3b7b72 --- /dev/null +++ b/app/views/team_members/index.html.haml @@ -0,0 +1,13 @@ += render "projects/project_head" +%h3.page_title + Team Members + %small (#{@project.users_projects.count}) + +- if can? current_user, :admin_team_member, @project + %p.slead + = link_to new_project_team_member_path(@project), class: "btn small right", title: "New Team Member" do + New Team Member + Read more about project permissions + %strong= link_to "here", help_permissions_path, class: "vlink" + += render partial: "team_members/team", locals: {project: @project} diff --git a/app/views/team_members/show.html.haml b/app/views/team_members/show.html.haml index 3b5c78a..9d03cd2 100644 --- a/app/views/team_members/show.html.haml +++ b/app/views/team_members/show.html.haml @@ -14,7 +14,7 @@ %hr .back_link %br - = link_to team_project_path(@project), class: "" do + = link_to project_team_index_path(@project), class: "" do ← To team list %br .row diff --git a/config/routes.rb b/config/routes.rb index c226a47..cfb9bdb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -90,7 +90,6 @@ Gitlab::Application.routes.draw do # resources :projects, constraints: { id: /[^\/]+/ }, except: [:new, :create, :index], path: "/" do member do - get "team" get "wall" get "graph" get "files" @@ -192,6 +191,7 @@ Gitlab::Application.routes.draw do get :patch end end + resources :team, controller: 'team_members', only: [:index] resources :team_members resources :milestones resources :labels, only: [:index] diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index b0028f9..93ad021 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -98,7 +98,7 @@ module SharedPaths end Then 'I visit project "Shop" team page' do - visit team_project_path(Project.find_by_name("Shop")) + visit project_team_index_path(Project.find_by_name("Shop")) end Then 'I visit project "Shop" wall page' do diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index f69422b..c93fb58 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -227,7 +227,6 @@ end # projects POST /projects(.:format) projects#create # new_project GET /projects/new(.:format) projects#new -# team_project GET /:id/team(.:format) projects#team # wall_project GET /:id/wall(.:format) projects#wall # graph_project GET /:id/graph(.:format) projects#graph # files_project GET /:id/files(.:format) projects#files @@ -244,10 +243,6 @@ describe ProjectsController, "routing" do get("/projects/new").should route_to('projects#new') end - it "to #team" do - get("/gitlabhq/team").should route_to('projects#team', id: 'gitlabhq') - end - it "to #wall" do get("/gitlabhq/wall").should route_to('projects#wall', id: 'gitlabhq') end -- libgit2 0.21.2