Class: Decidim::ResourceHiddenEvent

Inherits:
Events::SimpleEvent show all
Includes:
ApplicationHelper
Defined in:
decidim-admin/app/events/decidim/resource_hidden_event.rb

Direct Known Subclasses

ParentHiddenEvent

Constant Summary

Constants included from AmendmentsHelper

AmendmentsHelper::TOTAL_STEPS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ApplicationHelper

#add_body_classes, #cell, #edit_link, #extra_admin_link, #html_truncate, #layout_item_classes, #present, #prevent_timeout_seconds, #resolve_presenter_class, #text_initials

Methods included from CacheHelper

#cache

Methods included from AmendmentsHelper

#accept_and_reject_buttons_for, #action_button_card_for, #allowed_to_accept_and_reject?, #allowed_to_promote?, #amendments_enabled?, #amendments_form_field_for, #amendments_form_fields_label, #amendments_form_fields_value, #can_participate_in_private_space?, #can_react_to_emendation?, #current_step, #emendation_actions_for, #emendation_announcement_for, #promote_button_for, #render_emendation_body, #total_steps, #wizard_aside_back_url, #wizard_header_title

Methods included from RichTextEditorHelper

included, #text_editor_for

Methods included from ContextualHelpHelper

#floating_help

Methods included from DecidimFormHelper

#areas_for_select, #base_error_messages, #decidim_form_for, #decidim_form_slug_url, #editor_field_tag, #form_field_has_error?, #form_required_explanation, #name_with_locale, #tab_element_class_for, #translated_field_tag

Methods included from OmniauthHelper

#normalize_provider_name, #oauth_icon, #provider_name

Methods inherited from Events::SimpleEvent

#email_intro, #email_outro, #email_subject, #event_has_roles?, i18n_attributes, #i18n_options, #i18n_scope, #notification_title, #participatory_space_url

Methods included from OrganizationHelper

#current_organization_name, #organization_colors, #organization_description_label, #organization_name

Methods included from TranslatableAttributes

#attachment?, #default_locale?

Methods included from ComponentPathHelper

#can_be_managed?, #main_component_path, #main_component_url, #manage_component_path

Methods inherited from Events::BaseEvent

#action_cell, #action_data, #content_in_same_language?, #hidden_resource?, #initialize, #organization, #perform_translation?, #resource_locator, #safe_resource_text, #safe_resource_translated_text, #translation_missing?, type

Methods included from SanitizeHelper

#decidim_escape_translated, #decidim_html_escape, #decidim_rich_text, #decidim_sanitize, #decidim_sanitize_admin, #decidim_sanitize_editor, #decidim_sanitize_editor_admin, #decidim_sanitize_newsletter, #decidim_sanitize_translated, #decidim_url_escape, included

Constructor Details

This class inherits a constructor from Decidim::Events::BaseEvent

Class Method Details

.typesObject



9
10
11
# File 'decidim-admin/app/events/decidim/resource_hidden_event.rb', line 9

def self.types
  [:email]
end

Instance Method Details

#report_reasonsObject



21
22
23
24
25
# File 'decidim-admin/app/events/decidim/resource_hidden_event.rb', line 21

def report_reasons
  extra["report_reasons"].map do |reason|
    I18n.t("decidim.admin.moderations.report.reasons.#{reason}").downcase
  end.join(", ")
end

#resource_contentObject



31
32
33
34
35
# File 'decidim-admin/app/events/decidim/resource_hidden_event.rb', line 31

def resource_content
  text = translated_attribute(@resource[@resource.reported_attributes.first])

  decidim_sanitize(html_truncate(text, length: 100), strip_tags: true)
end

#resource_pathObject



13
14
15
# File 'decidim-admin/app/events/decidim/resource_hidden_event.rb', line 13

def resource_path
  @resource.reported_content_url
end

#resource_textObject



37
38
39
# File 'decidim-admin/app/events/decidim/resource_hidden_event.rb', line 37

def resource_text
  "<i>#{resource_content}</i>"
end

#resource_titleObject



27
28
29
# File 'decidim-admin/app/events/decidim/resource_hidden_event.rb', line 27

def resource_title
  nil
end

#resource_typeObject



41
42
43
# File 'decidim-admin/app/events/decidim/resource_hidden_event.rb', line 41

def resource_type
  @resource.model_name.human.downcase
end

#resource_urlObject



17
18
19
# File 'decidim-admin/app/events/decidim/resource_hidden_event.rb', line 17

def resource_url
  @resource.reported_content_url
end