diff --git a/app/models/communication/block/template/gallery/image.rb b/app/models/communication/block/template/gallery/image.rb index 6221774cd5158e6ea007879e958e63de38fc0b68..6dc5a8e2c128a8275b4c53d6f261669bf0ae5213 100644 --- a/app/models/communication/block/template/gallery/image.rb +++ b/app/models/communication/block/template/gallery/image.rb @@ -14,7 +14,8 @@ class Communication::Block::Template::Gallery::Image < Communication::Block::Tem 'id' => '' }, 'alt' => '', - 'credit' => '' + 'credit' => '', + 'text' => '' } end end diff --git a/app/views/admin/communication/blocks/components/image/_static.html.erb b/app/views/admin/communication/blocks/components/image/_static.html.erb index af09d1a547133a5e075b834f2f102d6de75718a4..a0a65ccdf1765b81cf55a015e86064501333da10 100644 --- a/app/views/admin/communication/blocks/components/image/_static.html.erb +++ b/app/views/admin/communication/blocks/components/image/_static.html.erb @@ -2,9 +2,14 @@ component = template.public_send "#{property}_component" blob = component.blob depth ||= 3 +list ||= false indentation = ' ' * depth +return unless blob %> -<% if blob %> +<% if list %> +<%= indentation %>- id: "<%= blob.id %>" +<%= indentation %> file: "<%= blob.id %>" +<% else %> <%= indentation %><%= property %>: <%= indentation %> id: "<%= blob.id %>" <%= indentation %> file: "<%= blob.id %>" diff --git a/app/views/admin/communication/blocks/components/layout/_static.html.erb b/app/views/admin/communication/blocks/components/layout/_static.html.erb index 21c135f27b97611eb6b69389f1e75d64d7fa97ba..2d29f732a5b8526052f7e06b2bc086403bf047af 100644 --- a/app/views/admin/communication/blocks/components/layout/_static.html.erb +++ b/app/views/admin/communication/blocks/components/layout/_static.html.erb @@ -1 +1 @@ - layout: <%= @block.template.layout %> + layout: <%= template.layout %> diff --git a/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb b/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb index 4307e5f9e59a12f7d272dfd416fcfc2097be6e13..e1ae5e3a537024ccd774d7b6552437d8519baa5b 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb @@ -1,11 +1,17 @@ <div class="row"> <% @block.template.elements.each do |element| %> + <% next unless element.blob %> <div class="col-6"> <article class="card"> <%= block_component_preview :image, template: element %> <div class="card-body"> - <p class="mb-0"><%= element.alt %></p> - <p class="mb-0 small"><%= element.text %></p> + <p class="small mb-0"> + <%= block_component_preview :alt, template: element %> + <%= block_component_preview :credit, template: element %> + </p> + <p class="mb-0"> + <%= block_component_preview :text, template: element %> + </p> </div> </article> </div> diff --git a/app/views/admin/communication/blocks/templates/gallery/_static.html.erb b/app/views/admin/communication/blocks/templates/gallery/_static.html.erb index 06a195a30351a3db4fc2f886d1a8ed92ea675412..860632e82d067f50f0af21b01a7cd3651394b072 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_static.html.erb @@ -2,18 +2,8 @@ images: <% block.template.elements.each do |element| %> <% next unless element.blob %> - - -<%= block_component_static :image, template: element, depth: 5 %> -<%= block_component_static :alt, template: element, depth: 6 %> -<%= block_component_static :credit, template: element, depth: 6 %> -<%= block_component_static :text, template: element, depth: 6 %> - - id: "<%= element.blob.id %>" - file: "<%= element.blob.id %>" - alt: > - <%= prepare_text_for_static element.alt, 6 %> - credit: > - <%= prepare_text_for_static element.credit, 6 %> - text: > - <%= prepare_text_for_static element.text, 6 %> - +<%= block_component_static :image, template: element, depth: 4, list: true %> +<%= block_component_static :alt, template: element, depth: 5 %> +<%= block_component_static :credit, template: element, depth: 5 %> +<%= block_component_static :text, template: element, depth: 5 %> <% end %>