Class: Decidim::Proposals::PublishProposalEvent
Instance Method Summary
collapse
#email_intro, #email_outro, #email_subject, #email_subject_i18n_options, #event_has_roles?, i18n_attributes, #participatory_space_url, #resource_path, #resource_url
#decidim_html_escape, #decidim_sanitize, #decidim_sanitize_admin, #decidim_sanitize_editor, #decidim_sanitize_editor_admin, #decidim_sanitize_newsletter, #decidim_url_escape, included
#can_be_managed?, #main_component_path, #main_component_url, #manage_component_path
#content_in_same_language?, #initialize, #organization, #perform_translation?, #resource_locator, #resource_path, #resource_title, #resource_url, #translation_missing?, type
#default_locale?
Instance Method Details
#i18n_options ⇒ Object
15
16
17
18
19
20
21
|
# File 'decidim-proposals/app/events/decidim/proposals/publish_proposal_event.rb', line 15
def i18n_options
return super if author.blank?
author_path = link_to("@#{author.nickname}", profile_path(author.nickname))
author_string = "#{author.name} #{author_path}"
super.merge({ author: author_string })
end
|
#notification_title ⇒ Object
40
41
42
43
44
|
# File 'decidim-proposals/app/events/decidim/proposals/publish_proposal_event.rb', line 40
def notification_title
i18n_key = resource.official? ? "notification_title_official" : "notification_title"
I18n.t(i18n_key, **i18n_options).html_safe
end
|
#resource_text ⇒ Object
11
12
13
|
# File 'decidim-proposals/app/events/decidim/proposals/publish_proposal_event.rb', line 11
def resource_text
resource.body
end
|
#safe_resource_text ⇒ Object
31
32
33
34
|
# File 'decidim-proposals/app/events/decidim/proposals/publish_proposal_event.rb', line 31
def safe_resource_text
locale = resource.respond_to?(:content_original_language) ? resource.content_original_language : I18n.locale
I18n.with_locale(locale) { translated_attribute(resource_text).to_s.html_safe }
end
|
#safe_resource_translated_text ⇒ Object
36
37
38
|
# File 'decidim-proposals/app/events/decidim/proposals/publish_proposal_event.rb', line 36
def safe_resource_translated_text
I18n.with_locale(I18n.locale) { translated_attribute(resource_text, nil, true).to_s.html_safe }
end
|
#translatable_resource ⇒ Object
23
24
25
|
# File 'decidim-proposals/app/events/decidim/proposals/publish_proposal_event.rb', line 23
def translatable_resource
resource
end
|
#translatable_text ⇒ Object
27
28
29
|
# File 'decidim-proposals/app/events/decidim/proposals/publish_proposal_event.rb', line 27
def translatable_text
resource.body
end
|