[refs #579] add new helper
This commit is contained in:
parent
9579734506
commit
f060d919d9
|
@ -41,11 +41,7 @@ class Projects::CommentsController < Projects::BaseController
|
|||
end
|
||||
|
||||
def new_line
|
||||
@path = if @commentable.class == Issue
|
||||
project_issue_comments_path(@project, @commentable)
|
||||
elsif @commentable.class == Grit::Commit
|
||||
project_commit_comments_path(@project, @commentable)
|
||||
end
|
||||
@path = view_context.project_commentable_comments_path(@project, @commentable)
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
|
|
|
@ -1,23 +1,29 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
module CommentsHelper
|
||||
def project_commentable_comment_path(project, commentable, comment)
|
||||
case
|
||||
when Comment.issue_comment?(commentable.class)
|
||||
if Comment.issue_comment?(commentable.class)
|
||||
project_issue_comment_path(project, commentable, comment)
|
||||
when Comment.commit_comment?(commentable.class)
|
||||
elsif Comment.commit_comment?(commentable.class)
|
||||
project_commit_comment_path(project, commentable, comment)
|
||||
end
|
||||
end
|
||||
|
||||
def project_commentable_path(project, commentable)
|
||||
case
|
||||
when Comment.issue_comment?(commentable.class)
|
||||
if Comment.issue_comment?(commentable.class)
|
||||
polymorphic_path [project, commentable.pull_request ? commentable.pull_request : commentable]
|
||||
when Comment.commit_comment?(commentable.class)
|
||||
elsif Comment.commit_comment?(commentable.class)
|
||||
commit_path project, commentable.id
|
||||
end
|
||||
end
|
||||
|
||||
def project_commentable_comments_path(project, commentable)
|
||||
if commentable.class == Issue
|
||||
project_issue_comments_path(@project, @commentable)
|
||||
elsif commentable.class == Grit::Commit
|
||||
project_commit_comments_path(@project, @commentable)
|
||||
end
|
||||
end
|
||||
|
||||
def comment_anchor c
|
||||
"#{(c.data.present? && c.actual_inline_comment?(@diff)) ? 'diff-' : ''}comment#{c.id}"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue