Class: Decidim::ParticipatorySpaceManifestPresenter

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/presenters/decidim/participatory_space_manifest_presenter.rb

Overview

A context aware presenter for participatory space manifest for translations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(manifest, organization) ⇒ ParticipatorySpaceManifestPresenter

Returns a new instance of ParticipatorySpaceManifestPresenter.



8
9
10
11
12
# File 'app/presenters/decidim/participatory_space_manifest_presenter.rb', line 8

def initialize(manifest, organization)
  super(manifest)

  @organization = organization
end

Instance Attribute Details

#organizationObject (readonly)

Returns the value of attribute organization.



6
7
8
# File 'app/presenters/decidim/participatory_space_manifest_presenter.rb', line 6

def organization
  @organization
end

Instance Method Details

#human_name(count: 1) ⇒ Object



14
15
16
17
18
# File 'app/presenters/decidim/participatory_space_manifest_presenter.rb', line 14

def human_name(count: 1)
  organization.available_locales.index_with do |locale|
    model_class.model_name.human(count:, locale:)
  end
end

#model_classObject



20
21
22
# File 'app/presenters/decidim/participatory_space_manifest_presenter.rb', line 20

def model_class
  model_class_name.constantize
end