Class: Decidim::Assemblies::AssemblyPresenter
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Decidim::Assemblies::AssemblyPresenter
- Includes:
- TranslationsHelper
- Defined in:
- app/presenters/decidim/assemblies/assembly_presenter.rb
Instance Method Summary collapse
- #area_name ⇒ Object
- #assembly ⇒ Object
- #assembly_type ⇒ Object
- #banner_image_url ⇒ Object
- #closing_date ⇒ Object
- #creation_date ⇒ Object
- #duration ⇒ Object
- #formatted_date(date) ⇒ Object
- #hero_image_url ⇒ Object
- #included_at ⇒ Object
Instance Method Details
#area_name ⇒ Object
16 17 18 19 20 |
# File 'app/presenters/decidim/assemblies/assembly_presenter.rb', line 16 def area_name return if assembly.area.blank? Decidim::AreaPresenter.new(assembly.area).translated_name_with_type end |
#assembly ⇒ Object
52 53 54 |
# File 'app/presenters/decidim/assemblies/assembly_presenter.rb', line 52 def assembly __getobj__ end |
#assembly_type ⇒ Object
40 41 42 43 44 |
# File 'app/presenters/decidim/assemblies/assembly_presenter.rb', line 40 def assembly_type return if assembly.assembly_type.blank? translated_attribute(assembly.assembly_type.title) end |
#banner_image_url ⇒ Object
12 13 14 |
# File 'app/presenters/decidim/assemblies/assembly_presenter.rb', line 12 def assembly.attached_uploader(:banner_image).url(host: assembly.organization.host) end |
#closing_date ⇒ Object
30 31 32 |
# File 'app/presenters/decidim/assemblies/assembly_presenter.rb', line 30 def closing_date formatted_date(assembly.closing_date) end |
#creation_date ⇒ Object
22 23 24 |
# File 'app/presenters/decidim/assemblies/assembly_presenter.rb', line 22 def creation_date formatted_date(assembly.creation_date) end |
#duration ⇒ Object
34 35 36 37 38 |
# File 'app/presenters/decidim/assemblies/assembly_presenter.rb', line 34 def duration return I18n.t("indefinite_duration", scope: "decidim.assemblies.assemblies.description") if (date = assembly.duration).blank? formatted_date(date) end |
#formatted_date(date) ⇒ Object
46 47 48 49 50 |
# File 'app/presenters/decidim/assemblies/assembly_presenter.rb', line 46 def formatted_date(date) return if date.blank? I18n.l(date, format: :decidim_short) end |
#hero_image_url ⇒ Object
8 9 10 |
# File 'app/presenters/decidim/assemblies/assembly_presenter.rb', line 8 def hero_image_url assembly.attached_uploader(:hero_image).url(host: assembly.organization.host) end |
#included_at ⇒ Object
26 27 28 |
# File 'app/presenters/decidim/assemblies/assembly_presenter.rb', line 26 def included_at formatted_date(assembly.included_at) end |