Class: Decidim::System::CreateDefaultPages
- Inherits:
-
Command
- Object
- Command
- Decidim::System::CreateDefaultPages
- Defined in:
- app/commands/decidim/system/create_default_pages.rb
Overview
A command with all the business logic when creating a new organization in the system. It creates the organization and invites the admin to the system.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(organization) ⇒ CreateDefaultPages
constructor
Public: Initializes the command.
Constructor Details
#initialize(organization) ⇒ CreateDefaultPages
Public: Initializes the command.
form - A form object with the params.
12 13 14 |
# File 'app/commands/decidim/system/create_default_pages.rb', line 12 def initialize(organization) @organization = organization end |
Instance Method Details
#call ⇒ Object
Executes the command.
Returns nothing.
19 20 21 22 23 24 25 26 27 28 |
# File 'app/commands/decidim/system/create_default_pages.rb', line 19 def call Decidim::StaticPage::DEFAULT_PAGES.map do |slug| Decidim::StaticPage.find_or_create_by!(organization: organization, slug: slug) do |page| page.title = localized_attribute(slug, :title) page.content = localized_attribute(slug, :content) page. = true page.allow_public_access = true if slug == "terms-and-conditions" end end end |