Commit 79a02df92e18137787371468be5c8897ad2f97b0
1 parent
e33cbb9b
Exists in
master
and in
4 other branches
Update usages of tree_file_project_ref_path to project_tree_path
Showing
20 changed files
with
41 additions
and
36 deletions
Show diff stats
app/controllers/refs_controller.rb
... | ... | @@ -18,7 +18,7 @@ class RefsController < ApplicationController |
18 | 18 | respond_to do |format| |
19 | 19 | format.html do |
20 | 20 | new_path = if params[:destination] == "tree" |
21 | - tree_project_ref_path(@project, params[:ref]) | |
21 | + project_tree_path(@project, params[:ref]) | |
22 | 22 | else |
23 | 23 | project_commits_path(@project, ref: params[:ref]) |
24 | 24 | end |
... | ... | @@ -96,10 +96,10 @@ class RefsController < ApplicationController |
96 | 96 | @hex_path = Digest::SHA1.hexdigest(params[:path] || "/") |
97 | 97 | |
98 | 98 | if params[:path] |
99 | - @history_path = tree_file_project_ref_path(@project, @ref, params[:path]) | |
99 | + @history_path = project_tree_path(@project, File.join(@ref, params[:path])) | |
100 | 100 | @logs_path = logs_file_project_ref_path(@project, @ref, params[:path]) |
101 | 101 | else |
102 | - @history_path = tree_project_ref_path(@project, @ref) | |
102 | + @history_path = project_tree_path(@project, @ref) | |
103 | 103 | @logs_path = logs_tree_project_ref_path(@project, @ref) |
104 | 104 | end |
105 | 105 | rescue | ... | ... |
app/decorators/tree_decorator.rb
... | ... | @@ -15,7 +15,7 @@ class TreeDecorator < ApplicationDecorator |
15 | 15 | part_path = part if part_path.empty? |
16 | 16 | |
17 | 17 | next unless parts.last(2).include?(part) if parts.count > max_links |
18 | - yield(h.link_to(h.truncate(part, length: 40), h.tree_file_project_ref_path(project, ref, path: part_path), remote: :true)) | |
18 | + yield(h.link_to(h.truncate(part, length: 40), h.project_tree_path(project, h.tree_join(ref, part_path)), remote: :true)) | |
19 | 19 | end |
20 | 20 | end |
21 | 21 | end |
... | ... | @@ -26,7 +26,7 @@ class TreeDecorator < ApplicationDecorator |
26 | 26 | |
27 | 27 | def up_dir_path |
28 | 28 | file = File.join(path, "..") |
29 | - h.tree_file_project_ref_path(project, ref, file) | |
29 | + h.project_tree_path(project, h.tree_join(ref, file)) | |
30 | 30 | end |
31 | 31 | |
32 | 32 | def history_path | ... | ... |
app/helpers/application_helper.rb
... | ... | @@ -58,11 +58,11 @@ module ApplicationHelper |
58 | 58 | |
59 | 59 | if @project && !@project.new_record? |
60 | 60 | project_nav = [ |
61 | - { label: "#{@project.name} / Issues", url: project_issues_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) }, | |
64 | - { label: "#{@project.name} / Commits", url: project_commits_path(@project) }, | |
65 | - { label: "#{@project.name} / Team", url: project_team_index_path(@project) } | |
61 | + { label: "#{@project.name} / Issues", url: project_issues_path(@project) }, | |
62 | + { label: "#{@project.name} / Wall", url: wall_project_path(@project) }, | |
63 | + { label: "#{@project.name} / Tree", url: project_tree_path(@project, @ref || @project.root_ref) }, | |
64 | + { label: "#{@project.name} / Commits", url: project_commits_path(@project, @ref || @project.root_ref) }, | |
65 | + { label: "#{@project.name} / Team", url: project_team_index_path(@project) } | |
66 | 66 | ] |
67 | 67 | end |
68 | 68 | ... | ... |
app/helpers/tree_helper.rb
app/views/commits/_commit.html.haml
1 | 1 | %li.commit |
2 | 2 | .browse_code_link_holder |
3 | 3 | %p |
4 | - %strong= link_to "Browse Code »", tree_project_ref_path(@project, commit), class: "right" | |
4 | + %strong= link_to "Browse Code »", project_tree_path(@project, commit), class: "right" | |
5 | 5 | %p |
6 | 6 | = link_to commit.short_id(8), project_commit_path(@project, commit), class: "commit_short_id" |
7 | 7 | %strong.commit-author-name= commit.author_name | ... | ... |
app/views/commits/_commit_box.html.haml
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | = link_to patch_project_commit_path(@project, @commit.id), class: "btn small grouped" do |
9 | 9 | %i.icon-download-alt |
10 | 10 | Get Patch |
11 | - = link_to tree_project_ref_path(@project, @commit.id), class: "browse-button primary grouped" do | |
11 | + = link_to project_tree_path(@project, @commit), class: "browse-button primary grouped" do | |
12 | 12 | %strong Browse Code » |
13 | 13 | %h3.commit-title.page_title |
14 | 14 | = gfm escape_once(@commit.title) | ... | ... |
app/views/commits/_diffs.html.haml
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | %i.icon-file |
25 | 25 | %span{id: "#{diff.old_path}"}= diff.old_path |
26 | 26 | - else |
27 | - = link_to tree_file_project_ref_path(@project, @commit.id, diff.new_path) do | |
27 | + = link_to project_tree_path(@project, @commit, diff.new_path) do | |
28 | 28 | %i.icon-file |
29 | 29 | %span{id: "#{diff.new_path}"}= diff.new_path |
30 | 30 | %br/ | ... | ... |
app/views/layouts/_head.html.haml
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | - if controller_name == 'projects' && action_name == 'index' |
11 | 11 | = auto_discovery_link_tag :atom, projects_url(:atom, private_token: current_user.private_token), title: "Dashboard feed" |
12 | 12 | - if @project && !@project.new_record? |
13 | - - if current_page?(tree_project_ref_path(@project, @project.root_ref)) || current_page?(project_commits_path(@project)) | |
13 | + - if current_page?(project_tree_path(@project, @project.root_ref)) || current_page?(project_commits_path(@project)) | |
14 | 14 | = auto_discovery_link_tag(:atom, project_commits_url(@project, :atom, ref: @ref, private_token: current_user.private_token), title: "Recent commits to #{@project.name}:#{@ref}") |
15 | 15 | - if request.path == project_issues_path(@project) |
16 | 16 | = auto_discovery_link_tag(:atom, project_issues_url(@project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues") | ... | ... |
app/views/layouts/_project_menu.html.haml
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | - if @project.repo_exists? |
6 | 6 | - if can? current_user, :download_code, @project |
7 | 7 | %li{class: tree_tab_class} |
8 | - = link_to tree_project_ref_path(@project, @project.root_ref) do | |
8 | + = link_to project_tree_path(@project, @project.root_ref) do | |
9 | 9 | Files |
10 | 10 | %li{class: commit_tab_class} |
11 | 11 | = link_to "Commits", project_commits_path(@project) | ... | ... |
app/views/refs/_head.html.haml
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | %li |
3 | 3 | = render partial: 'shared/ref_switcher', locals: {destination: 'tree', path: params[:path]} |
4 | 4 | %li{class: "#{'active' if (controller.controller_name == "refs") }"} |
5 | - = link_to tree_project_ref_path(@project, @ref) do | |
5 | + = link_to project_tree_path(@project, @ref) do | |
6 | 6 | Source |
7 | 7 | %li.right |
8 | 8 | .input-prepend.project_clone_holder | ... | ... |
app/views/refs/blame.html.haml
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | %ul.breadcrumb |
5 | 5 | %li |
6 | 6 | %span.arrow |
7 | - = link_to tree_project_ref_path(@project, @ref, path: nil) do | |
7 | + = link_to project_tree_path(@project, @ref) do | |
8 | 8 | = @project.name |
9 | 9 | - @tree.breadcrumbs(6) do |link| |
10 | 10 | \/ |
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | %span.options |
21 | 21 | = link_to "raw", blob_project_ref_path(@project, @ref, path: params[:path]), class: "btn very_small", target: "_blank" |
22 | 22 | = link_to "history", project_commits_path(@project, path: params[:path], ref: @ref), class: "btn very_small" |
23 | - = link_to "source", tree_file_project_ref_path(@project, @ref, path: params[:path]), class: "btn very_small" | |
23 | + = link_to "source", project_tree_path(@project, tree_join(@ref, params[:path])), class: "btn very_small" | |
24 | 24 | .file_content.blame |
25 | 25 | %table |
26 | 26 | - @blame.each do |commit, lines| | ... | ... |
app/views/refs/logs_tree.js.haml
... | ... | @@ -6,4 +6,4 @@ |
6 | 6 | :plain |
7 | 7 | var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}"); |
8 | 8 | row.find("td.tree_time_ago").html('#{escape_javascript(time_ago_in_words(content_commit.committed_date))} ago'); |
9 | - row.find("td.tree_commit").html('#{escape_javascript(render("tree_commit", tm: tm, content_commit: content_commit))}'); | |
9 | + row.find("td.tree_commit").html('#{escape_javascript(render("tree/tree_commit", tm: tm, content_commit: content_commit))}'); | ... | ... |
app/views/tree/_head.html.haml
1 | 1 | %ul.nav.nav-tabs |
2 | 2 | %li |
3 | 3 | = render partial: 'shared/ref_switcher', locals: {destination: 'tree', path: params[:path]} |
4 | - %li{class: "#{'active' if (controller.controller_name == "refs") }"} | |
5 | - = link_to tree_project_ref_path(@project, @ref) do | |
4 | + %li{class: "#{'active' if (controller.controller_name == "tree") }"} | |
5 | + = link_to project_tree_path(@project, @ref) do | |
6 | 6 | Source |
7 | 7 | %li.right |
8 | 8 | .input-prepend.project_clone_holder | ... | ... |
app/views/tree/_tree.html.haml
1 | 1 | %ul.breadcrumb |
2 | 2 | %li |
3 | 3 | %span.arrow |
4 | - = link_to tree_project_ref_path(@project, @ref, path: nil), remote: true do | |
4 | + = link_to project_tree_path(@project, @ref), remote: true do | |
5 | 5 | = @project.name |
6 | 6 | - tree.breadcrumbs(6) do |link| |
7 | 7 | \/ |
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | %div.tree_progress |
11 | 11 | #tree-content-holder |
12 | 12 | - if tree.is_blob? |
13 | - = render partial: "refs/tree_file", locals: { name: tree.name, content: tree.data, file: tree } | |
13 | + = render partial: "tree/tree_file", locals: { name: tree.name, content: tree.data, file: tree } | |
14 | 14 | - else |
15 | 15 | - contents = tree.contents |
16 | 16 | %table#tree-slider{class: "table_#{@hex_path}" } |
... | ... | @@ -31,11 +31,11 @@ |
31 | 31 | |
32 | 32 | - index = 0 |
33 | 33 | - contents.select{ |i| i.is_a?(Grit::Tree)}.each do |content| |
34 | - = render partial: "refs/tree_item", locals: { content: content, index: (index += 1) } | |
34 | + = render partial: "tree/tree_item", locals: { content: content, index: (index += 1) } | |
35 | 35 | - contents.select{ |i| i.is_a?(Grit::Blob)}.each do |content| |
36 | - = render partial: "refs/tree_item", locals: { content: content, index: (index += 1) } | |
36 | + = render partial: "tree/tree_item", locals: { content: content, index: (index += 1) } | |
37 | 37 | - contents.select{ |i| i.is_a?(Grit::Submodule)}.each do |content| |
38 | - = render partial: "refs/submodule_item", locals: { content: content, index: (index += 1) } | |
38 | + = render partial: "tree/submodule_item", locals: { content: content, index: (index += 1) } | |
39 | 39 | |
40 | 40 | - if content = contents.select{ |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i }.first |
41 | 41 | .file_holder#README | ... | ... |
app/views/tree/_tree_file.html.haml
... | ... | @@ -5,9 +5,9 @@ |
5 | 5 | = name.force_encoding('utf-8') |
6 | 6 | %small #{file.mode} |
7 | 7 | %span.options |
8 | - = link_to "raw", blob_project_ref_path(@project, @ref, path: params[:path]), class: "btn very_small", target: "_blank" | |
8 | + = link_to "raw", blob_project_ref_path(@project, @ref, path: @path), class: "btn very_small", target: "_blank" | |
9 | 9 | = link_to "history", project_commits_path(@project, path: params[:path], ref: @ref), class: "btn very_small" |
10 | - = link_to "blame", blame_file_project_ref_path(@project, @ref, path: params[:path]), class: "btn very_small" | |
10 | + = link_to "blame", blame_file_project_ref_path(@project, @ref, path: @path.gsub(/^\//, '')), class: "btn very_small" | |
11 | 11 | - if file.text? |
12 | 12 | - if gitlab_markdown?(name) |
13 | 13 | .file_content.wiki | ... | ... |
app/views/tree/_tree_item.html.haml
1 | 1 | - file = tree_full_path(content) |
2 | -%tr{ class: "tree-item #{tree_hex_class(content)}", url: tree_file_project_ref_path(@project, @ref, file) } | |
2 | +%tr{ class: "tree-item #{tree_hex_class(content)}", url: project_tree_path(@project, tree_join(@id, file)) } | |
3 | 3 | %td.tree-item-file-name |
4 | 4 | = tree_icon(content) |
5 | - %strong= link_to truncate(content.name, length: 40), tree_file_project_ref_path(@project, @ref || @commit.id, file), remote: :true | |
5 | + %strong= link_to truncate(content.name, length: 40), project_tree_path(@project, tree_join(@id || @commit.id, file)), remote: :true | |
6 | 6 | %td.tree_time_ago.cgray |
7 | 7 | - if index == 1 |
8 | 8 | %span.log_loading | ... | ... |
features/steps/project/project_browse_files.rb
... | ... | @@ -10,7 +10,7 @@ class ProjectBrowseFiles < Spinach::FeatureSteps |
10 | 10 | end |
11 | 11 | |
12 | 12 | Then 'I should see files from repository for "8470d70"' do |
13 | - current_path.should == tree_project_ref_path(@project, "8470d70") | |
13 | + current_path.should == project_tree_path(@project, "8470d70") | |
14 | 14 | page.should have_content "app" |
15 | 15 | page.should have_content "History" |
16 | 16 | page.should have_content "Gemfile" | ... | ... |
features/steps/shared/paths.rb
... | ... | @@ -51,15 +51,15 @@ module SharedPaths |
51 | 51 | end |
52 | 52 | |
53 | 53 | Given 'I visit project source page' do |
54 | - visit tree_project_ref_path(@project, @project.root_ref) | |
54 | + visit project_tree_path(@project, @project.root_ref) | |
55 | 55 | end |
56 | 56 | |
57 | 57 | Given 'I visit blob file from repo' do |
58 | - visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) | |
58 | + visit project_tree_path(@project, File.join(ValidCommit::ID, ValidCommit::BLOB_FILE_PATH)) | |
59 | 59 | end |
60 | 60 | |
61 | 61 | Given 'I visit project source page for "8470d70"' do |
62 | - visit tree_project_ref_path(@project, "8470d70") | |
62 | + visit project_tree_path(@project, "8470d70") | |
63 | 63 | end |
64 | 64 | |
65 | 65 | Given 'I visit project tags page' do | ... | ... |
spec/requests/gitlab_flavored_markdown_spec.rb
... | ... | @@ -61,7 +61,7 @@ describe "Gitlab Flavored Markdown" do |
61 | 61 | end |
62 | 62 | |
63 | 63 | it "should render title in refs#tree", js: true do |
64 | - visit tree_project_ref_path(project, id: @branch_name) | |
64 | + visit project_tree_path(project, @branch_name) | |
65 | 65 | |
66 | 66 | within(".tree_commit") do |
67 | 67 | page.should have_link("##{issue.id}") | ... | ... |
spec/requests/security/project_access_spec.rb
... | ... | @@ -37,7 +37,7 @@ describe "Application access" do |
37 | 37 | end |
38 | 38 | |
39 | 39 | describe "GET /project_code/master/tree" do |
40 | - subject { tree_project_ref_path(@project, @project.root_ref) } | |
40 | + subject { project_tree_path(@project, @project.root_ref) } | |
41 | 41 | |
42 | 42 | it { should be_allowed_for @u1 } |
43 | 43 | it { should be_allowed_for @u3 } | ... | ... |