Module: CommentsHelper

Included in:
BaseCell, CommentsController
Defined in:
app/helpers/comments_helper.rb

Instance Method Summary collapse

Instance Method Details

#comment_path(comment) ⇒ Object


2
3
4
# File 'app/helpers/comments_helper.rb', line 2

def comment_path(comment)
  smart_post_path(comment.commentable, anchor: "comment_#{comment.id}")
end

#comment_url(comment) ⇒ Object


6
7
8
# File 'app/helpers/comments_helper.rb', line 6

def comment_url(comment)
  smart_post_url(comment.commentable, anchor: "comment_#{comment.id}")
end

10
11
12
13
14
15
16
17
18
# File 'app/helpers/comments_helper.rb', line 10

def comments_link(commentable, options = {})
  return if (commentable.comments_count <= 0) && !options[:without_comments]

   :span, class: (options[:class] || 'pull-right'), title: t(:discussion) do
    link_to smart_post_path(commentable, anchor: 'comments'), class: 'no-underline', data: { turbolinks: false } do
      glyphicon(:comment) + raw('&nbsp;') + commentable.comments_count.to_s if commentable.comments_count.positive?
    end
  end
end