rosa-build/app/helpers/comments_helper.rb

30 lines
1.0 KiB
Ruby
Raw Normal View History

module CommentsHelper
def project_commentable_comment_path(project, commentable, comment)
2012-10-16 14:20:55 +01:00
if Comment.issue_comment?(commentable.class)
project_issue_comment_path(project, commentable, comment)
2012-10-16 14:20:55 +01:00
elsif Comment.commit_comment?(commentable.class)
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)
commit_path project, commentable.id
end
end
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
def comment_anchor c
"#{(c.data.present? && c.actual_inline_comment?) ? 'diff-' : ''}comment#{c.id}"
end
end