Class: Decidim::Amendable::AmendmentBaseEvent

Inherits:
Events::SimpleEvent show all
Defined in:
decidim-core/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 SanitizeHelper

#decidim_html_escape, #decidim_sanitize, #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

#initialize, #resource_locator, #resource_path, #resource_text, #resource_title, #resource_url, #safe_resource_text, type

Methods included from TranslatableAttributes

#default_locale?

Constructor Details

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

Instance Method Details

#amendable_pathObject


16
17
18
# File 'decidim-core/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 'decidim-core/app/events/decidim/amendable/amendment_base_event.rb', line 8

def amendable_title
  @amendable_title ||= amendable_resource.title
end

#amendable_typeObject


12
13
14
# File 'decidim-core/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 'decidim-core/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 'decidim-core/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 'decidim-core/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 'decidim-core/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