diff --git a/app/helpers/admin/blocks_helper.rb b/app/helpers/admin/blocks_helper.rb index 8fd5fd1ef0ca11ba5045047a8d6b62e8b49875f4..20d23bf059aa311bd7cb362c1d9f236f2a6d25b4 100644 --- a/app/helpers/admin/blocks_helper.rb +++ b/app/helpers/admin/blocks_helper.rb @@ -1,25 +1,36 @@ module Admin::BlocksHelper - def block_component_edit(property, **options) + def block_component_edit(block, property, **options) render 'admin/communication/blocks/components/edit', + block: block, property: property, **options end - def block_component_preview(property, **options) - render 'admin/communication/blocks/components/preview', + def block_component_snippet(block, property, **options) + render 'admin/communication/blocks/components/snippet', + block: block, property: property, **options end - def block_component_static(property, **options) + def block_component_show(block, property, **options) + render 'admin/communication/blocks/components/show', + block: block, + property: property, + **options + end + + def block_component_static(block, property, **options) render 'admin/communication/blocks/components/static', + block: block, property: property, **options end - def block_component_add_element(label) + def block_component_add_element(block, label) render 'admin/communication/blocks/components/add_element/edit', + block: block, label: label end end diff --git a/app/views/admin/communication/blocks/_block.html.erb b/app/views/admin/communication/blocks/_block.html.erb index 6b250bb2583b6b374e45cbad59920de8904dfade..f4199c90023a781dfbde0e8851af96963d117721 100644 --- a/app/views/admin/communication/blocks/_block.html.erb +++ b/app/views/admin/communication/blocks/_block.html.erb @@ -18,11 +18,7 @@ </span> </div> <div class="blocks__list__preview"> - <% - @block = block - @template = @block.template - %> - <%= render "admin/communication/blocks/templates/#{@block.template_kind}/preview" %> + <%= render "admin/communication/blocks/templates/#{block.template_kind}/snippet", block: block %> </div> <%= render 'admin/application/a11y/status', about: block unless block.accessible? %> </article> diff --git a/app/views/admin/communication/blocks/_block_static.html.erb b/app/views/admin/communication/blocks/_block_static.html.erb deleted file mode 100644 index e0deae9858fd0365d71898734579f44ec184f9b7..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/_block_static.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -<% -template_path = "admin/communication/blocks/templates/#{@block.template_kind}/static" -should_render_data = @block.data && @block.data.present? -%> - - kind: block - template: <%= @block.template_kind %> - position: <%= @block.position %> - data: -<%= render template_path, - block: @block, - about: @block.about if should_render_data %> diff --git a/app/views/admin/communication/blocks/_block_static.json.jbuilder b/app/views/admin/communication/blocks/_block_static.json.jbuilder deleted file mode 100644 index d40e6fa31a58d1f9a8b9456a1283af2f260ac9f5..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/_block_static.json.jbuilder +++ /dev/null @@ -1,6 +0,0 @@ -json.kind 'block' -json.position block.position -json.template block.template_kind -json.data do - json.partial! "admin/communication/blocks/templates/#{block.template_kind}/static", block: block -end \ No newline at end of file diff --git a/app/views/admin/communication/blocks/_list.html.erb b/app/views/admin/communication/blocks/_list.html.erb deleted file mode 100644 index a3025dc263078f220f412d717bf2621627f49076..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/_list.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<% about.blocks.published.ordered.each do |block| %> - <% @block = block %> - <%= render "admin/communication/blocks/templates/#{@block.template_kind}/show" %> -<% end %> diff --git a/app/views/admin/communication/blocks/_static.html.erb b/app/views/admin/communication/blocks/_static.html.erb index 9280c0fb6d1739700c356acc60a0bdaca7bec3fa..226c469b0b03cbf5e8dce44e4c7ba2999e6bfb0d 100644 --- a/app/views/admin/communication/blocks/_static.html.erb +++ b/app/views/admin/communication/blocks/_static.html.erb @@ -1,24 +1,11 @@ <% -@university = about.university +template_path = "admin/communication/blocks/templates/#{block.template_kind}/static" +should_render_data = block.data && block.data.present? %> -content: -<% about.blocks.with_no_heading.published.ordered.each do |block| @block = block %> -<%= render 'admin/communication/blocks/block_static' %> -<% end %> -<% about.headings.root.each do |heading| @heading = heading %> -<%= render 'admin/communication/blocks/headings/heading_static' %> -<% end %> -<% if about.blocks.any? %> -blocks: -<% about.blocks.published.ordered.each do |block| - @block = block - @university = about.university - %> - - template: <%= block.template_kind %> - title: >- - <%= prepare_text_for_static block.title, 3 %> + - kind: block + template: <%= block.template_kind %> position: <%= block.position %> data: -<%= render "admin/communication/blocks/templates/#{block.template_kind}/static", - block: block, about: about if block.data && block.data.present? %><% end %> -<% end %> +<%= render template_path, + block: block, + about: block.about if should_render_data %> diff --git a/app/views/admin/communication/blocks/_static.json.jbuilder b/app/views/admin/communication/blocks/_static.json.jbuilder index ed38ad869118151a167365a7db4f8ca6fc1ec7e3..d40e6fa31a58d1f9a8b9456a1283af2f260ac9f5 100644 --- a/app/views/admin/communication/blocks/_static.json.jbuilder +++ b/app/views/admin/communication/blocks/_static.json.jbuilder @@ -1,6 +1,6 @@ -json.content about.content do |block_or_heading| - if block_or_heading.is_a? Communication::Block - json.partial! 'admin/communication/blocks/block_static', block: block_or_heading - else - end +json.kind 'block' +json.position block.position +json.template block.template_kind +json.data do + json.partial! "admin/communication/blocks/templates/#{block.template_kind}/static", block: block end \ No newline at end of file diff --git a/app/views/admin/communication/blocks/components/_edit.html.erb b/app/views/admin/communication/blocks/components/_edit.html.erb index f3c6a8352944be21b27cfb764eca6860d68614e1..11b4f5b31b16bc9376e847d3939f42dbc3f4005b 100644 --- a/app/views/admin/communication/blocks/components/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/_edit.html.erb @@ -1,9 +1,9 @@ <% -template ||= @block.template +template ||= block.template component = template.public_send "#{property}_component" i18n = "admin.communication.blocks.templates.#{template.kind}.edit" -template ||= @block.template -root_template = template == @block.template +# Distinguish between explicit template and implicit template +root_template = template == block.template if root_template model = 'data' dom_id = "'#{property}'" diff --git a/app/views/admin/communication/blocks/components/_preview.html.erb b/app/views/admin/communication/blocks/components/_show.html.erb similarity index 88% rename from app/views/admin/communication/blocks/components/_preview.html.erb rename to app/views/admin/communication/blocks/components/_show.html.erb index dba5b4cd59f6d2924e94f54c4516d8f9b743eee2..2824a1b56d0ee2271d51a5097df01d65b8bb4f00 100644 --- a/app/views/admin/communication/blocks/components/_preview.html.erb +++ b/app/views/admin/communication/blocks/components/_show.html.erb @@ -1,8 +1,8 @@ <% -template ||= @block.template +template ||= block.template component = template.public_send "#{property}_component" value = template.public_send(property).to_s -partial = "admin/communication/blocks/components/#{component.kind}/preview" +partial = "admin/communication/blocks/components/#{component.kind}/show" local_assigns[:template] = template local_assigns[:component] = component diff --git a/app/views/admin/communication/blocks/components/_snippet.html.erb b/app/views/admin/communication/blocks/components/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..1b53d6be6b812827ebbc10f9c9c0b24ac13ff29b --- /dev/null +++ b/app/views/admin/communication/blocks/components/_snippet.html.erb @@ -0,0 +1,11 @@ +<% +template ||= block.template +component = template.public_send "#{property}_component" +value = template.public_send(property).to_s +partial = "admin/communication/blocks/components/#{component.kind}/snippet" + +local_assigns[:template] = template +local_assigns[:component] = component +local_assigns[:value] = value +%> +<%= render partial, **local_assigns %> diff --git a/app/views/admin/communication/blocks/components/_static.html.erb b/app/views/admin/communication/blocks/components/_static.html.erb index 57e05ca8e986fb907adfbae46e0da2aea74e42aa..9d1eec353bbe4c85750c0bc1ebcf532f19815b70 100644 --- a/app/views/admin/communication/blocks/components/_static.html.erb +++ b/app/views/admin/communication/blocks/components/_static.html.erb @@ -1,5 +1,5 @@ <% -template ||= @block.template +template ||= block.template component = template.public_send "#{property}_component" value = template.public_send property depth ||= 3 diff --git a/app/views/admin/communication/blocks/components/array/_preview.html.erb b/app/views/admin/communication/blocks/components/array/_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/array/_preview.html.erb rename to app/views/admin/communication/blocks/components/array/_show.html.erb diff --git a/app/views/admin/communication/blocks/components/array/_snippet.html.erb b/app/views/admin/communication/blocks/components/array/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..9d061a81fa66af0b0997ab7d24c185bc878ff6ae --- /dev/null +++ b/app/views/admin/communication/blocks/components/array/_snippet.html.erb @@ -0,0 +1,6 @@ +<% +array = value.blank? ? [] : JSON.parse(value) +%> +<% array.each do |item| %> + <td><%= item %></td> +<% end %> diff --git a/app/views/admin/communication/blocks/components/boolean/_preview.html.erb b/app/views/admin/communication/blocks/components/boolean/_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/boolean/_preview.html.erb rename to app/views/admin/communication/blocks/components/boolean/_show.html.erb diff --git a/app/views/admin/communication/blocks/components/number/_preview.html.erb b/app/views/admin/communication/blocks/components/boolean/_snippet.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/number/_preview.html.erb rename to app/views/admin/communication/blocks/components/boolean/_snippet.html.erb diff --git a/app/views/admin/communication/blocks/components/category/_edit.html.erb b/app/views/admin/communication/blocks/components/category/_edit.html.erb index 81468e51d217ba7c09c13fe351488a2cbd055ad3..d815d523f1aee23c89f8a4924efc18b72bde4b06 100644 --- a/app/views/admin/communication/blocks/components/category/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/category/_edit.html.erb @@ -1,4 +1,4 @@ -<% categories = collection_tree(@block.about&.website.categories.for_language(@block.language)) %> +<% categories = collection_tree(block.about&.website.categories.for_language(block.language)) %> <label class="form-label" :for="<%= dom_id.html_safe %>"> <%= label %> diff --git a/app/views/admin/communication/blocks/components/category/_preview.html.erb b/app/views/admin/communication/blocks/components/category/_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/category/_preview.html.erb rename to app/views/admin/communication/blocks/components/category/_show.html.erb diff --git a/app/views/admin/communication/blocks/components/category/_snippet.html.erb b/app/views/admin/communication/blocks/components/category/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..1a4ddd3f77296f4bad90fa7050f29c737ef117ad --- /dev/null +++ b/app/views/admin/communication/blocks/components/category/_snippet.html.erb @@ -0,0 +1 @@ +<%= component.category.to_s %> diff --git a/app/views/admin/communication/blocks/components/code/_preview.html.erb b/app/views/admin/communication/blocks/components/code/_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/code/_preview.html.erb rename to app/views/admin/communication/blocks/components/code/_show.html.erb diff --git a/app/views/admin/communication/blocks/components/code/_snippet.html.erb b/app/views/admin/communication/blocks/components/code/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..4c4e1d3fd8bbd67b8b5b90cf74f6cefeea9271f4 --- /dev/null +++ b/app/views/admin/communication/blocks/components/code/_snippet.html.erb @@ -0,0 +1 @@ +<%= value.truncate(250) %> diff --git a/app/views/admin/communication/blocks/components/file/_preview.html.erb b/app/views/admin/communication/blocks/components/file/_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/file/_preview.html.erb rename to app/views/admin/communication/blocks/components/file/_show.html.erb diff --git a/app/views/admin/communication/blocks/components/option/_preview.html.erb b/app/views/admin/communication/blocks/components/file/_snippet.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/option/_preview.html.erb rename to app/views/admin/communication/blocks/components/file/_snippet.html.erb diff --git a/app/views/admin/communication/blocks/components/image/_preview.html.erb b/app/views/admin/communication/blocks/components/image/_show.html.erb similarity index 76% rename from app/views/admin/communication/blocks/components/image/_preview.html.erb rename to app/views/admin/communication/blocks/components/image/_show.html.erb index 8d40fa51aaec7cf58aa816965c5c89de085f49e0..9468992f4ebc7cf13d6d2b4d08d735cc8a0731b5 100644 --- a/app/views/admin/communication/blocks/components/image/_preview.html.erb +++ b/app/views/admin/communication/blocks/components/image/_show.html.erb @@ -1,7 +1,7 @@ <% blob = component.blob return unless blob -is_carousel = @block.template.is_a?(Communication::Block::Template::Gallery) && @block.template.layout == "carousel" +is_carousel = block.template.is_a?(Communication::Block::Template::Gallery) && block.template.layout == "carousel" %> <figure <% if is_carousel %>class="splide__slide"<% end %>> diff --git a/app/views/admin/communication/blocks/components/image/_snippet.html.erb b/app/views/admin/communication/blocks/components/image/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..9468992f4ebc7cf13d6d2b4d08d735cc8a0731b5 --- /dev/null +++ b/app/views/admin/communication/blocks/components/image/_snippet.html.erb @@ -0,0 +1,12 @@ +<% +blob = component.blob +return unless blob +is_carousel = block.template.is_a?(Communication::Block::Template::Gallery) && block.template.layout == "carousel" +%> + +<figure <% if is_carousel %>class="splide__slide"<% end %>> + <%= kamifusen_tag blob, width: 600, class: 'img-fluid mb-1', alt: component.template.try(:alt).blank? ? "" : component.template.alt %> + <figcaption> + <%= sanitize component.template.credit if component.template.try(:credit).present? %> + </figcaption> +</figure> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/components/layout/_preview.html.erb b/app/views/admin/communication/blocks/components/layout/_preview.html.erb deleted file mode 100644 index 22e6f2ef1a3a2ab32e2c4ba27fa1f1f38f23e7dc..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/components/layout/_preview.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% -i18n = "admin.communication.blocks.templates.#{template.kind}.layouts.#{component.data}" -name = t "#{i18n}.label" -%> -<span class="badge bg-primary mb-3"> - <%= name %> -</span> diff --git a/app/views/admin/communication/blocks/components/layout/_show.html.erb b/app/views/admin/communication/blocks/components/layout/_show.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..0754f71927a27dbe2b86bfe96c5244fcaa134c4f --- /dev/null +++ b/app/views/admin/communication/blocks/components/layout/_show.html.erb @@ -0,0 +1,3 @@ +<span class="badge bg-primary mb-3"> + <%= t "admin.communication.blocks.templates.#{template.kind}.layouts.#{component.data}.label" %> +</span> diff --git a/app/views/admin/communication/blocks/components/layout/_snippet.html.erb b/app/views/admin/communication/blocks/components/layout/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..840b485d22793772863b9fc3cace8aebde062b15 --- /dev/null +++ b/app/views/admin/communication/blocks/components/layout/_snippet.html.erb @@ -0,0 +1 @@ +<%= t "admin.communication.blocks.templates.#{template.kind}.layouts.#{component.data}.label" %> diff --git a/app/views/admin/communication/blocks/components/string/_preview.html.erb b/app/views/admin/communication/blocks/components/number/_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/string/_preview.html.erb rename to app/views/admin/communication/blocks/components/number/_show.html.erb diff --git a/app/views/admin/communication/blocks/components/number/_snippet.html.erb b/app/views/admin/communication/blocks/components/number/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..39fbb33ec823c262796bee0ab0836f7aae6567e3 --- /dev/null +++ b/app/views/admin/communication/blocks/components/number/_snippet.html.erb @@ -0,0 +1 @@ +<%= value %> diff --git a/app/views/admin/communication/blocks/components/page/_preview.html.erb b/app/views/admin/communication/blocks/components/option/_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/page/_preview.html.erb rename to app/views/admin/communication/blocks/components/option/_show.html.erb diff --git a/app/views/admin/communication/blocks/templates/features/_preview.html.erb b/app/views/admin/communication/blocks/components/option/_snippet.html.erb similarity index 100% rename from app/views/admin/communication/blocks/templates/features/_preview.html.erb rename to app/views/admin/communication/blocks/components/option/_snippet.html.erb diff --git a/app/views/admin/communication/blocks/components/organization/_preview.html.erb b/app/views/admin/communication/blocks/components/organization/_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/organization/_preview.html.erb rename to app/views/admin/communication/blocks/components/organization/_show.html.erb diff --git a/app/views/admin/communication/blocks/components/organization/_snippet.html.erb b/app/views/admin/communication/blocks/components/organization/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e303dbb1e599492d3fab25cb049faed14ea81874 --- /dev/null +++ b/app/views/admin/communication/blocks/components/organization/_snippet.html.erb @@ -0,0 +1 @@ +<%= component.organization.to_s %> diff --git a/app/views/admin/communication/blocks/components/page/_edit.html.erb b/app/views/admin/communication/blocks/components/page/_edit.html.erb index fa13fccaeae883a19bc4c627ba95131c7eeee46e..47d3fc43d23ca67ea280196af15a7595305160e3 100644 --- a/app/views/admin/communication/blocks/components/page/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/page/_edit.html.erb @@ -1,5 +1,5 @@ <% -pages = collection_tree(@block.about&.website.pages.for_language(@block.language)) +pages = collection_tree(block.about&.website.pages.for_language(block.language)) %> <% unless label.blank? %> <label class="form-label" diff --git a/app/views/admin/communication/blocks/components/page/_show.html.erb b/app/views/admin/communication/blocks/components/page/_show.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..30383a9cadb47424fc2dce5aba2a8ba88495e9e4 --- /dev/null +++ b/app/views/admin/communication/blocks/components/page/_show.html.erb @@ -0,0 +1 @@ +<%= component.page.to_s %> diff --git a/app/views/admin/communication/blocks/components/page/_snippet.html.erb b/app/views/admin/communication/blocks/components/page/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..30383a9cadb47424fc2dce5aba2a8ba88495e9e4 --- /dev/null +++ b/app/views/admin/communication/blocks/components/page/_snippet.html.erb @@ -0,0 +1 @@ +<%= component.page.to_s %> diff --git a/app/views/admin/communication/blocks/components/person/_edit.html.erb b/app/views/admin/communication/blocks/components/person/_edit.html.erb index ec05a677b040edbfae07cf6994270e53b44dab47..051729914febe6260625e076b5ddf9798331462d 100644 --- a/app/views/admin/communication/blocks/components/person/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/person/_edit.html.erb @@ -1,4 +1,4 @@ -<% people = current_university.people.for_language(@block.language).ordered %> +<% people = current_university.people.for_language(block.language).ordered %> <% unless label.blank? %> <label class="form-label" :for="<%= dom_id.html_safe %>"> diff --git a/app/views/admin/communication/blocks/components/person/_preview.html.erb b/app/views/admin/communication/blocks/components/person/_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/person/_preview.html.erb rename to app/views/admin/communication/blocks/components/person/_show.html.erb diff --git a/app/views/admin/communication/blocks/components/person/_snippet.html.erb b/app/views/admin/communication/blocks/components/person/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..c6c01864d09367e1dcb7a8c76029632aec899b7b --- /dev/null +++ b/app/views/admin/communication/blocks/components/person/_snippet.html.erb @@ -0,0 +1 @@ +<%= component.person.to_s %> diff --git a/app/views/admin/communication/blocks/components/post/_edit.html.erb b/app/views/admin/communication/blocks/components/post/_edit.html.erb index 594ad08b394a3748bfd3f4c81ccb19be12b60974..06f07924268870ca44628709834b2fd50aab769a 100644 --- a/app/views/admin/communication/blocks/components/post/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/post/_edit.html.erb @@ -1,4 +1,4 @@ -<% posts = @block.about&.website.posts.for_language(@block.language).ordered %> +<% posts = block.about&.website.posts.for_language(block.language).ordered %> <label class="form-label <%= 'visually-hidden' if label.blank? %>" :for="<%= dom_id.html_safe %>"> <%= label %> diff --git a/app/views/admin/communication/blocks/components/post/_preview.html.erb b/app/views/admin/communication/blocks/components/post/_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/post/_preview.html.erb rename to app/views/admin/communication/blocks/components/post/_show.html.erb diff --git a/app/views/admin/communication/blocks/components/post/_snippet.html.erb b/app/views/admin/communication/blocks/components/post/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..0a44bd0c0588940acbbf20c5185923bef9db2d04 --- /dev/null +++ b/app/views/admin/communication/blocks/components/post/_snippet.html.erb @@ -0,0 +1 @@ +<%= component.post.to_s %> diff --git a/app/views/admin/communication/blocks/components/program/_preview.html.erb b/app/views/admin/communication/blocks/components/program/_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/program/_preview.html.erb rename to app/views/admin/communication/blocks/components/program/_show.html.erb diff --git a/app/views/admin/communication/blocks/components/program/_snippet.html.erb b/app/views/admin/communication/blocks/components/program/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..01e730d526642e906e9ece422946bf3f96963c16 --- /dev/null +++ b/app/views/admin/communication/blocks/components/program/_snippet.html.erb @@ -0,0 +1 @@ +<%= component.program.to_s %> diff --git a/app/views/admin/communication/blocks/components/rich_text/_preview.html.erb b/app/views/admin/communication/blocks/components/rich_text/_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/rich_text/_preview.html.erb rename to app/views/admin/communication/blocks/components/rich_text/_show.html.erb diff --git a/app/views/admin/communication/blocks/components/rich_text/_snippet.html.erb b/app/views/admin/communication/blocks/components/rich_text/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..c533e1edd71d534c2b5598eedd8c6374df802903 --- /dev/null +++ b/app/views/admin/communication/blocks/components/rich_text/_snippet.html.erb @@ -0,0 +1 @@ +<%= strip_tags(value.html_safe).truncate(250) %> diff --git a/app/views/admin/communication/blocks/components/string/_show.html.erb b/app/views/admin/communication/blocks/components/string/_show.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..39fbb33ec823c262796bee0ab0836f7aae6567e3 --- /dev/null +++ b/app/views/admin/communication/blocks/components/string/_show.html.erb @@ -0,0 +1 @@ +<%= value %> diff --git a/app/views/admin/communication/blocks/components/string/_snippet.html.erb b/app/views/admin/communication/blocks/components/string/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..4c4e1d3fd8bbd67b8b5b90cf74f6cefeea9271f4 --- /dev/null +++ b/app/views/admin/communication/blocks/components/string/_snippet.html.erb @@ -0,0 +1 @@ +<%= value.truncate(250) %> diff --git a/app/views/admin/communication/blocks/components/text/_preview.html.erb b/app/views/admin/communication/blocks/components/text/_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/text/_preview.html.erb rename to app/views/admin/communication/blocks/components/text/_show.html.erb diff --git a/app/views/admin/communication/blocks/components/text/_snippet.html.erb b/app/views/admin/communication/blocks/components/text/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..4c4e1d3fd8bbd67b8b5b90cf74f6cefeea9271f4 --- /dev/null +++ b/app/views/admin/communication/blocks/components/text/_snippet.html.erb @@ -0,0 +1 @@ +<%= value.truncate(250) %> diff --git a/app/views/admin/communication/blocks/components/time_slot/_preview.html.erb b/app/views/admin/communication/blocks/components/time_slot/_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/components/time_slot/_preview.html.erb rename to app/views/admin/communication/blocks/components/time_slot/_show.html.erb diff --git a/app/views/admin/communication/blocks/components/time_slot/_snippet.html.erb b/app/views/admin/communication/blocks/components/time_slot/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e2e6fce5a0df2df235a7d2ccfcd631a106e70cf5 --- /dev/null +++ b/app/views/admin/communication/blocks/components/time_slot/_snippet.html.erb @@ -0,0 +1 @@ +<%= component.from %> → <%= component.to %> diff --git a/app/views/admin/communication/blocks/editor/_editor.html.erb b/app/views/admin/communication/blocks/content/_editor.html.erb similarity index 100% rename from app/views/admin/communication/blocks/editor/_editor.html.erb rename to app/views/admin/communication/blocks/content/_editor.html.erb diff --git a/app/views/admin/communication/blocks/content/_show.html.erb b/app/views/admin/communication/blocks/content/_show.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..6e24d9e9e92a164e8bb5b69623a56629e58d5305 --- /dev/null +++ b/app/views/admin/communication/blocks/content/_show.html.erb @@ -0,0 +1,6 @@ +<% about.blocks.with_no_heading.published.ordered.each do |block| %> + <%= render "admin/communication/blocks/templates/#{block.template_kind}/show", block: block %> +<% end %> +<% about.headings.root.each do |heading| %> + <%= render 'admin/communication/blocks/headings/show', heading: heading %> +<% end %> diff --git a/app/views/admin/communication/blocks/content/_static.html.erb b/app/views/admin/communication/blocks/content/_static.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..a0a6c08fd09779a227c18c7e41aa74a9afffcc18 --- /dev/null +++ b/app/views/admin/communication/blocks/content/_static.html.erb @@ -0,0 +1,21 @@ +<% +@university = about.university +%> +content: +<% about.blocks.with_no_heading.published.ordered.each do |block| %> +<%= render 'admin/communication/blocks/static', block: block %> +<% end %> +<% about.headings.root.each do |heading| %> +<%= render 'admin/communication/blocks/headings/static', heading: heading %> +<% end %> +<% if about.blocks.any? %> +blocks: +<% about.blocks.published.ordered.each do |block| %> + - template: <%= block.template_kind %> + title: >- + <%= prepare_text_for_static block.title, 3 %> + position: <%= block.position %> + data: +<%= render "admin/communication/blocks/templates/#{block.template_kind}/static", + block: block, about: about if block.data && block.data.present? %><% end %> +<% end %> diff --git a/app/views/admin/communication/blocks/content/_static.json.jbuilder b/app/views/admin/communication/blocks/content/_static.json.jbuilder new file mode 100644 index 0000000000000000000000000000000000000000..e0dda60b1d701f43b64ee9dd599d0bb9fd8fbf6d --- /dev/null +++ b/app/views/admin/communication/blocks/content/_static.json.jbuilder @@ -0,0 +1,7 @@ +# TODO est-ce utile ? Voir avec Alex en fonction de Vue +json.content about.content do |block_or_heading| + if block_or_heading.is_a? Communication::Block + json.partial! 'admin/communication/blocks/static', block: block_or_heading + else + end +end \ No newline at end of file diff --git a/app/views/admin/communication/blocks/headings/_heading_static.html.erb b/app/views/admin/communication/blocks/headings/_heading_static.html.erb deleted file mode 100644 index a03e792a2b574ab03f7e3e243263f4166bc70b5a..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/headings/_heading_static.html.erb +++ /dev/null @@ -1,12 +0,0 @@ - - kind: heading - title: >- - <%= prepare_text_for_static @heading.title, 3 %> - position: <%= @heading.position %> - level: <%= @heading.level %> -<% @heading.blocks.published.ordered.each do |block| @block = block %> -<%= render 'admin/communication/blocks/block_static' %> -<% end %> -<% children = @heading.children %> -<% children.ordered.each do |heading| @heading = heading %> -<%= render 'admin/communication/blocks/headings/heading_static' %> -<% end %> diff --git a/app/views/admin/communication/blocks/headings/_show.html.erb b/app/views/admin/communication/blocks/headings/_show.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..8c36bd521df060408526628ba712882fb39d3ea4 --- /dev/null +++ b/app/views/admin/communication/blocks/headings/_show.html.erb @@ -0,0 +1,12 @@ +<% +html_tag = "h#{heading.level}" +%> +<div class="container"> + <<%= html_tag %>><%= heading %></<%= html_tag %>> +</div> +<% heading.blocks.each do |block| %> + <%= render "admin/communication/blocks/templates/#{block.template_kind}/show", block: block %> +<% end %> +<% heading.children.each do |child| %> + <%= render 'admin/communication/blocks/headings/show', heading: child %> +<% end %> diff --git a/app/views/admin/communication/blocks/headings/_static.html.erb b/app/views/admin/communication/blocks/headings/_static.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e654f62945ef4937361ee811a1f414e092ebf77b --- /dev/null +++ b/app/views/admin/communication/blocks/headings/_static.html.erb @@ -0,0 +1,12 @@ + - kind: heading + title: >- + <%= prepare_text_for_static heading.title, 3 %> + position: <%= heading.position %> + level: <%= heading.level %> +<% heading.blocks.published.ordered.each do |block| %> +<%= render 'admin/communication/blocks/static', block: block %> +<% end %> +<% children = heading.children %> +<% children.ordered.each do |child| %> +<%= render 'admin/communication/blocks/headings/static', heading: child %> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb index b97988ebbe1ce48196c1b787ea90e09449260c7b..675083ffbd89bc3309cccbd1a7c8ec2094cec86e 100644 --- a/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb @@ -1,19 +1,19 @@ <div class="row pure__row--small mb-5"> <div class="col-md-6"> <div class="summernote"> - <%= block_component_edit :text, + <%= block_component_edit block, :text, label: t('admin.communication.blocks.components.text.label'), placeholder: t('admin.communication.blocks.components.text.placeholder') %> </div> </div> <div class="col-md-6"> - <%= block_component_edit :image, + <%= block_component_edit block, :image, label: t('admin.communication.blocks.components.image.input.label'), remove: t('admin.communication.blocks.components.image.input.remove') %> - <%= block_component_edit :alt, + <%= block_component_edit block, :alt, label: t('admin.communication.blocks.components.image.alt.label'), placeholder: t('admin.communication.blocks.components.image.alt.placeholder') %> - <%= block_component_edit :credit, + <%= block_component_edit block, :credit, label: t('admin.communication.blocks.components.image.credit.label'), placeholder: t('admin.communication.blocks.components.image.credit.placeholder'), summernote_config: 'link' %> @@ -31,14 +31,14 @@ <div class="flex-fill"> <div class="row pure__row--small mb-n3"> <div class="col-lg-4"> - <%= block_component_edit :title, template: @element %> + <%= block_component_edit block, :title, template: @element %> </div> <div class="col-lg-4"> - <%= block_component_edit :url, template: @element %> + <%= block_component_edit block, :url, template: @element %> </div> <div class="col-lg-4"> <label class="form-label d-none d-xl-block"> </label> - <%= block_component_edit :target_blank, template: @element %> + <%= block_component_edit block, :target_blank, template: @element %> </div> </div> </div> @@ -51,5 +51,5 @@ </div> </draggable> <div class="mt-3"> - <%= block_component_add_element t('.add_button') %> + <%= block_component_add_element block, t('.add_button') %> </div> diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_preview.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_preview.html.erb deleted file mode 100644 index c28a3ce6e72634b7b13efcff289c5b778c2810b1..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/call_to_action/_preview.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<p class="mb-1"><%= strip_tags(block_component_preview :text).truncate(250) %></p> -<% @template.elements.each_with_index do |element, index| %> - <a class="btn <%= 'btn-dark' if index.zero? %>"> - <%= block_component_preview :title, template: element %> - </a> -<% end %> diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_show.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_show.html.erb index 06a081142d9601c9c79a8fee47e088915554a69e..7d3fad7c901cc712a433d060ea6b8be62166e45b 100644 --- a/app/views/admin/communication/blocks/templates/call_to_action/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/call_to_action/_show.html.erb @@ -1,10 +1,10 @@ <% class_name = "block block-call_to_action" -unless @block.title.blank? +unless block.title.blank? class_name += " block-with-title" end -image_class = "call_to_action--with" + (@block.template.image.empty? ? "out" : "") + "-image" +image_class = "call_to_action--with" + (block.template.image.empty? ? "out" : "") + "-image" %> @@ -13,34 +13,34 @@ image_class = "call_to_action--with" + (@block.template.image.empty? ? "out" : " <div class="block-content"> <div class="call_to_action <%= image_class %>"> <div> - <% unless @block.title.blank? %> - <h2><%= @block.title %></h2> + <% unless block.title.blank? %> + <h2><%= block.title %></h2> <% end %> - <% if @block.template.text %> + <% if block.template.text %> <div class="description"> - <%= block_component_preview :text %> + <%= block_component_show block, :text %> </div> <% end %> - <% if @block.template.elements %> - <div class="actions" <% if @block.template.elements.count > 1 %>role="group"<% end %>> - <% @block.template.elements.each do |element| %> + <% if block.template.elements %> + <div class="actions" <% if block.template.elements.count > 1 %>role="group"<% end %>> + <% block.template.elements.each do |element| %> <% if element.title %> - <a href="<%= block_component_preview :url, template: element %>" + <a href="<%= block_component_show block, :url, template: element %>" <% if element.target_blank %> - title="<%= block_component_preview :title, template: element %>" + title="<%= block_component_show block, :title, template: element %>" target="_blank" <% else %> - title="<%= block_component_preview :title, template: element %>" + title="<%= block_component_show block, :title, template: element %>" <% end %> - ><%= block_component_preview :title, template: element %></a> + ><%= block_component_show block, :title, template: element %></a> <% end %> <% end %> </div> <% end %> </div> - <% component = @block.template.image_component %> + <% component = block.template.image_component %> <% if component.blob %> - <%= kamifusen_tag component.blob, width: 600, class: 'img-fluid mb-1', alt: @block.template.alt %> + <%= kamifusen_tag component.blob, width: 600, class: 'img-fluid mb-1', alt: block.template.alt %> <% end %> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_snippet.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..4012532fe59e128168e9a3984541f7a85d022cf9 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/call_to_action/_snippet.html.erb @@ -0,0 +1,6 @@ +<p class="mb-1"><%= block_component_snippet block, :text %></p> +<% block.template.elements.each_with_index do |element, index| %> + <a class="btn disabled <%= index.zero? ? 'btn-dark' : 'btn-light' %>"> + <%= block_component_snippet block, :title, template: element %> + </a> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb index a1a67ce092a102402f5e9f040f743ad29da0aa33..4286184922f3b71207db8be5c1de4337ef0b781b 100644 --- a/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb @@ -1,11 +1,11 @@ -<%= block_component_static :text %> -<%= block_component_static :image %> -<%= block_component_static :alt %> -<%= block_component_static :credit %> +<%= block_component_static block, :text %> +<%= block_component_static block, :image %> +<%= block_component_static block, :alt %> +<%= block_component_static block, :credit %> buttons: <% block.template.elements.each do |element| %> -<%= block_component_static :title, template: element, list: true, depth: 4 %> -<%= block_component_static :url, template: element, depth: 5 %> -<%= block_component_static :target_blank, template: element, depth: 5 %> +<%= block_component_static block, :title, template: element, list: true, depth: 4 %> +<%= block_component_static block, :url, template: element, depth: 5 %> +<%= block_component_static block, :target_blank, template: element, depth: 5 %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb b/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb index 23e543361997318a4b97cc6b7082913542870039..d1797af49cc08f9d00ffeb1d7dd4fec17fd53c72 100644 --- a/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb @@ -1,17 +1,17 @@ -<%= block_component_edit :layout %> +<%= block_component_edit block, :layout %> <div class="row pure__row--small mb-4"> <div class="col-xxl-8"> - <%= block_component_edit :text %> - <%= block_component_edit :notes %> + <%= block_component_edit block, :text %> + <%= block_component_edit block, :notes %> </div> <div class="col-xxl-4"> <h2 class="h4"><%= t("admin.communication.blocks.templates.chapter.edit.image.label") %></h2> - <%= block_component_edit :image %> - <%= block_component_edit :alt, + <%= block_component_edit block, :image %> + <%= block_component_edit block, :alt, label: t('admin.communication.blocks.components.image.alt.label'), placeholder: t('admin.communication.blocks.components.image.alt.placeholder') %> - <%= block_component_edit :credit, + <%= block_component_edit block, :credit, label: t('admin.communication.blocks.components.image.credit.label'), placeholder: t('admin.communication.blocks.components.image.credit.placeholder'), summernote_config: 'link' %> diff --git a/app/views/admin/communication/blocks/templates/chapter/_preview.html.erb b/app/views/admin/communication/blocks/templates/chapter/_preview.html.erb deleted file mode 100644 index 61285f89bc56a61afcfed764a71096aa5df1b763..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/chapter/_preview.html.erb +++ /dev/null @@ -1 +0,0 @@ -<p class="mb-0"><%= strip_tags(block_component_preview :text).truncate(250) %></p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/chapter/_show.html.erb b/app/views/admin/communication/blocks/templates/chapter/_show.html.erb index 838aa58f37f665c868037905aa36990f93b8c255..707e34befc7c1e50933a030e7026da273d19dc64 100644 --- a/app/views/admin/communication/blocks/templates/chapter/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/chapter/_show.html.erb @@ -1,40 +1,32 @@ <% class_name = "block block-chapter" - -unless @block.title.blank? - class_name += " block-with-title" -end - -if @block.template.image[:id] #TODO comment vérifier proprement la présence de l'image? - class_name += " block-chapter--with-image" -end - -class_name += " block-chapter--" + @block.template.layout - +class_name += " block-with-title" unless block.title.blank? +#TODO comment vérifier proprement la présence de l'image? +class_name += " block-chapter--with-image" if block.template.image[:id] +class_name += " block-chapter--" + block.template.layout %> - <section class="<%= class_name %>"> <div class="container"> <div class="block-content"> <div class="chapter"> <div class="text"> - <% unless @block.title.blank? %> + <% if block.title.present? %> <div class="top"> - <h2><%= @block.title %></h2> + <h2><%= block.title %></h2> </div> <% end %> - <% unless @block.template.text.blank? %> + <% if block.template.text.present? %> <div class="rich-text"> - <%= block_component_preview :text %> + <%= block_component_show block, :text %> </div> <% end %> - <% unless @block.template.notes.blank? %> + <% if block.template.notes.present? %> <div class="notes"> - <%= block_component_preview :notes %> + <%= block_component_show block, :notes %> </div> <% end %> </div> - <%= block_component_preview :image %> + <%= block_component_show block, :image %> </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/chapter/_snippet.html.erb b/app/views/admin/communication/blocks/templates/chapter/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..0d643774694a7db598c9bd3837ec55b3a0c561c2 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/chapter/_snippet.html.erb @@ -0,0 +1 @@ +<p class="mb-0"><%= block_component_snippet block, :text %></p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/chapter/_static.html.erb b/app/views/admin/communication/blocks/templates/chapter/_static.html.erb index 470574b7140f365647ca327b4ed0aa6decf2becc..e6c7aa4fdcf19825b2515c5546f2ffb1dce8dd72 100644 --- a/app/views/admin/communication/blocks/templates/chapter/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/chapter/_static.html.erb @@ -1,6 +1,6 @@ layout: <%= block.template.layout %> -<%= block_component_static :text %> -<%= block_component_static :notes %> -<%= block_component_static :image %> -<%= block_component_static :alt %> -<%= block_component_static :credit %> +<%= block_component_static block, :text %> +<%= block_component_static block, :notes %> +<%= block_component_static block, :image %> +<%= block_component_static block, :alt %> +<%= block_component_static block, :credit %> diff --git a/app/views/admin/communication/blocks/templates/contact/_edit.html.erb b/app/views/admin/communication/blocks/templates/contact/_edit.html.erb index ef91a9a86c06a752d7745a3cad0530e5a8dc4f87..39326a4d56b0cb21c82151bdd9d0b3378d0f3ed6 100644 --- a/app/views/admin/communication/blocks/templates/contact/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/contact/_edit.html.erb @@ -1,22 +1,22 @@ <div class="row pure__row--small"> <div class="col-xl-6"> - <%= block_component_edit :description %> + <%= block_component_edit block, :description %> </div> </div> <div class="row pure__row--small mb-4"> <div class="col-xl-6"> <%= osuny_panel t('.contacts') do %> - <%= block_component_edit :name %> - <%= block_component_edit :address %> + <%= block_component_edit block, :name %> + <%= block_component_edit block, :address %> <div class="row pure__row--small"> <div class="col-md-4"> - <%= block_component_edit :zipcode %> + <%= block_component_edit block, :zipcode %> </div> <div class="col-md-8"> - <%= block_component_edit :city %> + <%= block_component_edit block, :city %> </div> </div> - <%= block_component_edit :country %> + <%= block_component_edit block, :country %> <% end %> </div> <div class="col-xl-6"> @@ -58,7 +58,7 @@ </div> <h3 class="h4"><%= t '.slots' %></h3> -<%= block_component_add_element t('.add_slot') %> +<%= block_component_add_element block, t('.add_slot') %> <draggable :list="data.elements" handle=".dragHandle" class="<%= if_appstack 'list-group' %>"> <div v-for="(element, index) in data.elements" class="d-flex draggable-item <%= if_appstack 'list-group-item' %>"> <div> @@ -69,13 +69,13 @@ <div class="flex-fill"> <div class="row pure__row--small mb-n3"> <div class="col-xl-4"> - <%= block_component_edit :title, template: @element %> + <%= block_component_edit block, :title, template: @element %> </div> <div class="col-xl-4 col-md-6"> - <%= block_component_edit :time_slot_morning, template: @element %> + <%= block_component_edit block, :time_slot_morning, template: @element %> </div> <div class="col-xl-4 col-md-6"> - <%= block_component_edit :time_slot_afternoon, template: @element %> + <%= block_component_edit block, :time_slot_afternoon, template: @element %> </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/contact/_preview.html.erb b/app/views/admin/communication/blocks/templates/contact/_preview.html.erb deleted file mode 100644 index 73cd9185da18533b325e659200c206bff37ea99c..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/contact/_preview.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<address itemscope itemtype="https://schema.org/Organization" class="mb-0"> - <%= strip_tags block_component_preview :name %> - <span itemprop="address" itemscope itemtype="https://schema.org/PostalAddress"> - <span itemprop="streetAddress"> - <%= strip_tags block_component_preview :address %> - </span> - <span itemprop="addressLocality"> - <%= strip_tags block_component_preview :city %> - </span> - <span itemprop="postalCode"> - <%= strip_tags block_component_preview :zipcode %> - </span> - <span itemprop="addressCountry"> - <%= strip_tags block_component_preview :country %> - </span> - </span> - <% @block.template.phone_numbers.each do |phone_number| %> - <%= phone_number %> - <% end %> - <% @block.template.emails.each do |email| %> - <%= email %> - <% end %> -</address> -<ul class="list-unstyled"> - <% @block.template.elements.each do |element| %> - <li> - <span><%= block_component_preview :title, template: element %></span> - <span><time datetime="<%= block_component_preview :time_slot_morning, template: element %>"><%= block_component_preview :time_slot_morning, template: element %></time></span> - <span><time datetime="<%= block_component_preview :time_slot_afternoon, template: element %>"><%= block_component_preview :time_slot_afternoon, template: element %></time></span> - </li> - <% end %> -</ul> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/contact/_show.html.erb b/app/views/admin/communication/blocks/templates/contact/_show.html.erb index 5c37e6e40126cab800221fa2d984ebb908175d53..70dcd21575dcd6bde8d6a5d6840db6d68f1bc7fc 100644 --- a/app/views/admin/communication/blocks/templates/contact/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/contact/_show.html.erb @@ -1,6 +1,6 @@ <% class_name = "block block-contact" -unless @block.title.blank? +unless block.title.blank? class_name += " block-with-title" end %> @@ -8,14 +8,14 @@ end <section class="<%= class_name %>"> <div class="container"> <div class="block-content"> - <% unless @block.title.blank? && @block.template.description.blank? %> + <% unless block.title.blank? && block.template.description.blank? %> <div class="top"> - <% unless @block.title.blank? %> - <h2><%= @block.title %></h2> + <% unless block.title.blank? %> + <h2><%= block.title %></h2> <% end %> - <% unless @block.template.description.blank? %> + <% unless block.template.description.blank? %> <div class="description"> - <p><%= block_component_preview :description %></p> + <p><%= block_component_show block, :description %></p> </div> <% end %> </div> @@ -23,39 +23,39 @@ end <div class="informations"> <address itemscope itemtype="https://schema.org/Organization"> - <% unless @block.template.name.blank? %> - <p><%= block_component_preview :name %></p> + <% unless block.template.name.blank? %> + <p><%= block_component_show block, :name %></p> <% end %> <div itemprop="address" itemscope itemtype="https://schema.org/PostalAddress"> <span itemprop="streetAddress"> - <%= block_component_preview :address %> + <%= block_component_show block, :address %> </span> <span itemprop="addressLocality"> - <%= block_component_preview :city %> + <%= block_component_show block, :city %> </span> <span itemprop="postalCode"> - <%= block_component_preview :zipcode %> + <%= block_component_show block, :zipcode %> </span> <span itemprop="addressCountry"> - <%= block_component_preview :country %> + <%= block_component_show block, :country %> </span> </div> <p> - <% @block.template.phone_numbers.each do |phone_number| %> + <% block.template.phone_numbers.each do |phone_number| %> <a itemprop="telephone" href="tel:<%= phone_number %>%>"><%= phone_number %></a><br> <% end %> - <% @block.template.emails.each do |email| %> + <% block.template.emails.each do |email| %> <a itemprop="email" href="mailto:<%= email %>%>"><%= email %></a><br> <% end %> </p> </address> <ul> - <% @block.template.elements.each do |element| %> + <% block.template.elements.each do |element| %> <li> - <span><%= block_component_preview :title, template: element %></span> - <span><time datetime="<%= block_component_preview :time_slot_morning, template: element %>"><%= block_component_preview :time_slot_morning, template: element %></time></span> - <span><time datetime="<%= block_component_preview :time_slot_afternoon, template: element %>"><%= block_component_preview :time_slot_afternoon, template: element %></time></span> + <span><%= block_component_show block, :title, template: element %></span> + <span><time datetime="<%= block_component_show block, :time_slot_morning, template: element %>"><%= block_component_show block, :time_slot_morning, template: element %></time></span> + <span><time datetime="<%= block_component_show block, :time_slot_afternoon, template: element %>"><%= block_component_show block, :time_slot_afternoon, template: element %></time></span> </li> <% end %> </ul> diff --git a/app/views/admin/communication/blocks/templates/contact/_snippet.html.erb b/app/views/admin/communication/blocks/templates/contact/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..967073ea2906958116039113211d5e69d2d93b90 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/contact/_snippet.html.erb @@ -0,0 +1,32 @@ +<address itemscope itemtype="https://schema.org/Organization" class="mb-0"> + <%= strip_tags block_component_snippet block, :name %> + <span itemprop="address" itemscope itemtype="https://schema.org/PostalAddress"> + <span itemprop="streetAddress"> + <%= strip_tags block_component_snippet block, :address %> + </span> + <span itemprop="addressLocality"> + <%= strip_tags block_component_snippet block, :city %> + </span> + <span itemprop="postalCode"> + <%= strip_tags block_component_snippet block, :zipcode %> + </span> + <span itemprop="addressCountry"> + <%= strip_tags block_component_snippet block, :country %> + </span> + </span> + <% block.template.phone_numbers.each do |phone_number| %> + <%= phone_number %> + <% end %> + <% block.template.emails.each do |email| %> + <%= email %> + <% end %> +</address> +<ul class="list-unstyled"> + <% block.template.elements.each do |element| %> + <li> + <span><%= block_component_snippet block, :title, template: element %></span> + <span><time datetime="<%= block_component_snippet block, :time_slot_morning, template: element %>"><%= block_component_snippet block, :time_slot_morning, template: element %></time></span> + <span><time datetime="<%= block_component_snippet block, :time_slot_afternoon, template: element %>"><%= block_component_snippet block, :time_slot_afternoon, template: element %></time></span> + </li> + <% end %> +</ul> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/contact/_static.html.erb b/app/views/admin/communication/blocks/templates/contact/_static.html.erb index 16c95afe197a835858b7c865e9bfc85c1c68f305..454d4af415b37dfd888c1f40763031dcfeae3928 100644 --- a/app/views/admin/communication/blocks/templates/contact/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/contact/_static.html.erb @@ -1,15 +1,15 @@ -<%= block_component_static :description %> -<%= block_component_static :name %> +<%= block_component_static block, :description %> +<%= block_component_static block, :name %> address: -<%= block_component_static :address, depth: 4 %> -<%= block_component_static :zipcode, depth: 4 %> -<%= block_component_static :city, depth: 4 %> -<%= block_component_static :country, depth: 4 %> -<%= block_component_static :phone_numbers %> -<%= block_component_static :emails %> +<%= block_component_static block, :address, depth: 4 %> +<%= block_component_static block, :zipcode, depth: 4 %> +<%= block_component_static block, :city, depth: 4 %> +<%= block_component_static block, :country, depth: 4 %> +<%= block_component_static block, :phone_numbers %> +<%= block_component_static block, :emails %> timetable: <% block.template.elements.each do |element| %> -<%= block_component_static :title, template: element, list: true, depth: 4 %> -<%= block_component_static :time_slot_morning, template: element, depth: 5 %> -<%= block_component_static :time_slot_afternoon, template: element, depth: 5 %> +<%= block_component_static block, :title, template: element, list: true, depth: 4 %> +<%= block_component_static block, :time_slot_morning, template: element, depth: 5 %> +<%= block_component_static block, :time_slot_afternoon, template: element, depth: 5 %> <% end %> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb b/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb index 3c759cf3db758537c6b9aedcb20109e9041ac3d3..c2c10608d5d59e81642ad087426b128d9fed19d6 100644 --- a/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb @@ -1,10 +1,10 @@ <div class="row pure__row--small"> <div class="col-xl-6"> - <%= block_component_edit :description %> + <%= block_component_edit block, :description %> </div> <div class="col-xl-6"> <label class="form-label"> </label> - <%= block_component_edit :alphabetical %> + <%= block_component_edit block, :alphabetical %> </div> </div> @@ -60,6 +60,6 @@ <div class="row"> <div class="col-lg-6"> - <%= block_component_edit :caption %> + <%= block_component_edit block, :caption %> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/datatable/_preview.html.erb b/app/views/admin/communication/blocks/templates/datatable/_preview.html.erb deleted file mode 100644 index ee86cc8b40e97798720165057c5301153d8e1d3a..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/datatable/_preview.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -<div class="table-responsive"> - <table class="table table-sm"> - <% unless @block.template.caption.blank? %> - <caption><%= block_component_preview :caption %></caption> - <% end %> - <thead> - <tr> - <%= block_component_preview :columns %> - </tr> - </thead> - <tbody> - <% @block.template.elements.first(1).each do |row| %> - <tr> - <%= block_component_preview :cells, template: row %> - </tr> - <% end %> - </tbody> - </table> -</div> diff --git a/app/views/admin/communication/blocks/templates/datatable/_show.html.erb b/app/views/admin/communication/blocks/templates/datatable/_show.html.erb index f1df7239485769a17ed013d1a5f3ab414b250324..3a404a14cf68f546f10d4f042435899502e79dcd 100644 --- a/app/views/admin/communication/blocks/templates/datatable/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/datatable/_show.html.erb @@ -1,38 +1,38 @@ <% class_name = "block block-datatable" -unless @block.title.blank? +unless block.title.blank? class_name += " block-with-title" end %> <section class="<%= class_name %>"> <div class="container"> <div class="block-content"> - <% unless @block.title.blank? && @block.template.description.blank? %> + <% unless block.title.blank? && block.template.description.blank? %> <div class="top"> - <% unless @block.title.blank? %> - <h2><%= @block.title %></h2> + <% unless block.title.blank? %> + <h2><%= block.title %></h2> <% end %> - <% unless @block.template.description.blank? %> + <% unless block.template.description.blank? %> <div class="description"> - <p><%= block_component_preview :description %></p> + <p><%= block_component_show block, :description %></p> </div> <% end %> </div> <% end %> <div class="table-responsive"> <table> - <% unless @block.template.caption.blank? %> - <caption><%= block_component_preview :caption %></caption> + <% unless block.template.caption.blank? %> + <caption><%= block_component_show block, :caption %></caption> <% end %> <thead> <tr> - <%= block_component_preview :columns %> + <%= block_component_show block, :columns %> </tr> </thead> <tbody> - <% @block.template.elements.each do |row| %> + <% block.template.elements.each do |row| %> <tr> - <%= block_component_preview :cells, template: row %> + <%= block_component_show block, :cells, template: row %> </tr> <% end %> </tbody> diff --git a/app/views/admin/communication/blocks/templates/datatable/_snippet.html.erb b/app/views/admin/communication/blocks/templates/datatable/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..bad5cc62c822542f00b74a0ae30e33806716f159 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/datatable/_snippet.html.erb @@ -0,0 +1,19 @@ +<div class="table-responsive"> + <table class="table table-sm"> + <% unless block.template.caption.blank? %> + <caption><%= block_component_snippet block, :caption %></caption> + <% end %> + <thead> + <tr> + <%= block_component_snippet block, :columns %> + </tr> + </thead> + <tbody> + <% block.template.elements.first(1).each do |row| %> + <tr> + <%= block_component_snippet block, :cells, template: row %> + </tr> + <% end %> + </tbody> + </table> +</div> diff --git a/app/views/admin/communication/blocks/templates/datatable/_static.html.erb b/app/views/admin/communication/blocks/templates/datatable/_static.html.erb index b144606054efa65dd9ff50d34c8a370d0e31c5da..458507f331aa3e6ee0c19dc1614761fc275131b1 100644 --- a/app/views/admin/communication/blocks/templates/datatable/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/datatable/_static.html.erb @@ -1,7 +1,7 @@ -<%= block_component_static :description %> -<%= block_component_static :columns %> +<%= block_component_static block, :description %> +<%= block_component_static block, :columns %> rows: <% block.template.elements.each do |element| %> -<%= block_component_static :cells, template: element, list: true, depth: 4 %> +<%= block_component_static block, :cells, template: element, list: true, depth: 4 %> <% end %> -<%= block_component_static :caption %> +<%= block_component_static block, :caption %> diff --git a/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb b/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb index 577a6a16e063a1fa894d22e2f1f2650cc7ce5274..52bf12364fb24a5c46fe9577bd380615127089e1 100644 --- a/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb @@ -1,6 +1,6 @@ <div class="row pure__row--small"> <div class="col-xl-6"> - <%= block_component_edit :description %> + <%= block_component_edit block, :description %> </div> </div> @@ -14,10 +14,10 @@ <div class="flex-fill"> <div class="row pure__row--small mb-n3"> <div class="col-lg-5"> - <%= block_component_edit :title, template: @element %> + <%= block_component_edit block, :title, template: @element %> </div> <div class="col-lg-7"> - <%= block_component_edit :description, template: @element %> + <%= block_component_edit block, :description, template: @element %> </div> </div> </div> @@ -30,4 +30,4 @@ </div> </div> </draggable> -<%= block_component_add_element t('.add_definition') %> +<%= block_component_add_element block, t('.add_definition') %> diff --git a/app/views/admin/communication/blocks/templates/definitions/_preview.html.erb b/app/views/admin/communication/blocks/templates/definitions/_preview.html.erb deleted file mode 100644 index c5cf27c7d833c0dee00291705d186c80364de4cf..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/definitions/_preview.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<p> - <%= @block.template.elements.first(2).map { |element| - strip_tags(block_component_preview :title, template: element).strip - }.join(', ') %>... -</p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/definitions/_show.html.erb b/app/views/admin/communication/blocks/templates/definitions/_show.html.erb index 0673ec78f459ffbb22726e9d679b4812547841ff..a7377917ae7ea8b16aeadb46d25ab5d66bb55b61 100644 --- a/app/views/admin/communication/blocks/templates/definitions/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/definitions/_show.html.erb @@ -1,6 +1,6 @@ <% class_name = "block block-definitions" - unless @block.title.blank? + unless block.title.blank? class_name += " block-with-title" end %> @@ -8,25 +8,25 @@ <section class="<%= class_name %>"> <div class="container"> <div class="block-content"> - <% unless @block.title.blank? && @block.template.description.blank? %> + <% unless block.title.blank? && block.template.description.blank? %> <div class="top"> - <% unless @block.title.blank? %> - <h2><%= @block.title %></h2> + <% unless block.title.blank? %> + <h2><%= block.title %></h2> <% end %> - <% unless @block.template.description.blank? %> + <% unless block.template.description.blank? %> <div class="description"> - <p><%= block_component_preview :description %></p> + <p><%= block_component_show block, :description %></p> </div> <% end %> </div> <% end %> <div class="definitions"> - <% @block.template.elements.each do |element| %> + <% block.template.elements.each do |element| %> <details itemscope itemtype="https://schema.org/DefinedTerm"> <summary itemprop="name"> - <%= block_component_preview :title, template: element %> + <%= block_component_show block, :title, template: element %> </summary> - <p itemprop="description"><%= block_component_preview :description, template: element %></p> + <p itemprop="description"><%= block_component_show block, :description, template: element %></p> </details> <% end %> </div> diff --git a/app/views/admin/communication/blocks/templates/definitions/_snippet.html.erb b/app/views/admin/communication/blocks/templates/definitions/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..cfb1e89e354366c1f7aaa71f5e44aff88784f9e3 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/definitions/_snippet.html.erb @@ -0,0 +1,5 @@ +<p> + <%= block.template.elements.first(2).map { |element| + strip_tags(block_component_snippet block, :title, template: element).strip + }.join(', ') %>... +</p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/definitions/_static.html.erb b/app/views/admin/communication/blocks/templates/definitions/_static.html.erb index fd9afb253e4bc0e1f2db8c83fd9bc371fb5e72dc..d9955774e412068086c7f7bf4c94371fbd3c2ada 100644 --- a/app/views/admin/communication/blocks/templates/definitions/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/definitions/_static.html.erb @@ -1,6 +1,6 @@ -<%= block_component_static :description %> +<%= block_component_static block, :description %> elements: <% block.template.elements.each do |element| %> -<%= block_component_static :title, template: element, list: true, depth: 4 %> -<%= block_component_static :description, template: element, depth: 5 %> +<%= block_component_static block, :title, template: element, list: true, depth: 4 %> +<%= block_component_static block, :description, template: element, depth: 5 %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/embed/_edit.html.erb b/app/views/admin/communication/blocks/templates/embed/_edit.html.erb index e1824fa85d0930c12ea5b3fa865fdcee6572b2b1..2adc4a122a8df4756d12a959c8a1362b4bd55a0a 100644 --- a/app/views/admin/communication/blocks/templates/embed/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/embed/_edit.html.erb @@ -4,8 +4,8 @@ </div> </div> <div class="mb-4"> - <%= block_component_edit :code %> + <%= block_component_edit block, :code %> </div> -<%= block_component_edit :transcription, +<%= block_component_edit block, :transcription, label: t('admin.communication.blocks.components.text.transcription.label'), placeholder: t('admin.communication.blocks.components.text.transcription.placeholder') %> diff --git a/app/views/admin/communication/blocks/templates/embed/_preview.html.erb b/app/views/admin/communication/blocks/templates/embed/_preview.html.erb deleted file mode 100644 index ee1017d64ce322c5d7263aa901ad9e96b0ea4076..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/embed/_preview.html.erb +++ /dev/null @@ -1 +0,0 @@ -<p><%= strip_tags block_component_preview :transcription %></p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/embed/_show.html.erb b/app/views/admin/communication/blocks/templates/embed/_show.html.erb index d6bc1a1e6c77cd1d6c901c0085b98a7adfcdb5c0..192db41c23c5ec47bd6df3ad0119274321aaebd1 100644 --- a/app/views/admin/communication/blocks/templates/embed/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/embed/_show.html.erb @@ -1,6 +1,6 @@ <% class_name = "block block-embed" - unless @block.title.blank? + unless block.title.blank? class_name += " block-with-title" end %> @@ -8,20 +8,20 @@ <section class="<%= class_name %>"> <div class="container"> <div class="block-content"> - <% unless @block.title.blank? %> + <% unless block.title.blank? %> <div class="top"> - <h2><%= @block.title %></h2> + <h2><%= block.title %></h2> </div> <% end %> - <%= block_component_preview :code %> + <%= block_component_show block, :code %> - <% unless @block.template.transcription.blank? %> + <% unless block.template.transcription.blank? %> <div class="transcription"> <details> <summary>Transcription</summary> <p> - <%= block_component_preview :transcription %> + <%= block_component_show block, :transcription %> </p> </details> </div> diff --git a/app/views/admin/communication/blocks/templates/embed/_snippet.html.erb b/app/views/admin/communication/blocks/templates/embed/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..481a29ffc11b70aa9c5454f83ab7e9c96a24e820 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/embed/_snippet.html.erb @@ -0,0 +1 @@ +<p><%= strip_tags block_component_snippet block, :transcription %></p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/embed/_static.html.erb b/app/views/admin/communication/blocks/templates/embed/_static.html.erb index fcd9a7d668d245543d64cd7386caf67b05ebe851..e515ac323de3b1559a56e2b4719d1ea16692d3a1 100644 --- a/app/views/admin/communication/blocks/templates/embed/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/embed/_static.html.erb @@ -1,2 +1,2 @@ -<%= block_component_static :code %> -<%= block_component_static :transcription %> +<%= block_component_static block, :code %> +<%= block_component_static block, :transcription %> diff --git a/app/views/admin/communication/blocks/templates/features/_edit.html.erb b/app/views/admin/communication/blocks/templates/features/_edit.html.erb index e9a60f1c569c753464c16a159eeab64dd613273f..48df83e44d6db4d9b7d06d6fab1d9f5e5624b9ff 100644 --- a/app/views/admin/communication/blocks/templates/features/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/features/_edit.html.erb @@ -1,10 +1,10 @@ <div class="row pure__row--small"> <div class="col-xl-6"> - <%= block_component_edit :description %> + <%= block_component_edit block, :description %> </div> </div> -<%= block_component_add_element t('.add_element') %> +<%= block_component_add_element block, t('.add_element') %> <draggable :list="data.elements" handle=".dragHandle" class="mb-3 <%= if_appstack 'list-group' %>"> <div v-for="(element, index) in data.elements" class="draggable-item <%= if_appstack 'list-group-item' %>"> <div> @@ -17,19 +17,19 @@ </div> <div class="row pure__row--small"> <div class="col-lg-4"> - <%= block_component_edit :title, template: @element %> - <%= block_component_edit :description, template: @element, rows: 5 %> + <%= block_component_edit block, :title, template: @element %> + <%= block_component_edit block, :description, template: @element, rows: 5 %> </div> <div class="col-lg-4"> - <%= block_component_edit :image, template: @element %> + <%= block_component_edit block, :image, template: @element %> </div> <div class="col-lg-4" v-show="element.image.id != ''"> - <%= block_component_edit :alt, template: @element %> - <%= block_component_edit :credit, template: @element %> + <%= block_component_edit block, :alt, template: @element %> + <%= block_component_edit block, :credit, template: @element %> </div> </div> </div> </draggable> <div v-show="data.elements.length > 2"> - <%= block_component_add_element t('.add_element') %> + <%= block_component_add_element block, t('.add_element') %> </div> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/features/_show.html.erb b/app/views/admin/communication/blocks/templates/features/_show.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/features/_snippet.html.erb b/app/views/admin/communication/blocks/templates/features/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/features/_static.html.erb b/app/views/admin/communication/blocks/templates/features/_static.html.erb index 2dd180eae5b5d1367c84827e7f24a8b8f89d7ea0..265d924f2a1ea6ca3700a31d7f60a9b5cdf96ac8 100644 --- a/app/views/admin/communication/blocks/templates/features/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/features/_static.html.erb @@ -1,9 +1,9 @@ -<%= block_component_static :description %> +<%= block_component_static block, :description %> elements: <% block.template.elements.each do |element| %> -<%= block_component_static :title, template: element, list: true, depth: 4 %> -<%= block_component_static :description, template: element, depth: 5 %> -<%= block_component_static :image, template: element, depth: 5 %> -<%= block_component_static :alt, template: element, depth: 5 %> -<%= block_component_static :credit, template: element, depth: 5 %> +<%= block_component_static block, :title, template: element, list: true, depth: 4 %> +<%= block_component_static block, :description, template: element, depth: 5 %> +<%= block_component_static block, :image, template: element, depth: 5 %> +<%= block_component_static block, :alt, template: element, depth: 5 %> +<%= block_component_static block, :credit, template: element, depth: 5 %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/files/_edit.html.erb b/app/views/admin/communication/blocks/templates/files/_edit.html.erb index 0fe565559132d3f320b5cc1b3f030e5d40cf687b..18165123520d6106f2498b3c8b4d560901fd88ca 100644 --- a/app/views/admin/communication/blocks/templates/files/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/files/_edit.html.erb @@ -1,10 +1,10 @@ <div class="row pure__row--small"> <div class="col-xl-6"> - <%= block_component_edit :description %> + <%= block_component_edit block, :description %> </div> </div> -<%= block_component_add_element t('.add_file') %> +<%= block_component_add_element block, t('.add_file') %> <draggable :list="data.elements" handle=".dragHandle" class="row pure__row--small"> <div v-for="(element, index) in data.elements" class="col-md-4"> @@ -22,8 +22,8 @@ </div> </div> <div class="card-body"> - <%= block_component_edit :title, template: @element %> - <%= block_component_edit :file, template: @element %> + <%= block_component_edit block, :title, template: @element %> + <%= block_component_edit block, :file, template: @element %> </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/files/_show.html.erb b/app/views/admin/communication/blocks/templates/files/_show.html.erb index f9ebe021d0db9bb41f3a4614bea4539abd712014..8b34187b888b032a1f79a97a048baca78437b370 100644 --- a/app/views/admin/communication/blocks/templates/files/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/files/_show.html.erb @@ -1,6 +1,6 @@ <% class_name = "block block-files" -unless @block.title.blank? +unless block.title.blank? class_name += " block-with-title" end %> @@ -8,21 +8,21 @@ end <section class="<%= class_name %>"> <div class="container"> <div class="block-content"> - <% unless @block.title.blank? && @block.template.description.blank? %> + <% unless block.title.blank? && block.template.description.blank? %> <div class="top"> - <% unless @block.title.blank? %> - <h2><%= @block.title %></h2> + <% unless block.title.blank? %> + <h2><%= block.title %></h2> <% end %> - <% unless @block.template.description.blank? %> + <% unless block.template.description.blank? %> <div class="description"> - <p><%= block_component_preview :description %></p> + <p><%= block_component_show block, :description %></p> </div> <% end %> </div> <% end %> <ul class="files"> - <% @block.template.elements.each do |element| %> + <% block.template.elements.each do |element| %> <% next unless element.blob %> <li> <figure> diff --git a/app/views/admin/communication/blocks/templates/files/_preview.html.erb b/app/views/admin/communication/blocks/templates/files/_snippet.html.erb similarity index 65% rename from app/views/admin/communication/blocks/templates/files/_preview.html.erb rename to app/views/admin/communication/blocks/templates/files/_snippet.html.erb index cf6c347d9c73fb6ba4a35586480c9c8c0ac9c151..a1bbb1484466828a82850c8118f96e3d4147ecc5 100644 --- a/app/views/admin/communication/blocks/templates/files/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/files/_snippet.html.erb @@ -1,5 +1,5 @@ <ul class="list-unstyled"> - <% @block.template.elements.first(2).each do |element| %> + <% block.template.elements.first(2).each do |element| %> <% next unless element.blob %> <li><%= element.title %></li> <% end %> diff --git a/app/views/admin/communication/blocks/templates/files/_static.html.erb b/app/views/admin/communication/blocks/templates/files/_static.html.erb index 11793b83fdea5ff680e1e4a073046bacba0cf66c..84106e90f2f3370f2ddf7fa5c722cf706f892df6 100644 --- a/app/views/admin/communication/blocks/templates/files/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/files/_static.html.erb @@ -1,7 +1,7 @@ -<%= block_component_static :description %> +<%= block_component_static block, :description %> files: <% block.template.elements.each do |element| %> <% next unless element.blob %> -<%= block_component_static :file, template: element, depth: 4, list: true %> -<%= block_component_static :title, template: element, depth: 5 %> +<%= block_component_static block, :file, template: element, depth: 4, list: true %> +<%= block_component_static block, :title, template: element, depth: 5 %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb b/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb index 9e77ce4f5cc31ede8c7154a39bb48d2ae6f692b5..3d2e098815a14202c27b17be1c20880af996c78c 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb @@ -1,10 +1,10 @@ <div class="row pure__row--small"> <div class="col-xl-6"> - <%= block_component_edit :description %> + <%= block_component_edit block, :description %> </div> </div> -<%= block_component_edit :layout %> +<%= block_component_edit block, :layout %> <p>Déplacer les images ci-dessous pour les mettre dans l'ordre souhaité</p> <draggable :list="data.elements" class="row pure__row--small"> @@ -35,26 +35,26 @@ </div> <div class="row pure__row--small"> <div class="col-lg-6"> - <%= block_component_edit :image, + <%= block_component_edit block, :image, template: @element, label: t('admin.communication.blocks.components.image.input.label'), placeholder: t('admin.communication.blocks.components.image.input.placeholder') %> </div> <div class="col-lg-6"> - <%= block_component_edit :alt, + <%= block_component_edit block, :alt, template: @element, label: t('admin.communication.blocks.components.image.alt.label'), placeholder: t('admin.communication.blocks.components.image.alt.placeholder') %> - <%= block_component_edit :credit, + <%= block_component_edit block, :credit, template: @element, label: t('admin.communication.blocks.components.image.credit.label'), placeholder: t('admin.communication.blocks.components.image.credit.placeholder'), summernote_config: 'link' %> - <%= block_component_edit :text, + <%= block_component_edit block, :text, template: @element %> </div> </div> <% end %> </div> -<%= block_component_add_element t('.add_image') %> +<%= block_component_add_element block, t('.add_image') %> diff --git a/app/views/admin/communication/blocks/templates/gallery/_show.html.erb b/app/views/admin/communication/blocks/templates/gallery/_show.html.erb index c392691021f29c9ce39d518c0ae3ccf97f55d52d..60ec10386b55e6dae5a688125b026052e78058d1 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_show.html.erb @@ -1,46 +1,46 @@ <% class_name = "block block-gallery" -if @block.title.present? +if block.title.present? class_name += " block-with-title" end -class_name += " block-gallery--" + @block.template.layout +class_name += " block-gallery--" + block.template.layout %> <section class="<%= class_name %>"> <div class="container"> <div class="block-content"> - <% if @block.title.present? || @block.template.description.present? %> + <% if block.title.present? || block.template.description.present? %> <div class="top"> - <% if @block.title.present? %> - <h2><%= @block.title %></h2> + <% if block.title.present? %> + <h2><%= block.title %></h2> <% end %> - <% if @block.template.description.present? %> + <% if block.template.description.present? %> <div class="description"> - <p><%= block_component_preview :description %></p> + <p><%= block_component_show block, :description %></p> </div> <% end %> </div> <% end %> - <% if @block.template.layout === "carousel" %> - <% if !@block.template.elements.one? %> + <% if block.template.layout === "carousel" %> + <% if !block.template.elements.one? %> <div class="splide" role="group" data-splide='{"arrows":true,"pagination":false,"autoWidth":true,"autoplay":false}'> <div class="splide__track"> <div class="splide__list"> <% end %> - <% @block.template.elements.each do |element| %> - <%= block_component_preview :image, template: element %> + <% block.template.elements.each do |element| %> + <%= block_component_show block, :image, template: element %> <% end %> - <% if !@block.template.elements.one? %> + <% if !block.template.elements.one? %> </div> </div> </div> <% end %> <% else %> <div class="gallery" role="group"> - <% @block.template.elements.each do |element| %> - <%= block_component_preview :image, template: element %> + <% block.template.elements.each do |element| %> + <%= block_component_show block, :image, template: element %> <% end %> </div> <% end %> diff --git a/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb b/app/views/admin/communication/blocks/templates/gallery/_snippet.html.erb similarity index 76% rename from app/views/admin/communication/blocks/templates/gallery/_preview.html.erb rename to app/views/admin/communication/blocks/templates/gallery/_snippet.html.erb index 2ff2e3b29a57d7fb1eb4ac1c112212db7bea69a2..2131b1ff1fd0ff82802209ff8e2608a74038d36f 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_snippet.html.erb @@ -1,4 +1,4 @@ -<% @block.template.elements.first(4).each do |element| %> +<% block.template.elements.first(4).each do |element| %> <% component = element.image_component blob = component.blob 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 2d82becb5955a9b507dceb93e40e443dbab6aadb..1805165739e9948a869d883fa4a6585a221becb5 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_static.html.erb @@ -1,10 +1,10 @@ -<%= block_component_static :description %> -<%= block_component_static :layout %> +<%= block_component_static block, :description %> +<%= block_component_static block, :layout %> images: <% block.template.elements.each do |element| %> <% next unless element.blob %> -<%= 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 %> +<%= block_component_static block, :image, template: element, depth: 4, list: true %> +<%= block_component_static block, :alt, template: element, depth: 5 %> +<%= block_component_static block, :credit, template: element, depth: 5 %> +<%= block_component_static block, :text, template: element, depth: 5 %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/image/_edit.html.erb b/app/views/admin/communication/blocks/templates/image/_edit.html.erb index e4a5433e6477ec1f69b3767cff16b8f808fc39d6..fbbb4389cf8c2e867739ecafac43081f81aa63fd 100644 --- a/app/views/admin/communication/blocks/templates/image/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/image/_edit.html.erb @@ -1,16 +1,16 @@ <div class="row pure__row--small"> <div class="col-md-6"> - <%= block_component_edit :image %> + <%= block_component_edit block, :image %> </div> <div class="col-md-6"> - <%= block_component_edit :alt, + <%= block_component_edit block, :alt, label: t('admin.communication.blocks.components.image.alt.label'), placeholder: t('admin.communication.blocks.components.image.alt.placeholder') %> - <%= block_component_edit :credit, + <%= block_component_edit block, :credit, label: t('admin.communication.blocks.components.image.credit.label'), placeholder: t('admin.communication.blocks.components.image.credit.placeholder'), summernote_config: 'link' %> - <%= block_component_edit :text, + <%= block_component_edit block, :text, summernote_config: 'link' %> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/image/_show.html.erb b/app/views/admin/communication/blocks/templates/image/_show.html.erb index 622c48b2622e888d83869233070bd71aeca2f71c..2e6d009ec1ab75d799057f00e0a5c8d1c61c0aa2 100644 --- a/app/views/admin/communication/blocks/templates/image/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/image/_show.html.erb @@ -1,20 +1,20 @@ <% class_name = "block block-image" -unless @block.title.blank? +unless block.title.blank? class_name += " block-with-title" end %> <section class="<%= class_name %>"> <div class="container"> <div class="block-content"> - <% unless @block.title.blank? %> + <% unless block.title.blank? %> <div class="top"> - <h2><%= @block.title %></h2> + <h2><%= block.title %></h2> </div> <% end %> - <% if @block.template.image %> - <%= block_component_preview :image %> + <% if block.template.image %> + <%= block_component_show block, :image %> <% end %> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/image/_preview.html.erb b/app/views/admin/communication/blocks/templates/image/_snippet.html.erb similarity index 64% rename from app/views/admin/communication/blocks/templates/image/_preview.html.erb rename to app/views/admin/communication/blocks/templates/image/_snippet.html.erb index 48104b4c81294c56b11b87c4c9d7c89f539824b9..dde57aad1c120c4c6b873d45cadf3e369ff24830 100644 --- a/app/views/admin/communication/blocks/templates/image/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/image/_snippet.html.erb @@ -1,2 +1,2 @@ -<% blob = @template.image_component.blob %> +<% blob = block.template.image_component.blob %> <%= image_tag blob.variant(resize: 'x180'), height: 90, alt: '', class: 'me-2' if blob %> diff --git a/app/views/admin/communication/blocks/templates/image/_static.html.erb b/app/views/admin/communication/blocks/templates/image/_static.html.erb index df1923006b3ed405a10a5ba142c590dad1d9b1f6..2ef537845ec211f2d69f1d290982aef5f9a6d9f3 100644 --- a/app/views/admin/communication/blocks/templates/image/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/image/_static.html.erb @@ -1,4 +1,4 @@ -<%= block_component_static :text %> -<%= block_component_static :image %> -<%= block_component_static :alt, depth: 4 %> -<%= block_component_static :credit, depth: 4 %> +<%= block_component_static block, :text %> +<%= block_component_static block, :image %> +<%= block_component_static block, :alt, depth: 4 %> +<%= block_component_static block, :credit, depth: 4 %> diff --git a/app/views/admin/communication/blocks/templates/key_figures/_edit.html.erb b/app/views/admin/communication/blocks/templates/key_figures/_edit.html.erb index 722deb0fc1a0c94bb0898be715251eae859a04bc..cb8b57e87dba231e81a87e7019d83582b21723b8 100644 --- a/app/views/admin/communication/blocks/templates/key_figures/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/key_figures/_edit.html.erb @@ -1,10 +1,10 @@ <div class="row pure__row--small"> <div class="col-xl-6"> - <%= block_component_edit :description %> + <%= block_component_edit block, :description %> </div> </div> -<%= block_component_add_element t('.add_key') %> +<%= block_component_add_element block, t('.add_key') %> <draggable :list="data.elements" handle=".dragHandle" class="<%= if_appstack 'list-group' %>"> <div v-for="(element, index) in data.elements" class="d-flex draggable-item <%= if_appstack 'list-group-item' %>"> @@ -16,13 +16,13 @@ <div class="flex-fill"> <div class="row pure__row--small mb-n3"> <div class="col-lg-2"> - <%= block_component_edit :number, template: @element %> + <%= block_component_edit block, :number, template: @element %> </div> <div class="col-lg-3"> - <%= block_component_edit :unit, template: @element %> + <%= block_component_edit block, :unit, template: @element %> </div> <div class="col-lg-7"> - <%= block_component_edit :description, template: @element, rows: 1 %> + <%= block_component_edit block, :description, template: @element, rows: 1 %> </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/key_figures/_preview.html.erb b/app/views/admin/communication/blocks/templates/key_figures/_preview.html.erb deleted file mode 100644 index 8ca91acc003ee601b33a588a51d9ab409720a6a6..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/key_figures/_preview.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<p class="mb-0"> - <%= @block.template.elements.first(2).map { |element| - "#{block_component_preview :number, template: element} #{block_component_preview :unit, template: element}".strip - }.join(', ') %>... -</p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/key_figures/_show.html.erb b/app/views/admin/communication/blocks/templates/key_figures/_show.html.erb index 27615c8ef0dec5bbc05b650d4595453da39d95db..a4eae29b9bf4b8f3bafb0207df7dff62af0e74af 100644 --- a/app/views/admin/communication/blocks/templates/key_figures/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/key_figures/_show.html.erb @@ -1,30 +1,30 @@ <% class_name = "block block-key_figures" -unless @block.title.blank? +unless block.title.blank? class_name += " block-with-title" end %> <section class="<%= class_name %>"> <div class="container"> <div class="block-content"> - <% unless @block.title.blank? && @block.template.description.blank? %> + <% unless block.title.blank? && block.template.description.blank? %> <div class="top"> - <% unless @block.title.blank? %> - <h2><%= @block.title %></h2> + <% unless block.title.blank? %> + <h2><%= block.title %></h2> <% end %> - <% unless @block.template.description.blank? %> + <% unless block.template.description.blank? %> <div class="description"> - <p><%= block_component_preview :description %></p> + <p><%= block_component_show block, :description %></p> </div> <% end %> </div> <% end %> - <ul class="<%= @block.template.elements.count.even? ? "even-items" : "odd-items" %>"> - <% @block.template.elements.each do |element| %> + <ul class="<%= block.template.elements.count.even? ? "even-items" : "odd-items" %>"> + <% block.template.elements.each do |element| %> <li> <dl> - <dt><strong><%= block_component_preview :number, template: element %></strong><%= block_component_preview :unit, template: element %></dt> - <dd><%= block_component_preview :description, template: element %></dd> + <dt><strong><%= block_component_show block, :number, template: element %></strong><%= block_component_show block, :unit, template: element %></dt> + <dd><%= block_component_show block, :description, template: element %></dd> </dl> </li> <% end %> diff --git a/app/views/admin/communication/blocks/templates/key_figures/_snippet.html.erb b/app/views/admin/communication/blocks/templates/key_figures/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..b33dda31da1257e80dace8e84905e6e15f13a370 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/key_figures/_snippet.html.erb @@ -0,0 +1,5 @@ +<p class="mb-0"> + <%= block.template.elements.first(2).map { |element| + "#{block_component_snippet block, :number, template: element} #{block_component_snippet block, :unit, template: element}".strip + }.join(', ') %>... +</p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/key_figures/_static.html.erb b/app/views/admin/communication/blocks/templates/key_figures/_static.html.erb index dc4978617a768da3f2e0e916a64fba4a7aeae2cf..4bdf5dbae557ebd663daa061a9f892ca347e0599 100644 --- a/app/views/admin/communication/blocks/templates/key_figures/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/key_figures/_static.html.erb @@ -1,7 +1,7 @@ -<%= block_component_static :description %> +<%= block_component_static block, :description %> figures: <% block.template.elements.each do |element| %> - - <%= block_component_static :number, template: element, depth: 0 %> -<%= block_component_static :unit, template: element, depth: 5 %> -<%= block_component_static :description, template: element, depth: 5 %> + - <%= block_component_static block, :number, template: element, depth: 0 %> +<%= block_component_static block, :unit, template: element, depth: 5 %> +<%= block_component_static block, :description, template: element, depth: 5 %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_edit.html.erb b/app/views/admin/communication/blocks/templates/organization_chart/_edit.html.erb index 2262e66e71082619001c1e9e0c822ea8c2355de7..b48db344c17738d2be5406cfb919a24287a7a787 100644 --- a/app/views/admin/communication/blocks/templates/organization_chart/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/organization_chart/_edit.html.erb @@ -1,12 +1,12 @@ <div class="row pure__row--small"> <div class="col-xl-6"> - <%= block_component_edit :description %> + <%= block_component_edit block, :description %> </div> <div class="col-xl-6"> <label class="form-label"> </label> - <%= block_component_edit :with_link %> - <%= block_component_edit :with_photo %> - <%= block_component_edit :alphabetical %> + <%= block_component_edit block, :with_link %> + <%= block_component_edit block, :with_photo %> + <%= block_component_edit block, :alphabetical %> </div> </div> @@ -22,10 +22,10 @@ <div class="flex-fill"> <div class="row pure__row--small mb-n3"> <div class="col-md-6"> - <%= block_component_edit :id, template: @element, label: '' %> + <%= block_component_edit block, :id, template: @element, label: '' %> </div> <div class="col-md-6"> - <%= block_component_edit :role, template: @element, label: '' %> + <%= block_component_edit block, :role, template: @element, label: '' %> </div> </div> </div> @@ -40,4 +40,4 @@ </div> </draggable> -<%= block_component_add_element t('.add_person') %> \ No newline at end of file +<%= block_component_add_element block, t('.add_person') %> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb b/app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb index 7dae993fea68d01ee3438556aeb1026ab95a56c1..3ad8c06373f9843e1b249a5cf0b6ac9359baf538 100644 --- a/app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb @@ -1,34 +1,34 @@ <% class_name = "block block-organization_chart" -unless @block.title.blank? +unless block.title.blank? class_name += " block-with-title" end %> <section class="<%= class_name %>"> <div class="container"> <div class="block-content"> - <% unless @block.title.blank? && @block.template.description.blank? %> + <% unless block.title.blank? && block.template.description.blank? %> <div class="top"> - <% unless @block.title.blank? %> - <h2><%= @block.title %></h2> + <% unless block.title.blank? %> + <h2><%= block.title %></h2> <% end %> - <% unless @block.template.description.blank? %> + <% unless block.template.description.blank? %> <div class="description"> - <p><%= block_component_preview :description %></p> + <p><%= block_component_show block, :description %></p> </div> <% end %> </div> <% end %> <div class="persons"> - <% @block.template.elements.each do |element| + <% block.template.elements.each do |element| person = element.person next if person.nil? %> <article class="person" itemscope itemtype="https://schema.org/Person"> <div class="description"> <h3 class="name" itemprop="name"> - <% if @block.template.with_link %> + <% if block.template.with_link %> <%= link_to person, [:admin, person] %> <% else %> <%= element.person %> @@ -36,7 +36,7 @@ end </h3> <p itemprop="jobTitle"><%= element.role %></p> </div> - <% if @block.template.with_photo %> + <% if block.template.with_photo %> <div class="avatar" itemprop="image"> <% if person.best_picture.attached? %> <%= kamifusen_tag person.best_picture, class: 'img-fluid rounded-circle' %> diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_preview.html.erb b/app/views/admin/communication/blocks/templates/organization_chart/_snippet.html.erb similarity index 87% rename from app/views/admin/communication/blocks/templates/organization_chart/_preview.html.erb rename to app/views/admin/communication/blocks/templates/organization_chart/_snippet.html.erb index af63c0eb5c0214e0e6b11f9daabe78b87f61da3f..94c0bbf520360f38153b689f1bd3b9678fd23e72 100644 --- a/app/views/admin/communication/blocks/templates/organization_chart/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/organization_chart/_snippet.html.erb @@ -1,4 +1,4 @@ -<% @block.template.elements.each do |element| +<% block.template.elements.each do |element| person = element.person next if person.nil? %> diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_static.html.erb b/app/views/admin/communication/blocks/templates/organization_chart/_static.html.erb index 7f29eb08dd3753d5fc93e5fc33d46b842ec8844b..c4d4f4ac299611b7c05345d8799593230a93eae6 100644 --- a/app/views/admin/communication/blocks/templates/organization_chart/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/organization_chart/_static.html.erb @@ -1,9 +1,9 @@ -<%= block_component_static :description %> -<%= block_component_static :with_link %> -<%= block_component_static :with_photo %> +<%= block_component_static block, :description %> +<%= block_component_static block, :with_link %> +<%= block_component_static block, :with_photo %> persons: <% block.template.elements.each do |element| %> <% next unless element.person %> - slug: "<%= element.person.slug %>" -<%= block_component_static :role, template: element, depth: 5 %> +<%= block_component_static block, :role, template: element, depth: 5 %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb index 814d64830a317342fa6a93781fc9d9ecf1790de9..9d6920871c784a2678a8c38474bf5dbebe8b9ca8 100644 --- a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb @@ -1,19 +1,19 @@ -<%= block_component_edit :layout %> +<%= block_component_edit block, :layout %> <div class="row pure__row--small"> <div class="col-lg-6"> <div class="mb-5"> - <%= block_component_edit :mode %> + <%= block_component_edit block, :mode %> </div> <div class="mb-5"> <h2 class="h3"><%= t '.main_page.title' %></h2> - <%= block_component_edit :page_id %> + <%= block_component_edit block, :page_id %> </div> <div class="mb-4" v-if="data.mode == 'selection'"> <h2 class="h3"><%= t '.selection.title' %></h2> - <%= block_component_add_element t('.selection.add') %> + <%= block_component_add_element block, t('.selection.add') %> <draggable :list="data.elements" handle=".dragHandle" class="<%= if_appstack 'list-group' %>"> <div v-for="(element, index) in data.elements" class="draggable-item <%= if_appstack 'list-group-item' %>"> <div class="d-flex mb-n3"> @@ -23,7 +23,7 @@ </a> </div> <div class="flex-fill"> - <%= block_component_edit :id, template: @element %> + <%= block_component_edit block, :id, template: @element %> </div> <div> <a class="btn btn-sm text-danger ms-3" @@ -39,10 +39,10 @@ </div> <div class="col-lg-6"> <h2 class="h3"><%= t '.display.title' %></h2> - <%= block_component_edit :show_main_description %> + <%= block_component_edit block, :show_main_description %> <div v-show="data.layout != 'list'"> - <%= block_component_edit :show_description %> - <%= block_component_edit :show_image %> + <%= block_component_edit block, :show_description %> + <%= block_component_edit block, :show_image %> </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/pages/_preview.html.erb b/app/views/admin/communication/blocks/templates/pages/_preview.html.erb deleted file mode 100644 index f394a9424cb508481082ca203a019ae066eaa6fe..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/pages/_preview.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<p class="mb-0"> - <%= @template.selected_pages.first(2).collect(&:to_s).join(', ') %>... -</p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/pages/_show.html.erb b/app/views/admin/communication/blocks/templates/pages/_show.html.erb index 42f0873509ba6bec96c72a782d8ebf2352379e5e..3542cc95ddf8d12328dd8e61b97ea305474977f1 100644 --- a/app/views/admin/communication/blocks/templates/pages/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_show.html.erb @@ -1,39 +1,39 @@ <% class_name = "block block-pages" -unless @block.title.blank? +unless block.title.blank? class_name += " block-with-title" end -class_name += " block-pages--" + @block.template.layout +class_name += " block-pages--" + block.template.layout %> <section class="<%= class_name %>" style="display: none;"> <div class="container"> <div class="block-content"> - <% if @block.data %> - <% if @block.template.page %> - <%#= @block.template.page.slug %> + <% if block.data %> + <% if block.template.page %> + <%#= block.template.page.slug %> <% end %> - <% if @block.template.show_main_description %> + <% if block.template.show_main_description %> <p></p> <% end %> - <% if @block.template.layout === "list" %> + <% if block.template.layout === "list" %> <ul> - <% @block.template.elements.each do |element| %> + <% block.template.elements.each do |element| %> <li> <%#= element %> </li> <% end %> </ul> - <% elsif @block.template.layout === "cards" %> + <% elsif block.template.layout === "cards" %> <div class="cards"> - <% @block.template.elements.each do |element| %> + <% block.template.elements.each do |element| %> <article class="card"> <%# <%= element %> - <% if @block.template.show_description %> + <% if block.template.show_description %> <p><%#= element.summary %></p> <% end %> </article> @@ -43,10 +43,10 @@ class_name += " block-pages--" + @block.template.layout <% else %> <div class="grid"> - <% @block.template.elements.each do |element| %> + <% block.template.elements.each do |element| %> <article> <%# <%= element %> - <% if @block.template.show_description %> + <% if block.template.show_description %> <p><%#= element.summary %></p> <% end %> </article> diff --git a/app/views/admin/communication/blocks/templates/pages/_snippet.html.erb b/app/views/admin/communication/blocks/templates/pages/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..94f86899bf70939ceb041b8ae5766fa8f6f683c2 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/pages/_snippet.html.erb @@ -0,0 +1,3 @@ +<p class="mb-0"> + <%= block.template.selected_pages.first(2).collect(&:to_s).join(', ') %>... +</p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/partners/_edit.html.erb b/app/views/admin/communication/blocks/templates/partners/_edit.html.erb index 3cc3f271cafd1199382131842173753e794cb432..5296702906c8a3eb104455a4431da40a758aa3e7 100644 --- a/app/views/admin/communication/blocks/templates/partners/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_edit.html.erb @@ -1,13 +1,13 @@ -<%= block_component_edit :layout %> +<%= block_component_edit block, :layout %> <div class="row pure__row--small"> <div class="col-xl-6"> - <%= block_component_edit :description %> + <%= block_component_edit block, :description %> </div> <div class="col-xl-6"> <label class="form-label"> </label> - <%= block_component_edit :with_link %> - <%= block_component_edit :alphabetical %> + <%= block_component_edit block, :with_link %> + <%= block_component_edit block, :alphabetical %> </div> </div> <draggable :list="data.elements" class="mb-3 <%= if_appstack 'list-group' %>" handle=".partnerHandle"> @@ -19,16 +19,16 @@ </a> </div> <div class="flex-fill"> - <%= block_component_edit :id, template: @element, label: '' %> + <%= block_component_edit block, :id, template: @element, label: '' %> <div class="row pure__row--small mt-n2" v-if="!element.id"> <div class="col-xl-4 col-md-6"> - <%= block_component_edit :name, template: @element %> + <%= block_component_edit block, :name, template: @element %> </div> <div class="col-xl-4 col-md-6"> - <%= block_component_edit :url, template: @element %> + <%= block_component_edit block, :url, template: @element %> </div> <div class="col-xl-4 col-md-6"> - <%= block_component_edit :logo, template: @element %> + <%= block_component_edit block, :logo, template: @element %> </div> </div> </div> @@ -42,4 +42,4 @@ </div> </div> </draggable> -<%= block_component_add_element t('.add_partner') %> +<%= block_component_add_element block, t('.add_partner') %> diff --git a/app/views/admin/communication/blocks/templates/partners/_preview.html.erb b/app/views/admin/communication/blocks/templates/partners/_preview.html.erb deleted file mode 100644 index 40246eb957ea8eb7e8cf8f241bc7a295e63eeefd..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/partners/_preview.html.erb +++ /dev/null @@ -1,60 +0,0 @@ -<% - class_name = "block block-partners" - unless @block.title.blank? - class_name += " block-with-title" - end - class_name += " block-partners--" + @block.template.layout -%> - -<section class="<%= class_name %>"> - <div class="container"> - <div class="block-content"> - <% unless @block.title.blank? && @block.template.description.blank? %> - <div class="top"> - <% unless @block.title.blank? %> - <h2><%= @block.title %></h2> - <% end %> - <% unless @block.template.description.blank? %> - <div class="description"> - <p><%= block_component_preview :description %></p> - </div> - <% end %> - </div> - <% end %> - - <% if @block.template.layout == "grid" %> - <div class="organizations grid"> - <% else # Map %> - <div class="map" data-marker-icon="<%= image_path 'map-marker.svg' %>"> - <link rel="stylesheet" - href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" - integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI=" - crossorigin=""/> - <script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js" - integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM=" - crossorigin=""></script> - <% end %> - <% @block.template.elements.each do |element| %> - <article class="organization" - data-latitude="<%= element.organization&.latitude %>" - data-longitude="<%= element.organization&.longitude %>"> - <h3> - <% if element.best_url %> - <a href="<%= element.best_url %>" target="_blank"> - <% end %> - <%= element.best_name %> - <% if element.best_url%> - </a> - <% end %> - </h3> - <% if element.best_logo %> - <div class="media"> - <%= kamifusen_tag element.best_logo, width: 600%> - </div> - <% end %> - </article> - <% end %> - </div> - </div> - </div> -</section> diff --git a/app/views/admin/communication/blocks/templates/partners/_show.html.erb b/app/views/admin/communication/blocks/templates/partners/_show.html.erb index 85482048240fc6d8830d5f6ec70d054efea9b859..6b6b8fb693c876e58049665d71becbad25d1ed52 100644 --- a/app/views/admin/communication/blocks/templates/partners/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_show.html.erb @@ -1,30 +1,43 @@ <% -class_name = "block block-partners" -unless @block.title.blank? - class_name += " block-with-title" -end -class_name += " block-partners--" + @block.template.layout + class_name = "block block-partners" + unless block.title.blank? + class_name += " block-with-title" + end + class_name += " block-partners--" + block.template.layout %> + <section class="<%= class_name %>"> <div class="container"> <div class="block-content"> - - <% unless @block.title.blank? && @block.template.description.blank? %> + <% unless block.title.blank? && block.template.description.blank? %> <div class="top"> - <% unless @block.title.blank? %> - <h2><%= @block.title %></h2> + <% unless block.title.blank? %> + <h2><%= block.title %></h2> <% end %> - <% unless @block.template.description.blank? %> + <% unless block.template.description.blank? %> <div class="description"> - <p><%= block_component_preview :description %></p> + <p><%= block_component_show block, :description %></p> </div> <% end %> </div> <% end %> - <div class="grid organizations"> - <% @block.template.elements.each do |element| %> - <article class="organization"> + <% if block.template.layout == "grid" %> + <div class="organizations grid"> + <% else # Map %> + <div class="map" data-marker-icon="<%= image_path 'map-marker.svg' %>"> + <link rel="stylesheet" + href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" + integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI=" + crossorigin=""/> + <script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js" + integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM=" + crossorigin=""></script> + <% end %> + <% block.template.elements.each do |element| %> + <article class="organization" + data-latitude="<%= element.organization&.latitude %>" + data-longitude="<%= element.organization&.longitude %>"> <h3> <% if element.best_url %> <a href="<%= element.best_url %>" target="_blank"> @@ -34,13 +47,14 @@ class_name += " block-partners--" + @block.template.layout </a> <% end %> </h3> - <div class="media"> - <%= kamifusen_tag element.best_logo, width: 600 if element.best_logo %> - </div> + <% if element.best_logo %> + <div class="media"> + <%= kamifusen_tag element.best_logo, width: 600%> + </div> + <% end %> </article> <% end %> </div> - </div> </div> -</section> \ No newline at end of file +</section> diff --git a/app/views/admin/communication/blocks/templates/partners/_snippet.html.erb b/app/views/admin/communication/blocks/templates/partners/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..9bf2ac6f797f091bdee657b895c51c4b3e2be319 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/partners/_snippet.html.erb @@ -0,0 +1,9 @@ +<% block.template.elements.first(3).each do |element| %> + <span class="me-2"> + <% if element.best_logo %> + <%= image_tag element.best_logo, height: 90, class: 'bg-light p-2' %> + <% else %> + <%= element.best_name %> + <% end %> + </span> +<% end %> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/partners/_static.html.erb b/app/views/admin/communication/blocks/templates/partners/_static.html.erb index 7fc6aed3e28c176f809c15f63bd09603626eeff0..fdc65cc93e3ab6aa495ffd6b4db67797f03f5d24 100644 --- a/app/views/admin/communication/blocks/templates/partners/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_static.html.erb @@ -1,14 +1,14 @@ layout: <%= block.template.layout %> -<%= block_component_static :description %> -<%= block_component_static :with_link %> +<%= block_component_static block, :description %> +<%= block_component_static block, :with_link %> partners: <% block.template.elements.each do |element| %> <% next if element.best_name.blank? %> <% if element.organization %> - slug: "<%= element.organization.slug %>" <% else %> -<%= block_component_static :name, template: element, depth: 4, list: true %> -<%= block_component_static :url, template: element, depth: 5 %> +<%= block_component_static block, :name, template: element, depth: 4, list: true %> +<%= block_component_static block, :url, template: element, depth: 5 %> logo: "<%= element.logo_component.blob&.id %>" <% end %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/posts/_edit.html.erb b/app/views/admin/communication/blocks/templates/posts/_edit.html.erb index 2f4fd1964e3913fcbe8f73bdd80e585c995db30e..49f62f428327ec425b54e82392cbc6140bd7f243 100644 --- a/app/views/admin/communication/blocks/templates/posts/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/posts/_edit.html.erb @@ -1,25 +1,25 @@ -<%= block_component_edit :layout %> +<%= block_component_edit block, :layout %> <div class="mb-3"> - <%= block_component_edit :mode %> + <%= block_component_edit block, :mode %> <div class="row pure__row--small"> <div v-if="data.mode === 'category' || data.mode === 'all'" class="col-lg-3"> - <%= block_component_edit :posts_quantity %> + <%= block_component_edit block, :posts_quantity %> </div> <div v-if="data.mode === 'category'" class="col-lg-9"> - <%= block_component_edit :category_id %> + <%= block_component_edit block, :category_id %> </div> </div> </div> <div v-if="data.mode === 'selection'"> - <%= block_component_add_element t('.add_post') %> + <%= block_component_add_element block, t('.add_post') %> <draggable :list="data.elements" handle=".dragHandle" class="<%= if_appstack 'list-group' %>"> <div v-for="(element, index) in data.elements" class="d-flex draggable-item <%= if_appstack 'list-group-item' %>"> <a class="btn ps-0 dragHandle" title="Drag and drop"> <i class="<%= Icon::DRAG %> handle"></i> </a> <div class="flex-fill"> - <%= block_component_edit :id, template: @element %> + <%= block_component_edit block, :id, template: @element %> </div> <a class="btn text-danger ms-3" v-on:click="data.elements.splice(data.elements.indexOf(element), 1)" diff --git a/app/views/admin/communication/blocks/templates/posts/_preview.html.erb b/app/views/admin/communication/blocks/templates/posts/_preview.html.erb deleted file mode 100644 index a5271035bd5f3dc3bd9df8e66fbbea56a2d5c50a..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/posts/_preview.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<p class="mb-0"> - <%= @template.selected_posts.first(2).collect(&:to_s).join(', ') %>... -</p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/posts/_show.html.erb b/app/views/admin/communication/blocks/templates/posts/_show.html.erb index 0d73386078540ecaa076a29d2db3ed8cbbeb7d8f..74fb99e462d725c6278ccddbb13288c01fc67d6a 100644 --- a/app/views/admin/communication/blocks/templates/posts/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/posts/_show.html.erb @@ -1,21 +1,21 @@ <% $class = "block block-posts" -unless @block.title.blank? +unless block.title.blank? $class += " block-with-title" end -$class += " block-posts--" + @block.template.layout +$class += " block-posts--" + block.template.layout %> <section class="<%= $class %>"> <div class="container"> <div class="block-content"> - <% unless @block.title.blank? %> + <% unless block.title.blank? %> <div class="top"> - <h2><%= @block.title %></h2> + <h2><%= block.title %></h2> </div> <% end %> <div class="list"> - <% if @block.data %> - <% @block.template.selected_posts.each do |post| %> + <% if block.data %> + <% block.template.selected_posts.each do |post| %> <article class="post" itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting"> <div class="post-content"> <a href="#"><%= post %></a> diff --git a/app/views/admin/communication/blocks/templates/posts/_snippet.html.erb b/app/views/admin/communication/blocks/templates/posts/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..3c3af41adc0dc4c7518539fb2f5a6064fa5e69c7 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/posts/_snippet.html.erb @@ -0,0 +1,3 @@ +<p class="mb-0"> + <%= block.template.selected_posts.first(2).collect(&:to_s).join(', ') %>... +</p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/programs/_edit.html.erb b/app/views/admin/communication/blocks/templates/programs/_edit.html.erb index 6ad4d0836ded138a48e50149a61920a387169e0e..26581b4653cfaf48e45d4f9ee8853ccca87b9531 100644 --- a/app/views/admin/communication/blocks/templates/programs/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/programs/_edit.html.erb @@ -6,7 +6,7 @@ </a> </div> <div class="flex-fill mb-n3"> - <%= block_component_edit :id, template: @element, label: false %> + <%= block_component_edit block, :id, template: @element, label: false %> </div> <div> <a class="btn btn-sm text-danger ms-3" @@ -17,4 +17,4 @@ </div> </div> </draggable> -<%= block_component_add_element t('.add') %> +<%= block_component_add_element block, t('.add') %> diff --git a/app/views/admin/communication/blocks/templates/programs/_preview.html.erb b/app/views/admin/communication/blocks/templates/programs/_preview.html.erb deleted file mode 100644 index 19479fe9ac71b65a31af8c55ae3982a634db1634..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/programs/_preview.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<p class="mb-0"> - <%= @template.selected_programs.first(2).collect(&:to_s).join(', ') %>... -</p> diff --git a/app/views/admin/communication/blocks/templates/programs/_show.html.erb b/app/views/admin/communication/blocks/templates/programs/_show.html.erb index adda2a10c96ddae8c77b783cac0f71414345269d..3230d84b124cba7ee7c160aa030f5fe94af32a7e 100644 --- a/app/views/admin/communication/blocks/templates/programs/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/programs/_show.html.erb @@ -1,6 +1,6 @@ <% $class = "block block-programs" -unless @block.title.blank? +unless block.title.blank? $class += " block-with-title" end %> @@ -8,7 +8,7 @@ end <div class="container"> <div class="block-content"> <ol class="programs"> - <% @block.template.selected_programs.each do |program| %> + <% block.template.selected_programs.each do |program| %> <li> <%= program %></p> </li> diff --git a/app/views/admin/communication/blocks/templates/programs/_snippet.html.erb b/app/views/admin/communication/blocks/templates/programs/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..0ff37867c56782863b0a0e3c95a45b5ca5b01ecd --- /dev/null +++ b/app/views/admin/communication/blocks/templates/programs/_snippet.html.erb @@ -0,0 +1,3 @@ +<p class="mb-0"> + <%= block.template.selected_programs.first(2).collect(&:to_s).join(', ') %>... +</p> diff --git a/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb b/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb index 60f9eff62ac7f31cbd1b9d21abe0d9ac3867a002..705ae1ff16b223b599b374964f2021b91633b246 100644 --- a/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb @@ -1,6 +1,6 @@ <p class="small"><%= t('.title_disclaimer') %></p> -<%= block_component_add_element t('.add_testimonial') %> +<%= block_component_add_element block, t('.add_testimonial') %> <draggable :list="data.elements" handle=".dragHandle" class="row pure__row--small <%= if_appstack 'list-group' %>"> <div v-for="(element, index) in data.elements" class="<%= if_appstack 'list-group-item' %>"> @@ -13,14 +13,14 @@ <div class="flex-fill"> <div class="row pure__row--small mb-n3"> <div class="col-lg-4"> - <%= block_component_edit :text, template: @element %> + <%= block_component_edit block, :text, template: @element %> </div> <div class="col-lg-4"> - <%= block_component_edit :author, template: @element %> - <%= block_component_edit :job, template: @element %> + <%= block_component_edit block, :author, template: @element %> + <%= block_component_edit block, :job, template: @element %> </div> <div class="col-lg-4"> - <%= block_component_edit :photo, template: @element %> + <%= block_component_edit block, :photo, template: @element %> </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/testimonials/_preview.html.erb b/app/views/admin/communication/blocks/templates/testimonials/_preview.html.erb deleted file mode 100644 index 65a09c65b5f52f21f25b933b799bb3827185b5bb..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/testimonials/_preview.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<p class="mb-0"> - <% @block.template.elements.first(1).each do |element| %> - <%= strip_tags block_component_preview :text, template: element %> - <% end %> -</p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/testimonials/_show.html.erb b/app/views/admin/communication/blocks/templates/testimonials/_show.html.erb index 8bc4c337f1455b78f9a78c212ba58695ef909f7d..14db41e84ebc6c46ca1342ed8e28fa902319bfc0 100644 --- a/app/views/admin/communication/blocks/templates/testimonials/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/testimonials/_show.html.erb @@ -1,9 +1,9 @@ <% class_name = "block block-testimonials" - unless @block.title.blank? + unless block.title.blank? class_name += " block-with-title" end - if !@block.template.elements.one? + if !block.template.elements.one? class_name += " with-carousel" end %> @@ -12,7 +12,7 @@ <div class="container"> <div class="block-content"> <div class="testimonials"> - <% if !@block.template.elements.one? %> + <% if !block.template.elements.one? %> <div class="splide" data-splide='{ "arrows":false, @@ -29,11 +29,11 @@ <div class="splide__list"> <% end %> - <% @block.template.elements.each do |element| %> + <% block.template.elements.each do |element| %> <% element_blob = element.photo_component.blob %> - <figure <% if !@block.template.elements.one? %> class="splide__slide" <% end %>> + <figure <% if !block.template.elements.one? %> class="splide__slide" <% end %>> <blockquote> - <p><%= block_component_preview :text, template: element %></p> + <p><%= block_component_show block, :text, template: element %></p> </blockquote> <figcaption> <% if element_blob.present? %> @@ -43,16 +43,16 @@ <% end %> <p> <% if element.author %> - <span class="signature"><%= block_component_preview :author, template: element %></span> + <span class="signature"><%= block_component_show block, :author, template: element %></span> <% end %> <% if element.job %> - <span class="meta"><%= block_component_preview :job, template: element %></span> + <span class="meta"><%= block_component_show block, :job, template: element %></span> <% end %> </p> </figcaption> </figure> <% end %> - <% if !@block.template.elements.one? %> + <% if !block.template.elements.one? %> </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/testimonials/_snippet.html.erb b/app/views/admin/communication/blocks/templates/testimonials/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..7ef1b8cd24ebd9e2951fb76d05b166d09fa0b720 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/testimonials/_snippet.html.erb @@ -0,0 +1,5 @@ +<p class="mb-0"> + <% block.template.elements.first(1).each do |element| %> + <%= block_component_snippet block, :text, template: element %> + <% end %> +</p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/testimonials/_static.html.erb b/app/views/admin/communication/blocks/templates/testimonials/_static.html.erb index f267cde51931ff60e239ade8f314c3b2f37dda25..5a18d69e7592f8e1b92a896a02266f4cc3df6ddb 100644 --- a/app/views/admin/communication/blocks/templates/testimonials/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/testimonials/_static.html.erb @@ -1,7 +1,7 @@ testimonials: <% block.template.elements.each do |element| %> -<%= block_component_static :text, template: element, depth: 4, list: true %> -<%= block_component_static :author, template: element, depth: 5 %> -<%= block_component_static :job, template: element, depth: 5 %> -<%= block_component_static :photo, template: element, depth: 5 if element.photo %> +<%= block_component_static block, :text, template: element, depth: 4, list: true %> +<%= block_component_static block, :author, template: element, depth: 5 %> +<%= block_component_static block, :job, template: element, depth: 5 %> +<%= block_component_static block, :photo, template: element, depth: 5 if element.photo %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb b/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb index b640e234beddebd013408a9f2a188c971c485006..8e37282cb1830cb099bb7d7cc4bf7fc82ec8dca8 100644 --- a/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb @@ -1,5 +1,5 @@ -<%= block_component_edit :layout %> -<%= block_component_add_element t('.add_event') %> +<%= block_component_edit block, :layout %> +<%= block_component_add_element block, t('.add_event') %> <draggable :list="data.elements" handle=".dragHandle" class="<%= if_appstack 'list-group' %>"> <div v-for="(element, index) in data.elements" class="d-flex draggable-item <%= if_appstack 'list-group-item' %>"> @@ -11,10 +11,10 @@ <div class="flex-fill"> <div class="row pure__row--small mb-n3"> <div class="col-lg-5"> - <%= block_component_edit :title, template: @element %> + <%= block_component_edit block, :title, template: @element %> </div> <div class="col-lg-7"> - <%= block_component_edit :text, template: @element %> + <%= block_component_edit block, :text, template: @element %> </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/timeline/_preview.html.erb b/app/views/admin/communication/blocks/templates/timeline/_preview.html.erb deleted file mode 100644 index 327b790be0c2e11efb38b0b270f3e0913689ee01..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/timeline/_preview.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<p class="mb-0"> - <%= @block.template.elements.first(2).map { |element| - strip_tags(block_component_preview :title, template: element).strip - }.join(', ') - %>... -</p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/timeline/_show.html.erb b/app/views/admin/communication/blocks/templates/timeline/_show.html.erb index acbde3057d1016f290d11505a273d7966dbe4fed..e91e43895462108fa8bb251cb0b89c15bb14a8c7 100644 --- a/app/views/admin/communication/blocks/templates/timeline/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/timeline/_show.html.erb @@ -1,25 +1,25 @@ <% class_name = "block block-timeline" - unless @block.title.blank? + unless block.title.blank? class_name += " block-with-title" end - class_name += " block-timeline--" + @block.template.layout + class_name += " block-timeline--" + block.template.layout %> <section class="<%= class_name %>"> <div class="container"> - <% if @block.template.layout == "vertical" %> + <% if block.template.layout == "vertical" %> <div class="block-content"> - <% unless @block.title.blank? %> + <% unless block.title.blank? %> <div class="top"> - <h2><%= @block.title %></h2> + <h2><%= block.title %></h2> </div> <% end %> <div class="events"> - <% @block.template.elements.each do |element| %> + <% block.template.elements.each do |element| %> <article class="event"> <h3 class="event-title"> - <%= block_component_preview :title, template: element %> + <%= block_component_show block, :title, template: element %> </h3> <%# TODO: gérer les sauts de ligne %> @@ -30,20 +30,20 @@ </div> <% else %> <div class="timeline"> - <% unless @block.title.blank? %> - <h2><%= @block.title %></h2> + <% unless block.title.blank? %> + <h2><%= block.title %></h2> <% end %> <div class="events"> <ol> - <% @block.template.elements.each do |element| %> + <% block.template.elements.each do |element| %> <li class="event"> - <p class="title"><%= block_component_preview :title, template: element %><p> + <p class="title"><%= block_component_show block, :title, template: element %><p> <div class="line"></div> - <div class="description"><%= block_component_preview :text, template: element %></div> + <div class="description"><%= block_component_show block, :text, template: element %></div> </li> <% end %> </ol> - <% if !@block.template.elements.one? %> + <% if !block.template.elements.one? %> <div class="timeline-arrows"> <button class="previous" disabled></button> <button class="next"></button> diff --git a/app/views/admin/communication/blocks/templates/timeline/_snippet.html.erb b/app/views/admin/communication/blocks/templates/timeline/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..339cc07bc6bf0ed2bedc932b9cb5758ecb1b33af --- /dev/null +++ b/app/views/admin/communication/blocks/templates/timeline/_snippet.html.erb @@ -0,0 +1,6 @@ +<p class="mb-0"> + <%= block.template.elements.first(2).map { |element| + (block_component_snippet block, :title, template: element).strip + }.join(', ') + %>... +</p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/timeline/_static.html.erb b/app/views/admin/communication/blocks/templates/timeline/_static.html.erb index 0d895eab180e0678278c07f6715e4e688b5f5382..fec45a77f57f238ce2cb9ae0812846a0fb4f19ef 100644 --- a/app/views/admin/communication/blocks/templates/timeline/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/timeline/_static.html.erb @@ -1,6 +1,6 @@ -<%= block_component_static :layout %> +<%= block_component_static block, :layout %> events: <% block.template.elements.each do |element| %> -<%= block_component_static :title, template: element, depth: 4, list: true %> -<%= block_component_static :text, template: element, depth: 5 %> +<%= block_component_static block, :title, template: element, depth: 4, list: true %> +<%= block_component_static block, :text, template: element, depth: 5 %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/video/_edit.html.erb b/app/views/admin/communication/blocks/templates/video/_edit.html.erb index 33fb783148a95d9e5d4a1bb56871b0bed8905c97..a4e4d8fc18d9512a1897779ea98f0d88d1e84db3 100644 --- a/app/views/admin/communication/blocks/templates/video/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/video/_edit.html.erb @@ -1,10 +1,10 @@ <div class="row pure__row--small"> <div class="col-md-6"> - <%= block_component_edit :url %> - <%= block_component_edit :video_title %> + <%= block_component_edit block, :url %> + <%= block_component_edit block, :video_title %> </div> <div class="col-md-6"> - <%= block_component_edit :transcription, + <%= block_component_edit block, :transcription, label: t('admin.communication.blocks.components.text.transcription.label'), placeholder: t('admin.communication.blocks.components.text.transcription.placeholder'), rows: 10 %> </div> diff --git a/app/views/admin/communication/blocks/templates/video/_preview.html.erb b/app/views/admin/communication/blocks/templates/video/_preview.html.erb deleted file mode 100644 index b05923de320980a81e818164a40a9917e0b685cf..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/video/_preview.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= @block.template.video_iframe %> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/video/_show.html.erb b/app/views/admin/communication/blocks/templates/video/_show.html.erb index 5876a6ccb8503c3bfff23607bad534040799b0d8..62ddf854d761684b6ccd8c135ad5f0ce15dbc319 100644 --- a/app/views/admin/communication/blocks/templates/video/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/video/_show.html.erb @@ -1,30 +1,30 @@ <% class_name = "block block-video" -unless @block.title.blank? +unless block.title.blank? class_name += " block-with-title" end %> <section class="<%= class_name %>"> <div class="container"> <div class="block-content"> - <% unless @block.title.blank? %> + <% unless block.title.blank? %> <div class="top"> - <h2><%= @block.title %></h2> + <h2><%= block.title %></h2> </div> <% end %> - <% if @block.template.url.present? %> + <% if block.template.url.present? %> <div class="video"> - <%= @block.template.video_iframe %> + <%= block.template.video_iframe %> </div> <% end %> - <% if @block.template.video_title %> - <p><%= block_component_preview :video_title %></p> + <% if block.template.video_title %> + <p><%= block_component_show block, :video_title %></p> <% end %> - <% unless @block.template.transcription.blank? %> + <% unless block.template.transcription.blank? %> <div class="transcription"> <details> <summary><%= t 'accessibility.transcription' %></summary> - <p><%= block_component_preview :transcription %></p> + <p><%= block_component_show block, :transcription %></p> </details> </div> <% end %> diff --git a/app/views/admin/communication/blocks/templates/video/_snippet.html.erb b/app/views/admin/communication/blocks/templates/video/_snippet.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..d40a208aa2bb9d56b24183a6223b74c845c9fd96 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/video/_snippet.html.erb @@ -0,0 +1 @@ +<%= block.template.video_iframe %> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/video/_static.html.erb b/app/views/admin/communication/blocks/templates/video/_static.html.erb index ad5aae3546b5a64753c64decc27f1b8154a841f5..592e98d2c612deb20fd6694ee070278c82d27947 100644 --- a/app/views/admin/communication/blocks/templates/video/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/video/_static.html.erb @@ -1,7 +1,7 @@ -<%= block_component_static :url %> -<%= block_component_static :video_title %> +<%= block_component_static block, :url %> +<%= block_component_static block, :video_title %> <% if block.template.url.present? %> video_iframe: >- <%= block.template.video_iframe %> <% end %> -<%= block_component_static :transcription %> +<%= block_component_static block, :transcription %> diff --git a/app/views/admin/communication/extranets/posts/categories/preview.html.erb b/app/views/admin/communication/extranets/posts/categories/preview.html.erb index 99d37c119159952d761a91c9e448363eb6cd6c0f..3a5cdcc3c76ca4c11387e92c619494cd5631d2ca 100644 --- a/app/views/admin/communication/extranets/posts/categories/preview.html.erb +++ b/app/views/admin/communication/extranets/posts/categories/preview.html.erb @@ -1,3 +1,3 @@ <% content_for :title, @post.title %> <% content_for :image, kamifusen_tag(@post.featured_image) if @post.featured_image.attached? %> -<%= render 'admin/communication/blocks/list', about: @post %> +<%= render 'admin/communication/blocks/content/show', about: @post %> diff --git a/app/views/admin/communication/extranets/posts/preview.html.erb b/app/views/admin/communication/extranets/posts/preview.html.erb index 99d37c119159952d761a91c9e448363eb6cd6c0f..3a5cdcc3c76ca4c11387e92c619494cd5631d2ca 100644 --- a/app/views/admin/communication/extranets/posts/preview.html.erb +++ b/app/views/admin/communication/extranets/posts/preview.html.erb @@ -1,3 +1,3 @@ <% content_for :title, @post.title %> <% content_for :image, kamifusen_tag(@post.featured_image) if @post.featured_image.attached? %> -<%= render 'admin/communication/blocks/list', about: @post %> +<%= render 'admin/communication/blocks/content/show', about: @post %> diff --git a/app/views/admin/communication/extranets/posts/show.html.erb b/app/views/admin/communication/extranets/posts/show.html.erb index 823c70c0bbd98d339ea262423b3633a647a48f03..b6d807db6a34ebd7d7ce80081dfdc22573d6ee70 100644 --- a/app/views/admin/communication/extranets/posts/show.html.erb +++ b/app/views/admin/communication/extranets/posts/show.html.erb @@ -4,7 +4,7 @@ <div class="row"> <div class="col-xl-8"> <%= render 'admin/application/summary/show', about: @post %> - <%= render 'admin/communication/blocks/editor/editor', about: @post %> + <%= render 'admin/communication/blocks/content/editor', about: @post %> </div> <div class="col-xl-4"> <% diff --git a/app/views/admin/communication/websites/categories/show.html.erb b/app/views/admin/communication/websites/categories/show.html.erb index a9195f0ea5ad78ca2c08ce03617fb47f33c3e15d..7d9246480d8ca9addb7c8131f1da4031c9f3ce8b 100644 --- a/app/views/admin/communication/websites/categories/show.html.erb +++ b/app/views/admin/communication/websites/categories/show.html.erb @@ -4,7 +4,7 @@ <div class="row"> <div class="col-md-8"> <%= render 'admin/application/summary/show', about: @category %> - <%= render 'admin/communication/blocks/editor/editor', about: @category %> + <%= render 'admin/communication/blocks/content/editor', about: @category %> </div> <div class="col-md-4"> <%= render 'admin/application/i18n/widget', about: @category %> diff --git a/app/views/admin/communication/websites/categories/static.html.erb b/app/views/admin/communication/websites/categories/static.html.erb index 708772076a594461fea18fe3983d93105f52ca1e..da977e9c5824f672f30e644ab71c840b989c6fa6 100644 --- a/app/views/admin/communication/websites/categories/static.html.erb +++ b/app/views/admin/communication/websites/categories/static.html.erb @@ -16,5 +16,5 @@ position: <%= @about.position %> <%= render 'admin/application/featured_image/static' %> <%= render 'admin/application/meta_description/static' %> <%= render 'admin/application/summary/static' %> -<%= render 'admin/communication/blocks/static', about: @about %> +<%= render 'admin/communication/blocks/content/static', about: @about %> --- diff --git a/app/views/admin/communication/websites/pages/preview.html.erb b/app/views/admin/communication/websites/pages/preview.html.erb index ccf5a659a665a3bb647cc6346cf71f67cd3b0e93..95fbc2ed670224167259b90fda7548a92421836e 100644 --- a/app/views/admin/communication/websites/pages/preview.html.erb +++ b/app/views/admin/communication/websites/pages/preview.html.erb @@ -1,3 +1,3 @@ <% content_for :title, @page.title %> <% content_for :image, kamifusen_tag(@page.best_featured_image) if @page.best_featured_image.attached? %> -<%= render 'admin/communication/blocks/list', about: @page %> +<%= render 'admin/communication/blocks/content/show', about: @page %> diff --git a/app/views/admin/communication/websites/pages/show.html.erb b/app/views/admin/communication/websites/pages/show.html.erb index 8aff4d57218b662ad1832021399bdfbc9b3b8014..24978c47fa5d2d16d8d3a3f44f226065dfd90d03 100644 --- a/app/views/admin/communication/websites/pages/show.html.erb +++ b/app/views/admin/communication/websites/pages/show.html.erb @@ -6,7 +6,7 @@ <%= render 'admin/application/a11y/widget', about: @page, horizontal: true, small: true %> <hr class="my-5"> <%= render 'admin/communication/websites/pages/show/details' %> - <%= render 'admin/communication/blocks/editor/editor', about: @page %> + <%= render 'admin/communication/blocks/content/editor', about: @page %> <% end %> <%= render 'admin/application/dependencies', diff --git a/app/views/admin/communication/websites/pages/static.html.erb b/app/views/admin/communication/websites/pages/static.html.erb index cddc7e2f86999a9060a5ebd8f2e19d2327c7a43d..aeece0369ff23eca0bc7994867bba112c7a68c7f 100644 --- a/app/views/admin/communication/websites/pages/static.html.erb +++ b/app/views/admin/communication/websites/pages/static.html.erb @@ -33,5 +33,5 @@ header_text: >- <%= prepare_html_for_static @about.header_text, @website.university %> legacy_text: > <%= prepare_html_for_static @about.text, @about.university %> -<%= render 'admin/communication/blocks/static', about: @about %> +<%= render 'admin/communication/blocks/content/static', about: @about %> --- diff --git a/app/views/admin/communication/websites/pages/static.json.jbuilder b/app/views/admin/communication/websites/pages/static.json.jbuilder index cae8e7846c70a6ebfee60ce80c4dcd6446465e57..b27977456ed836b5434d9f0cab5c122600f08749 100644 --- a/app/views/admin/communication/websites/pages/static.json.jbuilder +++ b/app/views/admin/communication/websites/pages/static.json.jbuilder @@ -22,4 +22,4 @@ json.children @about.children json.partial! 'admin/application/meta_description/static' json.partial! 'admin/application/summary/static' json.header_text @about.header_text -json.partial! 'admin/communication/blocks/static', about: @about +json.partial! 'admin/communication/blocks/content/static', about: @about diff --git a/app/views/admin/communication/websites/posts/preview.html.erb b/app/views/admin/communication/websites/posts/preview.html.erb index 99d37c119159952d761a91c9e448363eb6cd6c0f..3a5cdcc3c76ca4c11387e92c619494cd5631d2ca 100644 --- a/app/views/admin/communication/websites/posts/preview.html.erb +++ b/app/views/admin/communication/websites/posts/preview.html.erb @@ -1,3 +1,3 @@ <% content_for :title, @post.title %> <% content_for :image, kamifusen_tag(@post.featured_image) if @post.featured_image.attached? %> -<%= render 'admin/communication/blocks/list', about: @post %> +<%= render 'admin/communication/blocks/content/show', about: @post %> diff --git a/app/views/admin/communication/websites/posts/show.html.erb b/app/views/admin/communication/websites/posts/show.html.erb index e43670e9517d86031b9b0d58ef798d488d494af3..de94cacd6ee49229ccd3c8db77c9bc7479bcca22 100644 --- a/app/views/admin/communication/websites/posts/show.html.erb +++ b/app/views/admin/communication/websites/posts/show.html.erb @@ -24,7 +24,7 @@ <%= render 'admin/application/meta_description/show', about: @post %> </div> </div> - <%= render 'admin/communication/blocks/editor/editor', about: @post %> + <%= render 'admin/communication/blocks/content/editor', about: @post %> <% end %> <% content_for :action_bar_left do %> diff --git a/app/views/admin/communication/websites/posts/static.html.erb b/app/views/admin/communication/websites/posts/static.html.erb index 4a3dd84b08f110417a3def554c4a6b007057a696..8f4dc2b7e390a5c2b98e07484ca4e60a2da92ad0 100644 --- a/app/views/admin/communication/websites/posts/static.html.erb +++ b/app/views/admin/communication/websites/posts/static.html.erb @@ -20,6 +20,6 @@ categories: <%= render 'admin/application/featured_image/static' %> <%= render 'admin/application/meta_description/static' %> <%= render 'admin/application/summary/static' %> -<%= render 'admin/communication/blocks/static', about: @about %> +<%= render 'admin/communication/blocks/content/static', about: @about %> --- <%= prepare_html_for_static @about.text, @about.university %> diff --git a/app/views/admin/education/diplomas/show.html.erb b/app/views/admin/education/diplomas/show.html.erb index 5a3743f6f654c5c75b057f14d5bd8cd1f3ec07f9..9966e9f25960d1cef34473b9facf1e250e81ded4 100644 --- a/app/views/admin/education/diplomas/show.html.erb +++ b/app/views/admin/education/diplomas/show.html.erb @@ -3,7 +3,7 @@ <div class="row"> <div class="col-xl-8"> <%= render 'admin/application/summary/show', about: @diploma %> - <%= render 'admin/communication/blocks/editor/editor', about: @diploma %> + <%= render 'admin/communication/blocks/content/editor', about: @diploma %> <%= osuny_panel Education::Diploma.human_attribute_name('programs') do %> <%= render 'admin/education/programs/list', programs: @programs, hide_diploma: true %> <% end %> diff --git a/app/views/admin/education/diplomas/static.html.erb b/app/views/admin/education/diplomas/static.html.erb index b0c0c08dcf5be36dcb09edb18b9d00b68e6aeebb..183571a19d9844f45abd6cddcc7294f92673c5e5 100644 --- a/app/views/admin/education/diplomas/static.html.erb +++ b/app/views/admin/education/diplomas/static.html.erb @@ -15,5 +15,5 @@ level: <%= @about.level_i18n %> ects: <%= @about.ects %> duration: > <%= prepare_text_for_static @about.duration %> -<%= render 'admin/communication/blocks/static', about: @about %> +<%= render 'admin/communication/blocks/content/static', about: @about %> --- diff --git a/app/views/admin/education/programs/preview.html.erb b/app/views/admin/education/programs/preview.html.erb index dc3cd62332534e37d1e117e67c97e4f7cc77936d..04c570b97750d133fae148d6ed462c97cdf50006 100644 --- a/app/views/admin/education/programs/preview.html.erb +++ b/app/views/admin/education/programs/preview.html.erb @@ -49,7 +49,7 @@ </section> <div class="blocks"> - <%= render 'admin/communication/blocks/list', about: @program %> + <%= render 'admin/communication/blocks/content/show', about: @program %> </div> <section id="pedagogy"> diff --git a/app/views/admin/education/programs/show.html.erb b/app/views/admin/education/programs/show.html.erb index f59732de46eee1a6f26b27b715057947cbcc64ae..6d32843fc32894991cbcf746e6396f400b18fb27 100644 --- a/app/views/admin/education/programs/show.html.erb +++ b/app/views/admin/education/programs/show.html.erb @@ -51,7 +51,7 @@ </div> </div> <% end %> - <%= render 'admin/communication/blocks/editor/editor', about: @program %> + <%= render 'admin/communication/blocks/content/editor', about: @program %> <hr class="pure__separation"> <%= render 'admin/education/programs/forms/part', part: :pedagogy, collapsed: true do %> <div class="row"> diff --git a/app/views/admin/education/programs/static.html.erb b/app/views/admin/education/programs/static.html.erb index fc78a8f231898e3c70e1cd104a8a5d0a8b877882..e0e923185c66094a2ea3f475e7c57bcd364dd246 100644 --- a/app/views/admin/education/programs/static.html.erb +++ b/app/views/admin/education/programs/static.html.erb @@ -83,5 +83,5 @@ apprenticeship: <%= @about.apprenticeship %> <%= property.to_s %>: > <%= prepare_html_for_static @about.send("best_#{property}"), @about.university %> <% end %> -<%= render 'admin/communication/blocks/static', about: @about %> +<%= render 'admin/communication/blocks/content/static', about: @about %> --- diff --git a/app/views/admin/research/journals/papers/show.html.erb b/app/views/admin/research/journals/papers/show.html.erb index c58219be8e380404c67714f033be4d0af64b75d5..5edfa1e1db8b2760040f9fa1ca1d8e6cfdb8ca93 100644 --- a/app/views/admin/research/journals/papers/show.html.erb +++ b/app/views/admin/research/journals/papers/show.html.erb @@ -22,7 +22,7 @@ <%= sanitize @paper.references %> <% end %> <% end %> - <%= render 'admin/communication/blocks/editor/editor', about: @paper %> + <%= render 'admin/communication/blocks/content/editor', about: @paper %> <%= render 'admin/application/dependencies', git_dependencies: @paper.git_dependencies(@paper.journal.websites.first), active_storage_blobs: @paper.active_storage_blobs %> diff --git a/app/views/admin/research/journals/papers/static.html.erb b/app/views/admin/research/journals/papers/static.html.erb index 396ade972c97f3c506f255675234eb1eebfb2227..896b1592dce5687b2768a50d828934ae2260c3b3 100644 --- a/app/views/admin/research/journals/papers/static.html.erb +++ b/app/views/admin/research/journals/papers/static.html.erb @@ -34,5 +34,5 @@ authors_list: > <%= render 'admin/application/summary/static' %> abstract: > <%= prepare_text_for_static @about.abstract %> -<%= render 'admin/communication/blocks/static', about: @about %> +<%= render 'admin/communication/blocks/content/static', about: @about %> --- diff --git a/app/views/admin/university/organizations/show.html.erb b/app/views/admin/university/organizations/show.html.erb index decf2c83e5ea2aa88de337faf35dc32561ce6811..de2be42d5cfb1af19a9d527898c0ef0326da7078 100644 --- a/app/views/admin/university/organizations/show.html.erb +++ b/app/views/admin/university/organizations/show.html.erb @@ -81,7 +81,7 @@ </div> <% end %> - <%= render 'admin/communication/blocks/editor/editor', about: @organization %> + <%= render 'admin/communication/blocks/content/editor', about: @organization %> </div> <div class="col-md-4"> diff --git a/app/views/admin/university/organizations/static.html.erb b/app/views/admin/university/organizations/static.html.erb index ac035815dde3defe990bba3c4ff006073013dd31..9a7848d6108b35155a0e585f79ca05ccd7905c45 100644 --- a/app/views/admin/university/organizations/static.html.erb +++ b/app/views/admin/university/organizations/static.html.erb @@ -52,6 +52,6 @@ logo_on_dark_background: "<%= @about.logo_on_dark_background.blob.id %>" <% end %> <%= render 'admin/application/meta_description/static' %> <%= render 'admin/application/summary/static' %> -<%= render 'admin/communication/blocks/static', about: @about %> +<%= render 'admin/communication/blocks/content/static', about: @about %> --- <%= prepare_html_for_static @about.text, @about.university %> diff --git a/app/views/admin/university/people/_main_infos.html.erb b/app/views/admin/university/people/_main_infos.html.erb index 6c09d9ad4216c85ccaec187ddc33f2f83187294d..43b3ecdc2c8935646a67a7fbe6e167df1a0b43dd 100644 --- a/app/views/admin/university/people/_main_infos.html.erb +++ b/app/views/admin/university/people/_main_infos.html.erb @@ -69,7 +69,7 @@ <% end %> <% end unless person.url.blank? && person.linkedin.blank? && person.twitter.blank? %> - <%= render 'admin/communication/blocks/editor/editor', about: person %> + <%= render 'admin/communication/blocks/content/editor', about: person %> </div> <div class="col-md-4 col-xl-3"> <%= osuny_panel t('metadata') do %> diff --git a/app/views/admin/university/people/static.html.erb b/app/views/admin/university/people/static.html.erb index 509b205208b4b01300ab955f824cb8fa5ef971ea..37a3e865cc4f6a75e56e762f04c13a4f26f28993 100644 --- a/app/views/admin/university/people/static.html.erb +++ b/app/views/admin/university/people/static.html.erb @@ -87,6 +87,6 @@ publications: url: "<%= publication.best_url %>" <% end %> <% end %> -<%= render 'admin/communication/blocks/static', about: @about %> +<%= render 'admin/communication/blocks/content/static', about: @about %> --- <%= prepare_html_for_static @about.biography, @about.university %> diff --git a/app/views/extranet/posts/posts/show.html.erb b/app/views/extranet/posts/posts/show.html.erb index bb7f6c728e4a1630f35e2499c7ed27949f6d9c45..7b4b8bc24aa80c01cb64b8153031bd61c506f7fb 100644 --- a/app/views/extranet/posts/posts/show.html.erb +++ b/app/views/extranet/posts/posts/show.html.erb @@ -23,5 +23,5 @@ <% end %> </main> -<%= render 'admin/communication/blocks/list', about: @post %> +<%= render 'admin/communication/blocks/content/show', about: @post %> <main> diff --git a/app/views/server/blocks/index.html.erb b/app/views/server/blocks/index.html.erb index e4c4deb8970ac3369e70e2894651bb031fefac6b..ce205347c86a287a432483c22f51c0fef23343ee 100644 --- a/app/views/server/blocks/index.html.erb +++ b/app/views/server/blocks/index.html.erb @@ -9,7 +9,7 @@ </tr> </thead> <tbody> - <% @templates.each do |template| %> + <% block.templates.each do |template| %> <tr> <td><%= link_to t("enums.communication.block.template_kind.#{template}"), server_block_path(template) %></td> <td><%= Communication::Block.send(template).count %></td>