Fix routing issues when navigating over tree, commits etc

This commit is contained in:
Dmitriy Zaporozhets 2012-12-25 06:14:05 +03:00
parent 49e73f8ac1
commit c8ba5c2d58
7 changed files with 44 additions and 5 deletions

View file

@ -70,4 +70,12 @@ module CommitsHelper
escape_javascript(render 'commits/commit', commit: commit)
end
end
def diff_line_content(line)
if line.blank?
"  "
else
line
end
end
end

View file

@ -102,7 +102,7 @@ class Project < ActiveRecord::Base
if id.include?("/")
id = id.split("/")
namespace_id = Namespace.find_by_path(id.first).id
where(namespace_id: namespace_id).find_by_path(id.last)
where(namespace_id: namespace_id).find_by_path(id.second)
else
where(path: id, namespace_id: nil).last
end

View file

@ -15,7 +15,7 @@
- if @comments_allowed
= render "notes/per_line_note_link", line_code: line_code
%td.new_line= link_to raw(type == "old" ? "&nbsp;" : line_new) , "##{line_code}", id: line_code
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} &nbsp;"
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line)
- if @comments_allowed
- comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at)