Class: Decidim::Proposals::PublishProposalEvent
- Inherits:
-
Events::SimpleEvent
- Object
- Events::SimpleEvent
- Decidim::Proposals::PublishProposalEvent
- Includes:
- ActionView::Helpers::UrlHelper, Events::CoauthorEvent, Events::MachineTranslatedEvent
- Defined in:
- app/events/decidim/proposals/publish_proposal_event.rb
Instance Method Summary collapse
- #i18n_options ⇒ Object
- #notification_title ⇒ Object
- #resource_text ⇒ Object
- #safe_resource_text ⇒ Object
- #safe_resource_translated_text ⇒ Object
- #translatable_resource ⇒ Object
- #translatable_text ⇒ Object
Instance Method Details
#i18n_options ⇒ Object
15 16 17 18 19 20 21 |
# File 'app/events/decidim/proposals/publish_proposal_event.rb', line 15 def return super if .blank? = link_to("@#{.nickname}", profile_path(.nickname)) = "#{.name} #{}" super.merge({ author: }) end |
#notification_title ⇒ Object
40 41 42 43 44 |
# File '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, **).html_safe end |
#resource_text ⇒ Object
11 12 13 |
# File '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 '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 '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 'app/events/decidim/proposals/publish_proposal_event.rb', line 23 def translatable_resource resource end |
#translatable_text ⇒ Object
27 28 29 |
# File 'app/events/decidim/proposals/publish_proposal_event.rb', line 27 def translatable_text resource.body end |