Class: Decidim::Amendable::AmendmentBaseEvent

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

Instance Method Summary collapse

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 ||= translated_attribute(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