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

to js problem

parent 6e170c7f
No related branches found
No related tags found
No related merge requests found
...@@ -95,14 +95,14 @@ class Communication::Block::Template::Base ...@@ -95,14 +95,14 @@ class Communication::Block::Template::Base
university.active_storage_blobs.find id university.active_storage_blobs.find id
end end
protected
def default_data def default_data
{ {
'elements' => [] 'elements' => []
} }
end end
protected
def load_data def load_data
return if @data_loaded return if @data_loaded
# Accessing the data loads it from database # Accessing the data loads it from database
......
...@@ -4,6 +4,10 @@ class Communication::Block::Template::Gallery < Communication::Block::Template:: ...@@ -4,6 +4,10 @@ class Communication::Block::Template::Gallery < Communication::Block::Template::
# has_select :layout, options: LAYOUTS, default: LAYOUTS.first # has_select :layout, options: LAYOUTS, default: LAYOUTS.first
def element
Communication::Block::Template::Gallery::Image.new block
end
def build_git_dependencies def build_git_dependencies
add_dependency active_storage_blobs add_dependency active_storage_blobs
end end
......
class Communication::Block::Template::Gallery::Image < Communication::Block::Template::Base
has_image :image
has_rich_text :text
def default_data
{
'alt' => '',
'credit' => '',
'file' => {}
}
end
end
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
layouts: Communication::Block::Template::Gallery::LAYOUTS, layouts: Communication::Block::Template::Gallery::LAYOUTS,
horizontal: true %> horizontal: true %>
<a class="<%= button_classes('mb-4') %>" <a class="<%= button_classes('mb-4') %>"
v-on:click="data.elements.push({alt: '', credit: '', file: {}})"> v-on:click="data.elements.push(<%= raw @block.template.element.default_data.to_s %>)">
<%= t '.add_image' %> <%= t '.add_image' %>
</a> </a>
......
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