From 991bccb5a48c68caa321c9df3678a8798240a988 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Tue, 11 Apr 2023 08:51:07 +0200 Subject: [PATCH] sorry for that --- app/helpers/admin/blocks_helper.rb | 21 +++++-- .../communication/blocks/_block.html.erb | 6 +- .../blocks/_block_static.html.erb | 11 ---- .../blocks/_block_static.json.jbuilder | 6 -- .../admin/communication/blocks/_list.html.erb | 4 -- .../communication/blocks/_static.html.erb | 27 +++------ .../blocks/_static.json.jbuilder | 10 ++-- .../blocks/components/_edit.html.erb | 6 +- .../{_preview.html.erb => _show.html.erb} | 4 +- .../blocks/components/_snippet.html.erb | 11 ++++ .../blocks/components/_static.html.erb | 2 +- .../{_preview.html.erb => _show.html.erb} | 0 .../blocks/components/array/_snippet.html.erb | 6 ++ .../{_preview.html.erb => _show.html.erb} | 0 .../_snippet.html.erb} | 0 .../blocks/components/category/_edit.html.erb | 2 +- .../{_preview.html.erb => _show.html.erb} | 0 .../components/category/_snippet.html.erb | 1 + .../{_preview.html.erb => _show.html.erb} | 0 .../blocks/components/code/_snippet.html.erb | 1 + .../{_preview.html.erb => _show.html.erb} | 0 .../_snippet.html.erb} | 0 .../{_preview.html.erb => _show.html.erb} | 2 +- .../blocks/components/image/_snippet.html.erb | 12 ++++ .../components/layout/_preview.html.erb | 7 --- .../blocks/components/layout/_show.html.erb | 3 + .../components/layout/_snippet.html.erb | 1 + .../_show.html.erb} | 0 .../components/number/_snippet.html.erb | 1 + .../_show.html.erb} | 0 .../option/_snippet.html.erb} | 0 .../{_preview.html.erb => _show.html.erb} | 0 .../components/organization/_snippet.html.erb | 1 + .../blocks/components/page/_edit.html.erb | 2 +- .../blocks/components/page/_show.html.erb | 1 + .../blocks/components/page/_snippet.html.erb | 1 + .../blocks/components/person/_edit.html.erb | 2 +- .../{_preview.html.erb => _show.html.erb} | 0 .../components/person/_snippet.html.erb | 1 + .../blocks/components/post/_edit.html.erb | 2 +- .../{_preview.html.erb => _show.html.erb} | 0 .../blocks/components/post/_snippet.html.erb | 1 + .../{_preview.html.erb => _show.html.erb} | 0 .../components/program/_snippet.html.erb | 1 + .../{_preview.html.erb => _show.html.erb} | 0 .../components/rich_text/_snippet.html.erb | 1 + .../blocks/components/string/_show.html.erb | 1 + .../components/string/_snippet.html.erb | 1 + .../{_preview.html.erb => _show.html.erb} | 0 .../blocks/components/text/_snippet.html.erb | 1 + .../{_preview.html.erb => _show.html.erb} | 0 .../components/time_slot/_snippet.html.erb | 1 + .../{editor => content}/_editor.html.erb | 0 .../blocks/content/_show.html.erb | 6 ++ .../blocks/content/_static.html.erb | 21 +++++++ .../blocks/content/_static.json.jbuilder | 7 +++ .../blocks/headings/_heading_static.html.erb | 12 ---- .../blocks/headings/_show.html.erb | 12 ++++ .../blocks/headings/_static.html.erb | 12 ++++ .../templates/call_to_action/_edit.html.erb | 16 ++--- .../call_to_action/_preview.html.erb | 6 -- .../templates/call_to_action/_show.html.erb | 30 +++++----- .../call_to_action/_snippet.html.erb | 6 ++ .../templates/call_to_action/_static.html.erb | 14 ++--- .../blocks/templates/chapter/_edit.html.erb | 12 ++-- .../templates/chapter/_preview.html.erb | 1 - .../blocks/templates/chapter/_show.html.erb | 30 ++++------ .../templates/chapter/_snippet.html.erb | 1 + .../blocks/templates/chapter/_static.html.erb | 10 ++-- .../blocks/templates/contact/_edit.html.erb | 20 +++---- .../templates/contact/_preview.html.erb | 32 ---------- .../blocks/templates/contact/_show.html.erb | 36 +++++------ .../templates/contact/_snippet.html.erb | 32 ++++++++++ .../blocks/templates/contact/_static.html.erb | 22 +++---- .../blocks/templates/datatable/_edit.html.erb | 6 +- .../templates/datatable/_preview.html.erb | 19 ------ .../blocks/templates/datatable/_show.html.erb | 22 +++---- .../templates/datatable/_snippet.html.erb | 19 ++++++ .../templates/datatable/_static.html.erb | 8 +-- .../templates/definitions/_edit.html.erb | 8 +-- .../templates/definitions/_preview.html.erb | 5 -- .../templates/definitions/_show.html.erb | 18 +++--- .../templates/definitions/_snippet.html.erb | 5 ++ .../templates/definitions/_static.html.erb | 6 +- .../blocks/templates/embed/_edit.html.erb | 4 +- .../blocks/templates/embed/_preview.html.erb | 1 - .../blocks/templates/embed/_show.html.erb | 12 ++-- .../blocks/templates/embed/_snippet.html.erb | 1 + .../blocks/templates/embed/_static.html.erb | 4 +- .../blocks/templates/features/_edit.html.erb | 16 ++--- .../blocks/templates/features/_show.html.erb | 0 .../templates/features/_snippet.html.erb | 0 .../templates/features/_static.html.erb | 12 ++-- .../blocks/templates/files/_edit.html.erb | 8 +-- .../blocks/templates/files/_show.html.erb | 14 ++--- .../{_preview.html.erb => _snippet.html.erb} | 2 +- .../blocks/templates/files/_static.html.erb | 6 +- .../blocks/templates/gallery/_edit.html.erb | 14 ++--- .../blocks/templates/gallery/_show.html.erb | 28 ++++----- .../{_preview.html.erb => _snippet.html.erb} | 2 +- .../blocks/templates/gallery/_static.html.erb | 12 ++-- .../blocks/templates/image/_edit.html.erb | 8 +-- .../blocks/templates/image/_show.html.erb | 10 ++-- .../{_preview.html.erb => _snippet.html.erb} | 2 +- .../blocks/templates/image/_static.html.erb | 8 +-- .../templates/key_figures/_edit.html.erb | 10 ++-- .../templates/key_figures/_preview.html.erb | 5 -- .../templates/key_figures/_show.html.erb | 20 +++---- .../templates/key_figures/_snippet.html.erb | 5 ++ .../templates/key_figures/_static.html.erb | 8 +-- .../organization_chart/_edit.html.erb | 14 ++--- .../organization_chart/_show.html.erb | 18 +++--- .../{_preview.html.erb => _snippet.html.erb} | 2 +- .../organization_chart/_static.html.erb | 8 +-- .../blocks/templates/pages/_edit.html.erb | 16 ++--- .../blocks/templates/pages/_preview.html.erb | 3 - .../blocks/templates/pages/_show.html.erb | 26 ++++---- .../blocks/templates/pages/_snippet.html.erb | 3 + .../blocks/templates/partners/_edit.html.erb | 18 +++--- .../templates/partners/_preview.html.erb | 60 ------------------- .../blocks/templates/partners/_show.html.erb | 52 ++++++++++------ .../templates/partners/_snippet.html.erb | 9 +++ .../templates/partners/_static.html.erb | 8 +-- .../blocks/templates/posts/_edit.html.erb | 12 ++-- .../blocks/templates/posts/_preview.html.erb | 3 - .../blocks/templates/posts/_show.html.erb | 12 ++-- .../blocks/templates/posts/_snippet.html.erb | 3 + .../blocks/templates/programs/_edit.html.erb | 4 +- .../templates/programs/_preview.html.erb | 3 - .../blocks/templates/programs/_show.html.erb | 4 +- .../templates/programs/_snippet.html.erb | 3 + .../templates/testimonials/_edit.html.erb | 10 ++-- .../templates/testimonials/_preview.html.erb | 5 -- .../templates/testimonials/_show.html.erb | 18 +++--- .../templates/testimonials/_snippet.html.erb | 5 ++ .../templates/testimonials/_static.html.erb | 8 +-- .../blocks/templates/timeline/_edit.html.erb | 8 +-- .../templates/timeline/_preview.html.erb | 6 -- .../blocks/templates/timeline/_show.html.erb | 26 ++++---- .../templates/timeline/_snippet.html.erb | 6 ++ .../templates/timeline/_static.html.erb | 6 +- .../blocks/templates/video/_edit.html.erb | 6 +- .../blocks/templates/video/_preview.html.erb | 1 - .../blocks/templates/video/_show.html.erb | 18 +++--- .../blocks/templates/video/_snippet.html.erb | 1 + .../blocks/templates/video/_static.html.erb | 6 +- .../posts/categories/preview.html.erb | 2 +- .../extranets/posts/preview.html.erb | 2 +- .../extranets/posts/show.html.erb | 2 +- .../websites/categories/show.html.erb | 2 +- .../websites/categories/static.html.erb | 2 +- .../websites/pages/preview.html.erb | 2 +- .../websites/pages/show.html.erb | 2 +- .../websites/pages/static.html.erb | 2 +- .../websites/pages/static.json.jbuilder | 2 +- .../websites/posts/preview.html.erb | 2 +- .../websites/posts/show.html.erb | 2 +- .../websites/posts/static.html.erb | 2 +- .../admin/education/diplomas/show.html.erb | 2 +- .../admin/education/diplomas/static.html.erb | 2 +- .../admin/education/programs/preview.html.erb | 2 +- .../admin/education/programs/show.html.erb | 2 +- .../admin/education/programs/static.html.erb | 2 +- .../research/journals/papers/show.html.erb | 2 +- .../research/journals/papers/static.html.erb | 2 +- .../university/organizations/show.html.erb | 2 +- .../university/organizations/static.html.erb | 2 +- .../university/people/_main_infos.html.erb | 2 +- .../admin/university/people/static.html.erb | 2 +- app/views/extranet/posts/posts/show.html.erb | 2 +- app/views/server/blocks/index.html.erb | 2 +- 171 files changed, 651 insertions(+), 637 deletions(-) delete mode 100644 app/views/admin/communication/blocks/_block_static.html.erb delete mode 100644 app/views/admin/communication/blocks/_block_static.json.jbuilder delete mode 100644 app/views/admin/communication/blocks/_list.html.erb rename app/views/admin/communication/blocks/components/{_preview.html.erb => _show.html.erb} (88%) create mode 100644 app/views/admin/communication/blocks/components/_snippet.html.erb rename app/views/admin/communication/blocks/components/array/{_preview.html.erb => _show.html.erb} (100%) create mode 100644 app/views/admin/communication/blocks/components/array/_snippet.html.erb rename app/views/admin/communication/blocks/components/boolean/{_preview.html.erb => _show.html.erb} (100%) rename app/views/admin/communication/blocks/components/{number/_preview.html.erb => boolean/_snippet.html.erb} (100%) rename app/views/admin/communication/blocks/components/category/{_preview.html.erb => _show.html.erb} (100%) create mode 100644 app/views/admin/communication/blocks/components/category/_snippet.html.erb rename app/views/admin/communication/blocks/components/code/{_preview.html.erb => _show.html.erb} (100%) create mode 100644 app/views/admin/communication/blocks/components/code/_snippet.html.erb rename app/views/admin/communication/blocks/components/file/{_preview.html.erb => _show.html.erb} (100%) rename app/views/admin/communication/blocks/components/{option/_preview.html.erb => file/_snippet.html.erb} (100%) rename app/views/admin/communication/blocks/components/image/{_preview.html.erb => _show.html.erb} (76%) create mode 100644 app/views/admin/communication/blocks/components/image/_snippet.html.erb delete mode 100644 app/views/admin/communication/blocks/components/layout/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/components/layout/_show.html.erb create mode 100644 app/views/admin/communication/blocks/components/layout/_snippet.html.erb rename app/views/admin/communication/blocks/components/{string/_preview.html.erb => number/_show.html.erb} (100%) create mode 100644 app/views/admin/communication/blocks/components/number/_snippet.html.erb rename app/views/admin/communication/blocks/components/{page/_preview.html.erb => option/_show.html.erb} (100%) rename app/views/admin/communication/blocks/{templates/features/_preview.html.erb => components/option/_snippet.html.erb} (100%) rename app/views/admin/communication/blocks/components/organization/{_preview.html.erb => _show.html.erb} (100%) create mode 100644 app/views/admin/communication/blocks/components/organization/_snippet.html.erb create mode 100644 app/views/admin/communication/blocks/components/page/_show.html.erb create mode 100644 app/views/admin/communication/blocks/components/page/_snippet.html.erb rename app/views/admin/communication/blocks/components/person/{_preview.html.erb => _show.html.erb} (100%) create mode 100644 app/views/admin/communication/blocks/components/person/_snippet.html.erb rename app/views/admin/communication/blocks/components/post/{_preview.html.erb => _show.html.erb} (100%) create mode 100644 app/views/admin/communication/blocks/components/post/_snippet.html.erb rename app/views/admin/communication/blocks/components/program/{_preview.html.erb => _show.html.erb} (100%) create mode 100644 app/views/admin/communication/blocks/components/program/_snippet.html.erb rename app/views/admin/communication/blocks/components/rich_text/{_preview.html.erb => _show.html.erb} (100%) create mode 100644 app/views/admin/communication/blocks/components/rich_text/_snippet.html.erb create mode 100644 app/views/admin/communication/blocks/components/string/_show.html.erb create mode 100644 app/views/admin/communication/blocks/components/string/_snippet.html.erb rename app/views/admin/communication/blocks/components/text/{_preview.html.erb => _show.html.erb} (100%) create mode 100644 app/views/admin/communication/blocks/components/text/_snippet.html.erb rename app/views/admin/communication/blocks/components/time_slot/{_preview.html.erb => _show.html.erb} (100%) create mode 100644 app/views/admin/communication/blocks/components/time_slot/_snippet.html.erb rename app/views/admin/communication/blocks/{editor => content}/_editor.html.erb (100%) create mode 100644 app/views/admin/communication/blocks/content/_show.html.erb create mode 100644 app/views/admin/communication/blocks/content/_static.html.erb create mode 100644 app/views/admin/communication/blocks/content/_static.json.jbuilder delete mode 100644 app/views/admin/communication/blocks/headings/_heading_static.html.erb create mode 100644 app/views/admin/communication/blocks/headings/_show.html.erb create mode 100644 app/views/admin/communication/blocks/headings/_static.html.erb delete mode 100644 app/views/admin/communication/blocks/templates/call_to_action/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/templates/call_to_action/_snippet.html.erb delete mode 100644 app/views/admin/communication/blocks/templates/chapter/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/templates/chapter/_snippet.html.erb delete mode 100644 app/views/admin/communication/blocks/templates/contact/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/templates/contact/_snippet.html.erb delete mode 100644 app/views/admin/communication/blocks/templates/datatable/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/templates/datatable/_snippet.html.erb delete mode 100644 app/views/admin/communication/blocks/templates/definitions/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/templates/definitions/_snippet.html.erb delete mode 100644 app/views/admin/communication/blocks/templates/embed/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/templates/embed/_snippet.html.erb create mode 100644 app/views/admin/communication/blocks/templates/features/_show.html.erb create mode 100644 app/views/admin/communication/blocks/templates/features/_snippet.html.erb rename app/views/admin/communication/blocks/templates/files/{_preview.html.erb => _snippet.html.erb} (65%) rename app/views/admin/communication/blocks/templates/gallery/{_preview.html.erb => _snippet.html.erb} (76%) rename app/views/admin/communication/blocks/templates/image/{_preview.html.erb => _snippet.html.erb} (64%) delete mode 100644 app/views/admin/communication/blocks/templates/key_figures/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/templates/key_figures/_snippet.html.erb rename app/views/admin/communication/blocks/templates/organization_chart/{_preview.html.erb => _snippet.html.erb} (87%) delete mode 100644 app/views/admin/communication/blocks/templates/pages/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/templates/pages/_snippet.html.erb delete mode 100644 app/views/admin/communication/blocks/templates/partners/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/templates/partners/_snippet.html.erb delete mode 100644 app/views/admin/communication/blocks/templates/posts/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/templates/posts/_snippet.html.erb delete mode 100644 app/views/admin/communication/blocks/templates/programs/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/templates/programs/_snippet.html.erb delete mode 100644 app/views/admin/communication/blocks/templates/testimonials/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/templates/testimonials/_snippet.html.erb delete mode 100644 app/views/admin/communication/blocks/templates/timeline/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/templates/timeline/_snippet.html.erb delete mode 100644 app/views/admin/communication/blocks/templates/video/_preview.html.erb create mode 100644 app/views/admin/communication/blocks/templates/video/_snippet.html.erb diff --git a/app/helpers/admin/blocks_helper.rb b/app/helpers/admin/blocks_helper.rb index 8fd5fd1ef..20d23bf05 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 6b250bb25..f4199c900 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 e0deae985..000000000 --- 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 d40e6fa31..000000000 --- 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 a3025dc26..000000000 --- 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 9280c0fb6..226c469b0 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 ed38ad869..d40e6fa31 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 f3c6a8352..11b4f5b31 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 dba5b4cd5..2824a1b56 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 000000000..1b53d6be6 --- /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 57e05ca8e..9d1eec353 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 000000000..9d061a81f --- /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 81468e51d..d815d523f 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 000000000..1a4ddd3f7 --- /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 000000000..4c4e1d3fd --- /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 8d40fa51a..9468992f4 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 000000000..9468992f4 --- /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 22e6f2ef1..000000000 --- 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 000000000..0754f7192 --- /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 000000000..840b485d2 --- /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 000000000..39fbb33ec --- /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 000000000..e303dbb1e --- /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 fa13fccae..47d3fc43d 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 000000000..30383a9ca --- /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 000000000..30383a9ca --- /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 ec05a677b..051729914 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 000000000..c6c01864d --- /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 594ad08b3..06f079242 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 000000000..0a44bd0c0 --- /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 000000000..01e730d52 --- /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 000000000..c533e1edd --- /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 000000000..39fbb33ec --- /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 000000000..4c4e1d3fd --- /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 000000000..4c4e1d3fd --- /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 000000000..e2e6fce5a --- /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 000000000..6e24d9e9e --- /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 000000000..a0a6c08fd --- /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 000000000..e0dda60b1 --- /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 a03e792a2..000000000 --- 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 000000000..8c36bd521 --- /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 000000000..e654f6294 --- /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 b97988ebb..675083ffb 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 c28a3ce6e..000000000 --- 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 06a081142..7d3fad7c9 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 000000000..4012532fe --- /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 a1a67ce09..428618492 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 23e543361..d1797af49 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 61285f89b..000000000 --- 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 838aa58f3..707e34bef 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 000000000..0d6437746 --- /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 470574b71..e6c7aa4fd 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 ef91a9a86..39326a4d5 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 73cd9185d..000000000 --- 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 5c37e6e40..70dcd2157 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 000000000..967073ea2 --- /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 16c95afe1..454d4af41 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 3c759cf3d..c2c10608d 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 ee86cc8b4..000000000 --- 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 f1df72394..3a404a14c 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 000000000..bad5cc62c --- /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 b14460605..458507f33 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 577a6a16e..52bf12364 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 c5cf27c7d..000000000 --- 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 0673ec78f..a7377917a 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 000000000..cfb1e89e3 --- /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 fd9afb253..d9955774e 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 e1824fa85..2adc4a122 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 ee1017d64..000000000 --- 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 d6bc1a1e6..192db41c2 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 000000000..481a29ffc --- /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 fcd9a7d66..e515ac323 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 e9a60f1c5..48df83e44 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 000000000..e69de29bb 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 000000000..e69de29bb 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 2dd180eae..265d924f2 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 0fe565559..181651235 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 f9ebe021d..8b34187b8 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 cf6c347d9..a1bbb1484 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 11793b83f..84106e90f 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 9e77ce4f5..3d2e09881 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 c39269102..60ec10386 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 2ff2e3b29..2131b1ff1 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 2d82becb5..180516573 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 e4a5433e6..fbbb4389c 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 622c48b26..2e6d009ec 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 48104b4c8..dde57aad1 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 df1923006..2ef537845 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 722deb0fc..cb8b57e87 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 8ca91acc0..000000000 --- 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 27615c8ef..a4eae29b9 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 000000000..b33dda31d --- /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 dc4978617..4bdf5dbae 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 2262e66e7..b48db344c 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 7dae993fe..3ad8c0637 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 af63c0eb5..94c0bbf52 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 7f29eb08d..c4d4f4ac2 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 814d64830..9d6920871 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 f394a9424..000000000 --- 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 42f087350..3542cc95d 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 000000000..94f86899b --- /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 3cc3f271c..529670290 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 40246eb95..000000000 --- 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 854820482..6b6b8fb69 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 000000000..9bf2ac6f7 --- /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 7fc6aed3e..fdc65cc93 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 2f4fd1964..49f62f428 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 a5271035b..000000000 --- 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 0d7338607..74fb99e46 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 000000000..3c3af41ad --- /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 6ad4d0836..26581b465 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 19479fe9a..000000000 --- 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 adda2a10c..3230d84b1 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 000000000..0ff37867c --- /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 60f9eff62..705ae1ff1 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 65a09c65b..000000000 --- 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 8bc4c337f..14db41e84 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 000000000..7ef1b8cd2 --- /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 f267cde51..5a18d69e7 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 b640e234b..8e37282cb 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 327b790be..000000000 --- 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 acbde3057..e91e43895 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 000000000..339cc07bc --- /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 0d895eab1..fec45a77f 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 33fb78314..a4e4d8fc1 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 b05923de3..000000000 --- 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 5876a6ccb..62ddf854d 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 000000000..d40a208aa --- /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 ad5aae354..592e98d2c 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 99d37c119..3a5cdcc3c 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 99d37c119..3a5cdcc3c 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 823c70c0b..b6d807db6 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 a9195f0ea..7d9246480 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 708772076..da977e9c5 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 ccf5a659a..95fbc2ed6 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 8aff4d572..24978c47f 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 cddc7e2f8..aeece0369 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 cae8e7846..b27977456 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 99d37c119..3a5cdcc3c 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 e43670e95..de94cacd6 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 4a3dd84b0..8f4dc2b7e 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 5a3743f6f..9966e9f25 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 b0c0c08dc..183571a19 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 dc3cd6233..04c570b97 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 f59732de4..6d32843fc 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 fc78a8f23..e0e923185 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 c58219be8..5edfa1e1d 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 396ade972..896b1592d 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 decf2c83e..de2be42d5 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 ac035815d..9a7848d61 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 6c09d9ad4..43b3ecdc2 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 509b20520..37a3e865c 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 bb7f6c728..7b4b8bc24 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 e4c4deb89..ce205347c 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> -- GitLab