2011-12-19 15:30:14 +00:00
|
|
|
module CommentsHelper
|
2012-04-04 22:43:06 +01:00
|
|
|
def project_commentable_comment_path(project, commentable, comment)
|
2012-10-16 14:20:55 +01:00
|
|
|
if Comment.issue_comment?(commentable.class)
|
2012-04-04 22:43:06 +01:00
|
|
|
project_issue_comment_path(project, commentable, comment)
|
2012-10-16 14:20:55 +01:00
|
|
|
elsif Comment.commit_comment?(commentable.class)
|
2012-04-04 22:43:06 +01:00
|
|
|
project_commit_comment_path(project, commentable, comment)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def project_commentable_path(project, commentable)
|
2012-10-16 14:20:55 +01:00
|
|
|
if Comment.issue_comment?(commentable.class)
|
2012-06-05 19:08:32 +01:00
|
|
|
polymorphic_path [project, commentable.pull_request ? commentable.pull_request : commentable]
|
2012-10-16 14:20:55 +01:00
|
|
|
elsif Comment.commit_comment?(commentable.class)
|
2012-04-04 22:43:06 +01:00
|
|
|
commit_path project, commentable.id
|
|
|
|
end
|
|
|
|
end
|
2012-10-12 20:56:02 +01:00
|
|
|
|
2012-10-16 14:20:55 +01:00
|
|
|
def project_commentable_comments_path(project, commentable)
|
2012-10-19 10:50:15 +01:00
|
|
|
if commentable.is_a? Issue
|
2012-10-16 14:20:55 +01:00
|
|
|
project_issue_comments_path(@project, @commentable)
|
2012-10-19 10:50:15 +01:00
|
|
|
elsif commentable.is_a? Grit::Commit
|
2012-10-16 14:20:55 +01:00
|
|
|
project_commit_comments_path(@project, @commentable)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-10-12 20:56:02 +01:00
|
|
|
def comment_anchor c
|
2012-10-26 15:03:46 +01:00
|
|
|
"#{(c.data.present? && c.actual_inline_comment?) ? 'diff-' : ''}comment#{c.id}"
|
2012-10-12 20:56:02 +01:00
|
|
|
end
|
2011-12-19 15:30:14 +00:00
|
|
|
end
|