Skip to content
Snippets Groups Projects
Commit 3e415e24 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

elements

parent afdce793
No related branches found
No related tags found
No related merge requests found
class Communication::Block::Template::Base
class_attribute :components_descriptions, :layouts
class_attribute :components_descriptions,
:layouts,
:element_class
attr_reader :block
......@@ -29,6 +31,10 @@ class Communication::Block::Template::Base
self.layouts = list
end
def self.has_elements(element_class)
self.element_class = element_class
end
def self.has_component(property, kind)
self.components_descriptions ||= []
self.components_descriptions << { name: property, type: kind }
......@@ -92,7 +98,8 @@ class Communication::Block::Template::Base
end
def default_element
nil
return if self.class.element_class.nil?
self.class.element_class.new block
end
def elements
......
class Communication::Block::Template::Gallery < Communication::Block::Template::Base
has_layouts [:grid, :carousel]
def default_element
Communication::Block::Template::Gallery::Image.new block
end
has_elements Communication::Block::Template::Gallery::Image
def build_git_dependencies
add_dependency active_storage_blobs
......
......@@ -20,10 +20,6 @@ class Communication::Block::Template::Page < Communication::Block::Template::Bas
@main_page ||= page(data['page_id'])
end
def layout
data['layout'] || 'grid'
end
def show_main_description
data['show_main_description'] || false
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment