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

no components allowed

parent cb293f1d
No related branches found
No related tags found
No related merge requests found
class Communication::Block::Component::Image < Communication::Block::Component::Base class Communication::Block::Component::Image < Communication::Block::Component::Base
def data def data
# Loading the blob when needed, not saved in the database
@data['blob'] = template.blob_with_id @data['id'] if @data&.has_key? 'id' @data['blob'] = template.blob_with_id @data['id'] if @data&.has_key? 'id'
@data @data
end end
end end
...@@ -87,6 +87,10 @@ class Communication::Block::Template::Base ...@@ -87,6 +87,10 @@ class Communication::Block::Template::Base
[] []
end end
def elements
data['elements']
end
def blob_with_id(id) def blob_with_id(id)
university.active_storage_blobs.find id university.active_storage_blobs.find id
end end
...@@ -138,6 +142,7 @@ class Communication::Block::Template::Base ...@@ -138,6 +142,7 @@ class Communication::Block::Template::Base
end end
def components def components
return [] if self.class.fields.nil?
self.class.fields.map do |field| self.class.fields.map do |field|
send "#{field[:name]}_component" send "#{field[:name]}_component"
end end
......
...@@ -2,7 +2,7 @@ class Communication::Block::Template::Gallery < Communication::Block::Template:: ...@@ -2,7 +2,7 @@ class Communication::Block::Template::Gallery < Communication::Block::Template::
LAYOUTS = [:grid, :carousel].freeze LAYOUTS = [:grid, :carousel].freeze
has_select :layout, options: LAYOUTS, default: LAYOUTS.first # has_select :layout, options: LAYOUTS, default: LAYOUTS.first
def build_git_dependencies def build_git_dependencies
add_dependency active_storage_blobs add_dependency active_storage_blobs
......
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