module Decidim::Comments::CommentsHelper
A helper to expose the comments component for a commentable
Public Instance Methods
comments_for(resource)
click to toggle source
Render commentable comments inside the `expanded` template content.
resource - A commentable resource
# File lib/decidim/comments/comments_helper.rb, line 10 def comments_for(resource) return unless resource.commentable? content_for :expanded do inline_comments_for(resource) end end
inline_comments_for(resource, options = {})
click to toggle source
Creates a Comments
component through the comments cell.
resource - A commentable resource
Returns the comments cell
# File lib/decidim/comments/comments_helper.rb, line 23 def inline_comments_for(resource, options = {}) return unless resource.commentable? cell( "decidim/comments/comments", resource, machine_translations: machine_translations_toggled?, single_comment: params.fetch("commentId", nil), order: options[:order] ).to_s end