Class: Decidim::Proposals::PublishProposalEvent

Inherits:
Events::SimpleEvent show all
Includes:
ActionView::Helpers::UrlHelper, Events::CoauthorEvent, Events::MachineTranslatedEvent
Defined in:
decidim-proposals/app/events/decidim/proposals/publish_proposal_event.rb

Instance Method Summary collapse

Methods inherited from Events::SimpleEvent

#email_intro, #email_outro, #email_subject, #event_has_roles?, i18n_attributes, #notification_title, #participatory_space_url, #resource_path, #resource_url

Methods included from SanitizeHelper

#decidim_html_escape, #decidim_sanitize, #decidim_sanitize_editor, #decidim_sanitize_newsletter, #decidim_url_escape, included

Methods included from ComponentPathHelper

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

Methods inherited from Events::BaseEvent

#content_in_same_language?, #initialize, #organization, #perform_translation?, #resource_locator, #resource_path, #resource_title, #resource_url, #translation_missing?, type

Methods included from TranslatableAttributes

#default_locale?

Constructor Details

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

Instance Method Details

#i18n_optionsObject


15
16
17
18
19
# File 'decidim-proposals/app/events/decidim/proposals/publish_proposal_event.rb', line 15

def i18n_options
  author_path = link_to("@#{author.nickname}", profile_path(author.nickname))
  author_string = "#{author.name} #{author_path}"
  super.merge({ author: author_string })
end

#resource_textObject


11
12
13
# File 'decidim-proposals/app/events/decidim/proposals/publish_proposal_event.rb', line 11

def resource_text
  resource.body
end

#safe_resource_textObject


29
30
31
32
# File 'decidim-proposals/app/events/decidim/proposals/publish_proposal_event.rb', line 29

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_textObject


34
35
36
# File 'decidim-proposals/app/events/decidim/proposals/publish_proposal_event.rb', line 34

def safe_resource_translated_text
  I18n.with_locale(I18n.locale) { translated_attribute(resource_text, nil, true).to_s.html_safe }
end

#translatable_resourceObject


21
22
23
# File 'decidim-proposals/app/events/decidim/proposals/publish_proposal_event.rb', line 21

def translatable_resource
  resource
end

#translatable_textObject


25
26
27
# File 'decidim-proposals/app/events/decidim/proposals/publish_proposal_event.rb', line 25

def translatable_text
  resource.body
end