diff --git a/app/controllers/admin/communication/blocks_controller.rb b/app/controllers/admin/communication/blocks_controller.rb index 37978e45799d3f99b8c3275075551d920d89c37f..325c5c14f9bc888f335805f8bdb04858272413ab 100644 --- a/app/controllers/admin/communication/blocks_controller.rb +++ b/app/controllers/admin/communication/blocks_controller.rb @@ -11,10 +11,6 @@ class Admin::Communication::BlocksController < Admin::Communication::Application end end - def show - breadcrumb - end - def new @block.about_type = params[:about_type] @block.about_id = params[:about_id] @@ -23,13 +19,13 @@ class Admin::Communication::BlocksController < Admin::Communication::Application def edit breadcrumb - add_breadcrumb t('edit') end def create @block.university = current_university if @block.save - redirect_to [:edit, :admin, @block], notice: t('admin.successfully_created_html', model: @block.to_s) + redirect_to [:edit, :admin, @block], + notice: t('admin.successfully_created_html', model: @block.to_s) else breadcrumb render :new, status: :unprocessable_entity @@ -38,7 +34,8 @@ class Admin::Communication::BlocksController < Admin::Communication::Application def update if @block.update(block_params) - redirect_to about_path, notice: t('admin.successfully_updated_html', model: @block.to_s) + redirect_to about_path, + notice: t('admin.successfully_updated_html', model: @block.to_s) else breadcrumb add_breadcrumb t('edit') @@ -49,7 +46,8 @@ class Admin::Communication::BlocksController < Admin::Communication::Application def destroy path = about_path @block.destroy - redirect_to path, notice: t('admin.successfully_destroyed_html', model: @block.to_s) + redirect_to path, + notice: t('admin.successfully_destroyed_html', model: @block.to_s) end protected @@ -71,7 +69,7 @@ class Admin::Communication::BlocksController < Admin::Communication::Application if @block.new_record? add_breadcrumb t('communication.block.choose_template') else - add_breadcrumb @block, [:admin, @block] + add_breadcrumb @block end end diff --git a/app/views/admin/communication/blocks/_list.html.erb b/app/views/admin/communication/blocks/_list.html.erb index 57474428928ba829e1b05f3a2a9cdfd7cfc9de57..88ca81f61493955bfba96b2d5acfea3ffbb6ebaa 100644 --- a/app/views/admin/communication/blocks/_list.html.erb +++ b/app/views/admin/communication/blocks/_list.html.erb @@ -28,11 +28,10 @@ <% end %> <td><%= link_to_if can?(:read, block), block.to_s.truncate(50), - admin_communication_block_path(block) %></td> + edit_admin_communication_block_path(block, website_id: nil) %></td> <td><%= block.template_kind_i18n %></td> <td class="text-end"> <div class="btn-group" role="group"> - <%= edit_link block %> <%= destroy_link block %> </div> </td> diff --git a/app/views/admin/communication/blocks/_preview.html.erb b/app/views/admin/communication/blocks/_preview.html.erb index 72d57e3ae7ad6244f32e791ac6204ec3af38cd3a..40d11ae7eaa06d15231a62d9f5a8b52c989891f0 100644 --- a/app/views/admin/communication/blocks/_preview.html.erb +++ b/app/views/admin/communication/blocks/_preview.html.erb @@ -3,4 +3,4 @@ @block = block @preview = true %> -<%= render "admin/communication/blocks/templates/#{@block.template_kind}/show" %> +<%= render "admin/communication/blocks/templates/#{@block.template_kind}/preview" %> diff --git a/app/views/admin/communication/blocks/show.html.erb b/app/views/admin/communication/blocks/show.html.erb deleted file mode 100644 index 8ae4009e2bc14f54b5c3151f7b3b488b911dc51b..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/show.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% content_for :title, @block %> - -<%= render "admin/communication/blocks/templates/#{@block.template_kind}/show" %> - -<% content_for :action_bar_right do %> - <%= edit_link @block %> -<% 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 74caee4a0f55716c0f7d1eb925d5abbd42cbc358..64a93f3920fc86fcfae291cdd108f9e56fa7c196 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 @@ -19,7 +19,7 @@ for="image"> <%= t '.image_title' %> </label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="file" accept="image/*" @change="onFileImageChange( $event, data, 'image' )" 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 new file mode 100644 index 0000000000000000000000000000000000000000..5b63da6c787ef9fbefffea06a5c8b9707f1b1e4d --- /dev/null +++ b/app/views/admin/communication/blocks/templates/call_to_action/_preview.html.erb @@ -0,0 +1,31 @@ +<div class="card"> + <div class="card-body"> + <% if @block.template.image %> + <div style= "max-width: 200px;" class="me-3"> + <%= kamifusen_tag @block.template.image.blob, + width: 200, + alt: @block.template.image.alt, + class: 'img-fluid' %> + <caption><%= @block.template.image.alt %></caption> + </div> + <hr> + <% end %> + <%= @block.template.text.html_safe %> + <% unless @block.template.url.blank? %> + <a href="<%= @block.template.url %>" + class="btn btn-primary" + target="_blank" + rel="noopener"> + <%= @block.template.button %> + </a> + <% end %> + <% unless @block.template.url_secondary.blank? %> + <a href="<%= @block.template.url_secondary %>" + class="btn btn-secondary" + target="_blank" + rel="noopener"> + <%= @block.template.button_secondary %> + </a> + <% end %> + </div> +</div> 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 deleted file mode 100644 index bb36af7503343bb9e10a3630df0e96522018e057..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/call_to_action/_show.html.erb +++ /dev/null @@ -1,35 +0,0 @@ -<div class="<%= 'row' unless @preview %>"> - <div class="<%= 'col-md-8 col-xl-6' unless @preview %>"> - <div class="card"> - <div class="card-body"> - <% if @block.template.image %> - <div style= "max-width: 200px;" class="me-3"> - <%= kamifusen_tag @block.template.image.blob, - width: 200, - alt: @block.template.image.alt, - class: 'img-fluid' %> - <caption><%= @block.template.image.alt %></caption> - </div> - <hr> - <% end %> - <%= @block.template.text.html_safe %> - <% unless @block.template.url.blank? %> - <a href="<%= @block.template.url %>" - class="btn btn-primary" - target="_blank" - rel="noopener"> - <%= @block.template.button %> - </a> - <% end %> - <% unless @block.template.url_secondary.blank? %> - <a href="<%= @block.template.url_secondary %>" - class="btn btn-secondary" - target="_blank" - rel="noopener"> - <%= @block.template.button_secondary %> - </a> - <% end %> - </div> - </div> - </div> -</div> diff --git a/app/views/admin/communication/blocks/templates/chapter/_show.html.erb b/app/views/admin/communication/blocks/templates/chapter/_preview.html.erb similarity index 100% rename from app/views/admin/communication/blocks/templates/chapter/_show.html.erb rename to app/views/admin/communication/blocks/templates/chapter/_preview.html.erb diff --git a/app/views/admin/communication/blocks/templates/datatable/_show.html.erb b/app/views/admin/communication/blocks/templates/datatable/_preview.html.erb similarity index 100% rename from app/views/admin/communication/blocks/templates/datatable/_show.html.erb rename to app/views/admin/communication/blocks/templates/datatable/_preview.html.erb 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 08b6904d07cd7bda91fc900bf8bb1ec07456b0fe..8e3741feaed7a720d61a62d7b2b7ec32e989cf52 100644 --- a/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb @@ -16,7 +16,7 @@ <div class="flex-fill"> <label class="form-label" :for="'definition-' + index + '-title'"><%= t '.title_label' %></label> - <input class="form-control mb-2" + <input class="form-control mb-3" v-model="definition.title" placeholder="<%= t '.title_placeholder' %>" type="text" @@ -24,7 +24,7 @@ <label class="form-label" :for="'definition-' + index + '-text'"><%= t '.text_label' %></label> - <textarea class="form-control mb-2" + <textarea class="form-control mb-3" rows="3" v-model="definition.text" placeholder="<%= t '.text_placeholder' %>" diff --git a/app/views/admin/communication/blocks/templates/definitions/_show.html.erb b/app/views/admin/communication/blocks/templates/definitions/_preview.html.erb similarity index 100% rename from app/views/admin/communication/blocks/templates/definitions/_show.html.erb rename to app/views/admin/communication/blocks/templates/definitions/_preview.html.erb diff --git a/app/views/admin/communication/blocks/templates/embed/_show.html.erb b/app/views/admin/communication/blocks/templates/embed/_preview.html.erb similarity index 100% rename from app/views/admin/communication/blocks/templates/embed/_show.html.erb rename to app/views/admin/communication/blocks/templates/embed/_preview.html.erb diff --git a/app/views/admin/communication/blocks/templates/files/_show.html.erb b/app/views/admin/communication/blocks/templates/files/_preview.html.erb similarity index 100% rename from app/views/admin/communication/blocks/templates/files/_show.html.erb rename to app/views/admin/communication/blocks/templates/files/_preview.html.erb 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 bb2d880de4cf79f95dd91b8c35bf9d9fa13c4ec9..54adeec53b73ccbd93e15e0cfa540f86b74edace 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb @@ -24,7 +24,7 @@ :for="'image-file-' + imageIndex"> <%= t '.image_label' %> </label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="file" accept="image/*" @change="onFileImageChange( $event, image, 'file' )" diff --git a/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb b/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..baa661e3c126e45e493b906aa00c6cbb47fbcff5 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb @@ -0,0 +1,11 @@ +<% @block.template.images_with_alt.each do |image| %> + <article class="card"> + <% if image.blob %> + <%= kamifusen_tag image.blob, width: 500, class: 'img-fluid mb-3' %> + <% end %> + <div class="card-body"> + <p class="mb-0"><%= image.alt %></p> + <p class="mb-0 small"><%= image.text %></p> + </div> + </article> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/gallery/_show.html.erb b/app/views/admin/communication/blocks/templates/gallery/_show.html.erb deleted file mode 100644 index 85b3ef064ef15f41b44eeade08097b24746e3299..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/gallery/_show.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<div class="<%= 'row' unless @preview %>"> - <% @block.template.images_with_alt.each do |image| %> - <div class="<%= 'col-xxl-2 col-xl-3 col-6' unless @preview %>"> - <article class="card"> - <% if image.blob %> - <%= kamifusen_tag image.blob, width: 500, class: 'img-fluid mb-2' %> - <% end %> - <div class="card-body"> - <p class="mb-0"><%= image.alt %></p> - <p class="mb-0 small"><%= image.text %></p> - </div> - </article> - </div> - <% end %> -</div> diff --git a/app/views/admin/communication/blocks/templates/image/_preview.html.erb b/app/views/admin/communication/blocks/templates/image/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..6649deb292b52da67edd50e48a8275de484c5ec5 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/image/_preview.html.erb @@ -0,0 +1,7 @@ +<%= kamifusen_tag @block.template.image.blob, + width: 600, + alt: @block.template.image.alt, + class: 'img-fluid' if @block.template.image %> +<caption><%= @block.template.image.alt %></caption> +<p class="small"><%= @block.template.image.credit %></p> +<%= @block.template.text.html_safe %> diff --git a/app/views/admin/communication/blocks/templates/image/_show.html.erb b/app/views/admin/communication/blocks/templates/image/_show.html.erb deleted file mode 100644 index df964378803ea64ff150c4b636528a41d22a14fd..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/image/_show.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<div class="<%= 'row' unless @preview %>"> - <div class="<%= 'col-lg-3' unless @preview %>"> - <% if @block.template.image %> - <%= kamifusen_tag @block.template.image.blob, - width: 600, - alt: @block.template.image.alt, - class: 'img-fluid' %> - <% end %> - </div> - <div class="<%= 'col-lg-3' unless @preview %>"> - <caption><%= @block.template.image.alt %></caption> - <p class="small"><%= @block.template.image.credit %></p> - </div> - <div class="<%= 'col-lg-4' unless @preview %>"> - <%= @block.template.text.html_safe %> - </div> -</div> diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_preview.html.erb b/app/views/admin/communication/blocks/templates/organization_chart/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..1ba8ba5a07ea9f15432677b2ab1db74cf3521431 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/organization_chart/_preview.html.erb @@ -0,0 +1,15 @@ +<% @block.template.persons_with_role.each do |person_with_role| + person = person_with_role.person %> + <article class="card"> + <div class="card-body"> + <% if person.best_picture.attached? %> + <div style="max-width: 80px" class="float-end"> + <%= kamifusen_tag person.best_picture, + class: 'img-fluid rounded-circle' %> + </div> + <% end %> + <h3 class="card-title h5"><%= link_to person, [:admin, person] %></h3> + <p class="mb-0"><%= person_with_role.role %></p> + </div> + </article> +<% end %> 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 deleted file mode 100644 index f0181c8f801110e335636fdf6937065c9b3c0b5c..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -<div class="<%= 'row' unless @preview %>"> - <% @block.template.persons_with_role.each do |person_with_role| - person = person_with_role.person %> - <div class="<%= 'col-md-3' unless @preview %>"> - <article class="card"> - <div class="card-body"> - <% if person.best_picture.attached? %> - <div style="max-width: 80px" class="float-end"> - <%= kamifusen_tag person.best_picture, - class: 'img-fluid rounded-circle' %> - </div> - <% end %> - <h3 class="card-title h5"><%= link_to person, [:admin, person] %></h3> - <p class="mb-0"><%= person_with_role.role %></p> - </div> - </article> - </div> - <% end %> -</div> 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 8ac8909e21b1df8673b76a3a33f7539b34186f32..9696bd4933e62089a1b4f7e7e0e86185587979ae 100644 --- a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb @@ -38,7 +38,7 @@ <div class="card"> <div class="card-body"> <div class="row"> - <div class="mb-2"> + <div class="mb-3"> <a class="btn btn-sm btn-danger float-end" v-on:click="data.elements.splice(data.elements.indexOf(page), 1)" title="Delete"> diff --git a/app/views/admin/communication/blocks/templates/pages/_show.html.erb b/app/views/admin/communication/blocks/templates/pages/_preview.html.erb similarity index 100% rename from app/views/admin/communication/blocks/templates/pages/_show.html.erb rename to app/views/admin/communication/blocks/templates/pages/_preview.html.erb 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 476799fa01a5adf804428f42625b1c5c1dfc51ac..cd3b51853de9304519b47bad410fc7437f67c18f 100644 --- a/app/views/admin/communication/blocks/templates/partners/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_edit.html.erb @@ -11,7 +11,7 @@ </a> </div> <div class="flex-fill"> - <div class="row mb-3"> + <div class="row"> <div class="col-lg-4"> <select :id="'organization-' + index + '-id'" class="form-select select" @@ -23,12 +23,12 @@ </select> </div> </div> - <div class="row" v-if="!partner.id"> + <div class="row mt-3" v-if="!partner.id"> <div class="col-lg-4"> <label class="form-label" :for="'partner-' + index + '-name'"><%= t '.partner_name_label' %></label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="text" v-model="partner.name" placeholder="<%= t '.partner_name_placeholder' %>" @@ -39,7 +39,7 @@ :for="'partner-' + index + '-url'"> <%= t '.partner_url_label' %> </label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="url" v-model="partner.url" placeholder="<%= t '.partner_url_placeholder' %>" @@ -52,7 +52,7 @@ :for="'partner-' + index + '-logo'"> <%= t '.partner_logo_label' %> </label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="file" accept="image/*" @change="onFileImageChange( $event, partner, 'logo' )" diff --git a/app/views/admin/communication/blocks/templates/partners/_preview.html.erb b/app/views/admin/communication/blocks/templates/partners/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..989a14a51f02d21ed622135ce2120ebecea75d71 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/partners/_preview.html.erb @@ -0,0 +1,11 @@ +<% @block.template.partners.each do |partner| %> + <article class="card"> + <%= kamifusen_tag partner.blob, + width: 300, + class: 'img-fluid mb-3' unless partner.blob.nil? %> + <div class="card-body"> + <h3 class="card-title h5"><%= partner.name %></h3> + <p class="mb-0"><%= partner.url %></p> + </div> + </article> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/partners/_show.html.erb b/app/views/admin/communication/blocks/templates/partners/_show.html.erb deleted file mode 100644 index 6c9a10ff598b736478c2963eee42186f3c0a2194..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/partners/_show.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<div class="<%= 'row' unless @preview %>"> - <% @block.template.partners.each do |partner| %> - <div class="<%= 'col-md-2' unless @preview %>"> - <article class="card"> - <%= kamifusen_tag partner.blob, - width: 300, - class: 'img-fluid mb-2' unless partner.blob.nil? %> - <div class="card-body"> - <h3 class="card-title h5"><%= partner.name %></h3> - <p class="mb-0"><%= partner.url %></p> - </div> - </article> - </div> - <% end %> -</div> 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 a85581f9f7979ee75b50cc3938fd51f8ffd19feb..fc343bc2c34e1cadd52935c0af4062365ee271d2 100644 --- a/app/views/admin/communication/blocks/templates/posts/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/posts/_edit.html.erb @@ -24,8 +24,8 @@ </label> </div> </div> - - <div v-if="data.kind === 'category'" class="mb-2"> + + <div v-if="data.kind === 'category'" class="mb-3"> <label class="form-label" for="category_id">Sélectionnez une catégorie</label> <select id="category_id" @@ -49,7 +49,7 @@ </div> </div> <div v-if="data.kind === 'selection'"> - <a class="<%= button_classes('mb-2') %>" + <a class="<%= button_classes('mb-3') %>" v-on:click="data.elements.push({id: ''})"> <%= t '.add_post' %> </a> @@ -57,7 +57,7 @@ <div v-for="(post, index) in data.elements" class="col-xxl-3 col-lg-4"> <div class="card"> <div class="card-body"> - <div class="mb-2"> + <div class="mb-3"> <a class="btn btn-sm btn-danger float-end" v-on:click="data.elements.splice(data.elements.indexOf(post), 1)" title="Delete"> diff --git a/app/views/admin/communication/blocks/templates/posts/_preview.html.erb b/app/views/admin/communication/blocks/templates/posts/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..1f264f7d24473f489902919f986275c803850c9b --- /dev/null +++ b/app/views/admin/communication/blocks/templates/posts/_preview.html.erb @@ -0,0 +1,15 @@ +<% if @block.data %> + <% if @block.template.category %> + <h2 class="mb-4"><%= @block.template.category %></h2> + <% end %> + <% @block.template.selected_posts.each do |post| %> + <div class="card"> + <div class="card-header"> + <h3 class="card-title h5"><%= post %></h3> + </div> + <div class="card-body"> + <%= post.description_short %> + </div> + </div> + <% end %> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/posts/_show.html.erb b/app/views/admin/communication/blocks/templates/posts/_show.html.erb deleted file mode 100644 index 7f6d68cf166042ca1dddb307bacb87b7910d598e..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/posts/_show.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<% if @block.data %> - <% if @block.template.category %> - <h2 class="mb-4"><%= @block.template.category %></h2> - <% end %> - <% if @block.template.selected_posts.any? %> - <div class="<%= 'row' unless @preview %>"> - <% @block.template.selected_posts.each do |post| %> - <div class="<%= 'col-md-4' unless @preview %>"> - <div class="card"> - <div class="card-header"> - <h3 class="card-title h5"><%= post %></h3> - </div> - <div class="card-body"> - <%= post.description_short %> - </div> - </div> - </div> - <% end %> - </div> - <% end %> -<% end %> 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 7cebbc2d6ba4038d7a9997403d9b2bc2c5d528af..7a5666854d549272d51eda15bcd6a1436f650231 100644 --- a/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb @@ -16,7 +16,7 @@ <div class="col-lg-4"> <label class="form-label" :for="'testimonial-' + index + '-text'"><%= t '.text_label' %></label> - <textarea class="form-control mb-2" + <textarea class="form-control mb-3" rows="3" v-model="testimonial.text" placeholder="<%= t '.text_placeholder' %>" @@ -27,7 +27,7 @@ :for="'testimonial-' + index + '-author'"> <%= t '.author_label' %> </label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="text" v-model="testimonial.author" placeholder="<%= t '.author_placeholder' %>" @@ -36,7 +36,7 @@ :for="'testimonial-' + index + '-job'"> <%= t '.job_label' %> </label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="text" v-model="testimonial.job" placeholder="<%= t '.job_placeholder' %>" @@ -49,7 +49,7 @@ :for="'testimonial-' + index + '-photo'"> <%= t '.photo_label' %> </label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="file" accept="image/*" @change="onFileImageChange( $event, testimonial, 'photo' )" diff --git a/app/views/admin/communication/blocks/templates/testimonials/_preview.html.erb b/app/views/admin/communication/blocks/templates/testimonials/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e12a4fc2630069d82954b3322538a01cd43c40e8 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/testimonials/_preview.html.erb @@ -0,0 +1,22 @@ +<% @block.template.testimonials.each do |testimonial| %> + <article class="card"> + <div class="card-body"> + <p class="lead"> + <%= testimonial.text %> + </p> + <div class="d-flex align-items-center"> + <% if testimonial.blob %> + <div style="max-width: 80px;" class="me-3"> + <%= kamifusen_tag testimonial.blob, + width: 80, + class: 'img-fluid rounded-circle img-circle' %> + </div> + <% end %> + <p class="flex-fill mb-0"> + <b><%= testimonial.author %></b><br> + <%= testimonial.job %> + </p> + </div> + </div> + </article> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/testimonials/_show.html.erb b/app/views/admin/communication/blocks/templates/testimonials/_show.html.erb deleted file mode 100644 index 1237e4918d078c790a58ec14957646e7a873242d..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/testimonials/_show.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -<div class="<%= 'row' unless @preview %>"> - <% @block.template.testimonials.each do |testimonial| %> - <div class="<%= 'col-xxl-4 col-xl-6' unless @preview %>"> - <article class="card"> - <div class="card-body"> - <p class="lead"> - <%= testimonial.text %> - </p> - <div class="d-flex align-items-center"> - <% if testimonial.blob %> - <div style="max-width: 80px;" class="me-3"> - <%= kamifusen_tag testimonial.blob, - width: 80, - class: 'img-fluid rounded-circle img-circle' %> - </div> - <% end %> - <p class="flex-fill mb-0"> - <b><%= testimonial.author %></b><br> - <%= testimonial.job %> - </p> - </div> - </div> - </article> - </div> - <% end %> -</div> 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 a646b4816c4b05cc79ca75aa64a352d0c8cb928a..924cd55f7d073f6fead00a8c79c10b7963b38f2b 100644 --- a/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb @@ -16,7 +16,7 @@ <div class="flex-fill"> <label class="form-label" :for="'event-' + index + '-title'"><%= t '.title_label' %></label> - <input class="form-control mb-2" + <input class="form-control mb-3" v-model="event.title" placeholder="<%= t '.title_placeholder' %>" type="text" @@ -24,7 +24,7 @@ <label class="form-label" :for="'event-' + index + '-text'"><%= t '.text_label' %></label> - <textarea class="form-control mb-2" + <textarea class="form-control mb-3" rows="3" v-model="event.text" placeholder="<%= t '.text_placeholder' %>" diff --git a/app/views/admin/communication/blocks/templates/timeline/_preview.html.erb b/app/views/admin/communication/blocks/templates/timeline/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..aa27fd7a3c72f1b18bb83a59655494ad72fe80cf --- /dev/null +++ b/app/views/admin/communication/blocks/templates/timeline/_preview.html.erb @@ -0,0 +1,8 @@ +<% @block.template.events.each do |event| %> + <article class="card"> + <div class="card-body"> + <p class="lead"><%= event.title %></p> + <p><%= event.text %></p> + </div> + </article> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/timeline/_show.html.erb b/app/views/admin/communication/blocks/templates/timeline/_show.html.erb deleted file mode 100644 index 1094e2dde371fdd4e51950abb9fcf90e0e2bd04f..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/timeline/_show.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<div class="<%= 'row' unless @preview %>"> - <% @block.template.events.each do |event| %> - <div class="<%= 'col-xxl-4 col-xl-6' unless @preview %>"> - <article class="card"> - <div class="card-body"> - <p class="lead"><%= event.title %></p> - <p><%= event.text %></p> - </div> - </article> - </div> - <% end %> -</div> diff --git a/app/views/admin/communication/blocks/templates/video/_show.html.erb b/app/views/admin/communication/blocks/templates/video/_preview.html.erb similarity index 100% rename from app/views/admin/communication/blocks/templates/video/_show.html.erb rename to app/views/admin/communication/blocks/templates/video/_preview.html.erb diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 37761ef54ec8adf7d4b009e17d4ff1a32b0d0e23..0688acbd300637e192e058af64b9e9628d9426fd 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -185,7 +185,7 @@ en: partner_name_placeholder: Enter partner's name partner_url_label: Website partner_url_placeholder: https:// - partner_image_label: Logo + partner_logo_label: Logo remove_logo: Remove logo remove_partner: Remove partner testimonials: diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index d669262f3c565dbb782de846b4d0ed0512d5b247..23401dacf9eb02d2b938f11554eba288c8f214b1 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -155,7 +155,7 @@ fr: partner_name_placeholder: Entrer le nom du partenaire partner_url_label: Site Web partner_url_placeholder: https:// - partner_image_label: Logo + partner_logo_label: Logo remove_logo: Enlever le logo remove_partner: Enlever le partenaire testimonials: diff --git a/config/routes/admin/communication.rb b/config/routes/admin/communication.rb index c6716a4fe9cfc57e0a62e2d51c3fe126525317af..58edbf606457c88bb651032e53c430ce5529a107 100644 --- a/config/routes/admin/communication.rb +++ b/config/routes/admin/communication.rb @@ -52,7 +52,7 @@ namespace :communication do patch 'structure' => 'website/structure#update' end - resources :blocks, controller: 'blocks', except: :index do + resources :blocks, controller: 'blocks', except: [:index, :show] do collection do post :reorder end