Module: Voluntary::CommentsHelper

Defined in:
app/helpers/voluntary/comments_helper.rb

Instance Method Summary collapse

Instance Method Details

#nested_comments(comments) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'app/helpers/voluntary/comments_helper.rb', line 3

def nested_comments(comments)
  comments.map do |comment, sub_comments|
    next if comment.id.blank?
    
    content = render(partial: 'comments/resource', locals: { resource: comment }) 
    content += (:div, nested_comments(sub_comments), class: 'nested_comments')
    content
  end.join.html_safe
end