Module: Crm::PostCommentsHelper

Defined in:
app/helpers/crm/post_comments_helper.rb

Overview

View helper for CRM post comments — builds the per-comment action links
(respond, edit, state events, view on www, delete) rendered on the CRM
post comments index.

Instance Method Summary collapse

Instance Method Details

#post_comment_commands(post_comment) ⇒ Array<String>

Build the action links for a single post comment.

Parameters:

  • post_comment (PostComment)

    the comment to render commands for

Returns:

  • (Array<String>)

    safe HTML link fragments



14
15
16
17
18
19
20
21
22
23
# File 'app/helpers/crm/post_comments_helper.rb', line 14

def post_comment_commands(post_comment)
  cmds = []
  # only allow one level of response
  cmds << link_to('Respond', new_post_post_comment_path(post_comment.post_id, parent_id: post_comment.id)) unless post_comment.parent_comment_id
  cmds << link_to('Edit', edit_post_comment_path(post_comment.id))
  cmds += available_events_links(post_comment, return_path: post_post_comments_path(post_comment.post_id))
  cmds << link_to('View on www', post_url(post_comment.post_id, host: WEB_HOSTNAME))
  cmds << link_to('Delete', post_comment_path(post_comment.id), data: { turbo_method: :delete, turbo_confirm: "Are you sure you want to destroy the post comment: #{post_comment.body}" })
  cmds
end