Module: Decidim::Comments::CommentsHelper
- Included in:
- Accountability::ApplicationHelper, Blogs::ApplicationHelper, Budgets::ApplicationHelper, Debates::ApplicationHelper, Debates::DebateCellsHelper, Elections::ElectionCellsHelper, Meetings::ApplicationHelper, Meetings::Directory::ApplicationHelper, Proposals::ApplicationHelper
- Defined in:
- decidim-comments/lib/decidim/comments/comments_helper.rb
Overview
A helper to expose the comments component for a commentable
Instance Method Summary collapse
-
#comments_for(resource, options = {}) ⇒ Object
Render commentable comments inside the ‘expanded` template content.
-
#inline_comments_for(resource, options = {}) ⇒ Object
Creates a Comments component through the comments cell.
Instance Method Details
#comments_for(resource, options = {}) ⇒ Object
Render commentable comments inside the ‘expanded` template content.
resource - A commentable resource
10 11 12 13 14 15 16 17 18 19 |
# File 'decidim-comments/lib/decidim/comments/comments_helper.rb', line 10 def comments_for(resource, = {}) return unless resource.commentable? append_stylesheet_pack_tag "decidim_comments" # This script cannot be deferred, otherwise the DOMReady and turbo:load listeners are not # executed from a Turbo Frame call append_javascript_pack_tag "decidim_comments", defer: false inline_comments_for(resource, ) end |
#inline_comments_for(resource, options = {}) ⇒ Object
Creates a Comments component through the comments cell.
resource - A commentable resource
Returns the comments cell
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'decidim-comments/lib/decidim/comments/comments_helper.rb', line 26 def inline_comments_for(resource, = {}) return unless resource.commentable? cell( "decidim/comments/comments", resource, machine_translations: machine_translations_toggled?, single_comment: params.fetch("commentId", nil), order: [:order], polymorphic: [:polymorphic] ).to_s end |