Class: Decidim::ResourceHiddenEvent
- Inherits:
-
Events::SimpleEvent
- Object
- Events::SimpleEvent
- Decidim::ResourceHiddenEvent
- Includes:
- ApplicationHelper
- Defined in:
- app/events/decidim/resource_hidden_event.rb
Instance Method Summary collapse
- #report_reasons ⇒ Object
- #resource_content ⇒ Object
- #resource_path ⇒ Object
- #resource_text ⇒ Object
- #resource_title ⇒ Object
- #resource_type ⇒ Object
- #resource_url ⇒ Object
Instance Method Details
#report_reasons ⇒ Object
17 18 19 20 21 |
# File 'app/events/decidim/resource_hidden_event.rb', line 17 def report_reasons extra["report_reasons"].map do |reason| I18n.t("decidim.admin.moderations.report.reasons.#{reason}").downcase end.join(", ") end |
#resource_content ⇒ Object
27 28 29 30 31 |
# File 'app/events/decidim/resource_hidden_event.rb', line 27 def resource_content text = translated_attribute(@resource[@resource.reported_attributes.first]) decidim_sanitize(html_truncate(text, length: 100), strip_tags: true) end |
#resource_path ⇒ Object
9 10 11 |
# File 'app/events/decidim/resource_hidden_event.rb', line 9 def resource_path @resource.reported_content_url end |
#resource_text ⇒ Object
33 34 35 |
# File 'app/events/decidim/resource_hidden_event.rb', line 33 def resource_text "<i>#{resource_content}</i>" end |
#resource_title ⇒ Object
23 24 25 |
# File 'app/events/decidim/resource_hidden_event.rb', line 23 def resource_title nil end |
#resource_type ⇒ Object
37 38 39 |
# File 'app/events/decidim/resource_hidden_event.rb', line 37 def resource_type @resource.model_name.human.downcase end |
#resource_url ⇒ Object
13 14 15 |
# File 'app/events/decidim/resource_hidden_event.rb', line 13 def resource_url @resource.reported_content_url end |