Class: Decidim::ParticipatorySpaceManifest
- Inherits:
-
Object
- Object
- Decidim::ParticipatorySpaceManifest
- Includes:
- ActiveModel::Model
- Defined in:
- lib/decidim/participatory_space_manifest.rb
Overview
This class handles all the logic associated to configuring a participatory space, the highest level object of Decidim.
It’s normally not used directly but through the API exposed through ‘Decidim.register_participatory_space`.
Instance Method Summary collapse
-
#context(name = :public, &block) ⇒ Object
A context used to set the layout and behavior of a participatory space.
-
#route_name ⇒ Object
The name of the named Rails route to create the url to the resource.
-
#seed! ⇒ Object
Public: Creates the seeds for this features in order to populate the database.
-
#seeds(&block) ⇒ Object
Public: A block that gets called when seeding for this feature takes place.
Instance Method Details
#context(name = :public, &block) ⇒ Object
A context used to set the layout and behavior of a participatory space. Full documentation can be found looking at the ‘ParticipatorySpaceContextManifest` class.
Example:
context(:public) do |context|
context.layout "layouts/decidim/some_layout"
end
context(:public).layout
# => "layouts/decidim/some_layout"
Returns Nothing.
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/decidim/participatory_space_manifest.rb', line 44 def context(name = :public, &block) name = name.to_sym @contexts ||= {} if block context = ParticipatorySpaceContextManifest.new context.instance_eval(&block) @contexts[name] = context end @contexts.fetch(name) end |
#route_name ⇒ Object
The name of the named Rails route to create the url to the resource.
Returns a String.
74 75 76 |
# File 'lib/decidim/participatory_space_manifest.rb', line 74 def route_name super || model_class_name.demodulize.underscore end |
#seed! ⇒ Object
Public: Creates the seeds for this features in order to populate the database.
Returns nothing.
67 68 69 |
# File 'lib/decidim/participatory_space_manifest.rb', line 67 def seed! @seeds&.call end |
#seeds(&block) ⇒ Object
Public: A block that gets called when seeding for this feature takes place.
Returns nothing.
60 61 62 |
# File 'lib/decidim/participatory_space_manifest.rb', line 60 def seeds(&block) @seeds = block end |