mirror of
https://github.com/zhigang1992/tsemple.git
synced 2026-01-12 17:52:57 +08:00
26 lines
629 B
Ruby
26 lines
629 B
Ruby
module CommentsHelper
|
|
def comment_link(comment, options = {})
|
|
options[:only_path] = true unless options[:only_path] == false
|
|
case comment.commentable
|
|
when Topic
|
|
topic_path(comment.commentable, comment_id: comment.id, anchor: "comment-#{comment.id}", only_path: options[:only_path])
|
|
end
|
|
end
|
|
|
|
def comment_title(comment)
|
|
case comment.commentable
|
|
when Topic
|
|
comment.commentable.title
|
|
else
|
|
t 'helpers.comments.deleted_entry'
|
|
end
|
|
end
|
|
|
|
def comment_replace_path(comment)
|
|
case comment.commentable
|
|
when Topic
|
|
topic_last_path(@comment.commentable)
|
|
end
|
|
end
|
|
end
|