per line comments display
This commit is contained in:
parent
c66bc99fb7
commit
9da4d06a87
7 changed files with 78 additions and 2 deletions
|
@ -53,6 +53,23 @@ class Note < ActiveRecord::Base
|
|||
noteable
|
||||
end
|
||||
end
|
||||
|
||||
def line_file_id
|
||||
@line_file_id ||= line_code.split("_")[1].to_i if line_code
|
||||
end
|
||||
|
||||
def line_type_id
|
||||
@line_type_id ||= line_code.split("_").first if line_code
|
||||
end
|
||||
|
||||
def line_number
|
||||
@line_number ||= line_code.split("_").last.to_i if line_code
|
||||
end
|
||||
|
||||
def for_line?(file_id, old_line, new_line)
|
||||
line_file_id == file_id &&
|
||||
((line_type_id == "NEW" && line_number == new_line) || (line_type_id == "OLD" && line_number == old_line ))
|
||||
end
|
||||
end
|
||||
# == Schema Information
|
||||
#
|
||||
|
|
|
@ -166,7 +166,11 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def commit_notes(commit)
|
||||
notes.where(:noteable_id => commit.id, :noteable_type => "Commit")
|
||||
notes.where(:noteable_id => commit.id, :noteable_type => "Commit", :line_code => nil)
|
||||
end
|
||||
|
||||
def commit_line_notes(commit)
|
||||
notes.where(:noteable_id => commit.id, :noteable_type => "Commit").where("line_code not null")
|
||||
end
|
||||
|
||||
def has_commits?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue