Class: Decidim::ParticipatoryProcesses::CreateDemocraticQualityIndicatorsPage
- Inherits:
-
Command
- Object
- Command
- Decidim::ParticipatoryProcesses::CreateDemocraticQualityIndicatorsPage
- Defined in:
- app/commands/decidim/participatory_processes/create_democratic_quality_indicators_page.rb
Instance Method Summary collapse
-
#call ⇒ Decidim::StaticPage
Executes the command that creates the required static page or returns it if it already exists.
-
#initialize(organization_id) ⇒ CreateDemocraticQualityIndicatorsPage
constructor
Public: Initializes the command.
Constructor Details
#initialize(organization_id) ⇒ CreateDemocraticQualityIndicatorsPage
Public: Initializes the command.
9 10 11 |
# File 'app/commands/decidim/participatory_processes/create_democratic_quality_indicators_page.rb', line 9 def initialize(organization_id) @organization = Decidim::Organization.find(organization_id) end |
Instance Method Details
#call ⇒ Decidim::StaticPage
Executes the command that creates the required static page or returns it if it already exists.
16 17 18 19 20 21 22 23 |
# File 'app/commands/decidim/participatory_processes/create_democratic_quality_indicators_page.rb', line 16 def call StaticPage.find_or_create_by!(organization:, slug: "democratic-quality-indicators") do |page| page.decidim_organization_id = organization.id page.title = localized_attribute(organization, :title) page.content = localized_attribute(organization, :content) page.allow_public_access = true end end |