Class: Decidim::ResourceHiddenEvent

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

Instance Method Summary collapse

Instance Method Details

#report_reasonsObject



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_contentObject



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_pathObject



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

def resource_path
  @resource.reported_content_url
end

#resource_textObject



33
34
35
# File 'app/events/decidim/resource_hidden_event.rb', line 33

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

#resource_titleObject



23
24
25
# File 'app/events/decidim/resource_hidden_event.rb', line 23

def resource_title
  nil
end

#resource_typeObject



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

def resource_type
  @resource.model_name.human.downcase
end

#resource_urlObject



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

def resource_url
  @resource.reported_content_url
end