Module: Decidim::Admin::Moderations::ReportsHelper
- Includes:
- Messaging::ConversationHelper
- Defined in:
- app/helpers/decidim/admin/moderations/reports_helper.rb
Overview
This module includes helpers to show moderation reports in admin
Instance Method Summary collapse
-
#reportable_author_name(reportable) ⇒ Object
Public: Returns the reportable’s author names separated by commas.
-
#reported_content_for(reportable, options = {}) ⇒ Object
Public: Renders a small preview of the content reported.
-
#translatable_resource?(reportable) ⇒ Boolean
Public: Whether the resource has some translated attribute or not.
Instance Method Details
#reportable_author_name(reportable) ⇒ Object
Public: Returns the reportable’s author names separated by commas.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/helpers/decidim/admin/moderations/reports_helper.rb', line 11 def (reportable) = reportable.try(:authors) || [reportable.try(:normalized_author)] content_tag :ul, class: "reportable-authors" do .select(&:present?).map do || if .is_a? User content_tag :li do link_to current_or_new_conversation_path_with(), target: "_blank", rel: "noopener" do "#{.name} #{icon "envelope-closed"}".html_safe end end else content_tag(:li, .name) end end.join("").html_safe end end |
#reported_content_for(reportable, options = {}) ⇒ Object
Public: Renders a small preview of the content reported.
29 30 31 |
# File 'app/helpers/decidim/admin/moderations/reports_helper.rb', line 29 def reported_content_for(reportable, = {}) cell "decidim/reported_content", reportable, end |
#translatable_resource?(reportable) ⇒ Boolean
Public: Whether the resource has some translated attribute or not.
34 35 36 |
# File 'app/helpers/decidim/admin/moderations/reports_helper.rb', line 34 def translatable_resource?(reportable) reportable.respond_to?(:content_original_language) end |