diff --git a/app/controllers/stat_graph_controller.rb b/app/controllers/graphs_controller.rb similarity index 87% rename from app/controllers/stat_graph_controller.rb rename to app/controllers/graphs_controller.rb index f076f4726d08ec269b5266670cf499d100639cd8..5ae9c15c0f78fbba0c195528777b8b5a892bd648 100644 --- a/app/controllers/stat_graph_controller.rb +++ b/app/controllers/graphs_controller.rb @@ -1,4 +1,4 @@ -class StatGraphController < ProjectResourceController +class GraphsController < ProjectResourceController # Authorize before_filter :authorize_read_project! before_filter :authorize_code_access! diff --git a/app/controllers/graph_controller.rb b/app/controllers/network_controller.rb similarity index 90% rename from app/controllers/graph_controller.rb rename to app/controllers/network_controller.rb index c79ed5ca3cc095f3ace80ebfdee2ecdb3506b1e9..3c8e747ba4e3461aa289bb5b279f4b2cec6f1493 100644 --- a/app/controllers/graph_controller.rb +++ b/app/controllers/network_controller.rb @@ -1,4 +1,4 @@ -class GraphController < ProjectResourceController +class NetworkController < ProjectResourceController include ExtractsPath include ApplicationHelper diff --git a/app/controllers/refs_controller.rb b/app/controllers/refs_controller.rb index e7def3984f89c9d52c952dc3b61a40cdaf39450d..cae9193a1daca86fcf5d76173f932f9aaa15d166 100644 --- a/app/controllers/refs_controller.rb +++ b/app/controllers/refs_controller.rb @@ -14,7 +14,7 @@ class RefsController < ProjectResourceController elsif params[:destination] == "blob" project_blob_path(@project, (@id)) elsif params[:destination] == "graph" - project_graph_path(@project, @id, @options) + project_network_path(@project, @id, @options) else project_commits_path(@project, @id) end diff --git a/app/views/stat_graph/show.html.haml b/app/views/graphs/show.html.haml similarity index 100% rename from app/views/stat_graph/show.html.haml rename to app/views/graphs/show.html.haml diff --git a/app/views/stat_graph/show.js.haml b/app/views/graphs/show.js.haml similarity index 100% rename from app/views/stat_graph/show.js.haml rename to app/views/graphs/show.js.haml diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index 399bcf5de2e558026d6d31faace91f2f7e5aa184..1c5781daab01aead5a8895478f037ec1dbc9bfc3 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -9,10 +9,10 @@ = link_to 'Files', project_tree_path(@project, @ref || @repository.root_ref) = nav_link(controller: %w(commit commits compare repositories protected_branches)) do = link_to "Commits", project_commits_path(@project, @ref || @repository.root_ref) - = nav_link(controller: %w(graph)) do - = link_to "Network", project_graph_path(@project, @ref || @repository.root_ref) - = nav_link(controller: %w(stat_graph)) do - = link_to "Graphs", project_stat_graph_path(@project, @ref || @repository.root_ref) + = nav_link(controller: %w(network)) do + = link_to "Network", project_network_path(@project, @ref || @repository.root_ref) + = nav_link(controller: %w(graphs)) do + = link_to "Graphs", project_graph_path(@project, @ref || @repository.root_ref) - if @project.issues_enabled = nav_link(controller: %w(issues milestones labels)) do diff --git a/app/views/graph/_head.html.haml b/app/views/network/_head.html.haml similarity index 86% rename from app/views/graph/_head.html.haml rename to app/views/network/_head.html.haml index 7a5b3c6f43d5799e5da165093f371069af6c4805..62ab8b049ac4a989596405586b3d824fdb301da3 100644 --- a/app/views/graph/_head.html.haml +++ b/app/views/network/_head.html.haml @@ -5,7 +5,7 @@ .pull-left = render partial: 'shared/ref_switcher', locals: {destination: 'graph'} .pull-left - = form_tag project_graph_path(@project, @id), method: :get do |f| + = form_tag project_network_path(@project, @id), method: :get do |f| .control-group = label_tag :filter_ref, "Show only selected ref", class: 'control-label light' .controls @@ -14,7 +14,7 @@ = hidden_field_tag(key, value, id: nil) unless key == "filter_ref" .search.pull-right - = form_tag project_graph_path(@project, @id), method: :get do |f| + = form_tag project_network_path(@project, @id), method: :get do |f| .control-group = label_tag :search , "Looking for commit:", class: 'control-label light' .controls diff --git a/app/views/graph/show.html.haml b/app/views/network/show.html.haml similarity index 84% rename from app/views/graph/show.html.haml rename to app/views/network/show.html.haml index 0ee6648317cc536aa5ff973e2cce5f5d107b2883..a480ceaf9952a9c54666ebda818f5cce61ab66cf 100644 --- a/app/views/graph/show.html.haml +++ b/app/views/network/show.html.haml @@ -11,7 +11,7 @@ $(this).closest('form').submit(); }); branch_graph = new BranchGraph($("#holder"), { - url: '#{project_graph_path(@project, @ref, @options.merge(format: :json))}', + url: '#{project_network_path(@project, @ref, @options.merge(format: :json))}', commit_url: '#{project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")}', ref: '#{@ref}', commit_id: '#{@commit.id}' diff --git a/app/views/graph/show.json.erb b/app/views/network/show.json.erb similarity index 100% rename from app/views/graph/show.json.erb rename to app/views/network/show.json.erb diff --git a/config/routes.rb b/config/routes.rb index c555cd0b361c379744733663b31419b49fa2276a..a50f78c616bd38e1705cc0cef6d942bfc9345a33 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -190,8 +190,8 @@ Gitlab::Application.routes.draw do resources :commits, only: [:show], constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} resources :compare, only: [:index, :create] resources :blame, only: [:show], constraints: {id: /.+/} - resources :graph, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/} - resources :stat_graph, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/} + resources :network, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/} + resources :graphs, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/} match "/compare/:from...:to" => "compare#show", as: "compare", via: [:get, :post], constraints: {from: /.+/, to: /.+/} scope module: :projects do diff --git a/features/steps/project/project_graph.rb b/features/steps/project/project_graph.rb index 489485b1dc4f8b708c590b7354bb7698a4079d3c..50942b3cbb3210017aed126f7896c7405e2a17e4 100644 --- a/features/steps/project/project_graph.rb +++ b/features/steps/project/project_graph.rb @@ -8,6 +8,6 @@ class ProjectGraph < Spinach::FeatureSteps When 'I visit project "Shop" graph page' do project = Project.find_by_name("Shop") - visit project_stat_graph_path(project, "master") + visit project_graph_path(project, "master") end end diff --git a/features/steps/project/project_network_graph.rb b/features/steps/project/project_network_graph.rb index 48a73f09face8c48b69be810673510edb3588ef5..f001c0beb9abb36a35cda5d98c7831376c3aa2ee 100644 --- a/features/steps/project/project_network_graph.rb +++ b/features/steps/project/project_network_graph.rb @@ -12,7 +12,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps Network::Graph.stub(max_count: 10) project = Project.find_by_name("Shop") - visit project_graph_path(project, "master") + visit project_network_path(project, "master") end And 'page should select "master" in select box' do diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index 3641e78866298661f9a49768c11f50bb0339c1a9..21b6159bce33010c95cd6a9e40a7ff1676114daa 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -149,7 +149,7 @@ module SharedPaths # Stub Graph max_size to speed up test (10 commits vs. 650) Network::Graph.stub(max_count: 10) - visit project_graph_path(@project, root_ref) + visit project_network_path(@project, root_ref) end step "I visit my project's issues page" do diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 94f9480a4d03fb7e31c5eb5c890ac1e698e4f3a5..a1d4bd6a4cd36e5fd9ab33313716bc19376d9cbd 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -446,9 +446,15 @@ describe CompareController, "routing" do end end -describe GraphController, "routing" do +describe NetworkController, "routing" do it "to #show" do - get("/gitlabhq/graph/master").should route_to('graph#show', project_id: 'gitlabhq', id: 'master') - get("/gitlabhq/graph/master.json").should route_to('graph#show', project_id: 'gitlabhq', id: 'master', format: "json") + get("/gitlabhq/network/master").should route_to('network#show', project_id: 'gitlabhq', id: 'master') + get("/gitlabhq/network/master.json").should route_to('network#show', project_id: 'gitlabhq', id: 'master', format: "json") + end +end + +describe GraphsController, "routing" do + it "to #show" do + get("/gitlabhq/graphs/master").should route_to('graphs#show', project_id: 'gitlabhq', id: 'master') end end