Class: Decidim::Amendable::AmendmentBaseEvent

Inherits:
Events::SimpleEvent show all
Defined in:
app/events/decidim/amendable/amendment_base_event.rb

Instance Method Summary collapse

Methods inherited from Events::SimpleEvent

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

Methods included from OrganizationHelper

#current_organization_name, #organization_colors, #organization_description_label, #organization_name

Methods included from TranslatableAttributes

#default_locale?

Methods included from ComponentPathHelper

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

Methods inherited from Events::BaseEvent

#action_cell, #action_data, #content_in_same_language?, #hidden_resource?, #initialize, #organization, #perform_translation?, #resource_locator, #resource_path, #resource_text, #resource_title, #resource_url, #safe_resource_text, #safe_resource_translated_text, #translation_missing?, type

Methods included from SanitizeHelper

#decidim_escape_translated, #decidim_html_escape, #decidim_sanitize, #decidim_sanitize_admin, #decidim_sanitize_editor, #decidim_sanitize_editor_admin, #decidim_sanitize_newsletter, #decidim_sanitize_translated, #decidim_url_escape, included

Constructor Details

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

Instance Method Details

#amendable_pathObject



16
17
18
# File 'app/events/decidim/amendable/amendment_base_event.rb', line 16

def amendable_path
  @amendable_path ||= Decidim::ResourceLocatorPresenter.new(amendable_resource).path
end

#amendable_titleObject



8
9
10
# File 'app/events/decidim/amendable/amendment_base_event.rb', line 8

def amendable_title
  @amendable_title ||= translated_attribute(amendable_resource.title)
end

#amendable_typeObject



12
13
14
# File 'app/events/decidim/amendable/amendment_base_event.rb', line 12

def amendable_type
  @amendable_type ||= amendable_resource.class.model_name.human.downcase
end

#emendation_authorObject



20
21
22
23
24
25
26
27
28
# File 'app/events/decidim/amendable/amendment_base_event.rb', line 20

def emendation_author
  return unless emendation_resource

  @emendation_author ||= if emendation_resource.is_a?(Decidim::Coauthorable)
                           Decidim::UserPresenter.new(emendation_resource.creator_author)
                         else
                           Decidim::UserPresenter.new(emendation_resource.author)
                         end
end

#emendation_author_nicknameObject



30
31
32
33
34
# File 'app/events/decidim/amendable/amendment_base_event.rb', line 30

def emendation_author_nickname
  return unless emendation_resource

  @emendation_author_nickname ||= emendation_author.nickname
end

#emendation_author_pathObject



36
37
38
39
40
# File 'app/events/decidim/amendable/amendment_base_event.rb', line 36

def emendation_author_path
  return unless emendation_resource

  @emendation_author_path ||= emendation_author.profile_path
end

#emendation_pathObject



42
43
44
45
46
# File 'app/events/decidim/amendable/amendment_base_event.rb', line 42

def emendation_path
  return unless emendation_resource

  @emendation_path ||= Decidim::ResourceLocatorPresenter.new(emendation_resource).path
end