Module: Dorsale::CommentsHelper

Included in:
AllHelpers
Defined in:
app/helpers/dorsale/comments_helper.rb

Instance Method Summary collapse

Instance Method Details

#comments_for(commentable, options = {}) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/helpers/dorsale/comments_helper.rb', line 2

def comments_for(commentable, options = {})
  comments = policy_scope(::Dorsale::Comment)
    .where(commentable: commentable)
    .preload(:commentable, :author)

  new_comment = comments.new(author: current_user)

  render(
    :partial => "dorsale/comments/comments",
    :locals  => {
      :comments    => comments,
      :new_comment => new_comment,
    },
  )
end

#truncate_comment_text?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/helpers/dorsale/comments_helper.rb', line 18

def truncate_comment_text?
  controller_name == "people" && action_name == "activity"
end