From a310da5a1421f77150f055e888fee3d35b157e0d Mon Sep 17 00:00:00 2001 From: alexisben <alexiben7@gmail.com> Date: Wed, 20 Apr 2022 14:56:00 +0200 Subject: [PATCH] Block CTA : Add second button --- .../blocks/templates/pages/_edit.html.erb | 16 ++-- .../blocks/templates/posts/_edit.html.erb | 7 +- .../blocks/templates/push/_edit.html.erb | 78 +++++++++++-------- 3 files changed, 60 insertions(+), 41 deletions(-) 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 7f9911666..0aad5c53f 100644 --- a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb @@ -1,3 +1,4 @@ +<h2 class="mt-5">Page principale</h2> <div class="row mb-1"> <div class="col-md-6"> <label class="form-label" @@ -5,7 +6,7 @@ <select id="page_id" class="form-select select" v-model="data.page_id"> - <option value="" disabled>Aucune page sélectionnée</option> + <option value="">Aucune page sélectionnée</option> <% @block.about&.website.pages.ordered.each_with_index do |page, index| %> <option value="<%= page.id %>"><%= page %></option> <% end %> @@ -18,10 +19,15 @@ <label class="form-check-label boolean optional" for="show_description">Afficher la description courte</label> </div> + <div class="form-check"> + <input v-model="data.show_image" class="form-check-input boolean optional" :id="'show_image'" type="checkbox"> + <label class="form-check-label boolean optional" + :for="'show_image'">Afficher l'image</label> + </div> </div> <div v-if="!data.category_id" class="col-md-12 mt-5"> <h2>Ajouter des pages</h2> - <a class="<%= button_classes('my-4') %>" + <a class="<%= button_classes('mb-4') %>" v-on:click="data.elements.push({id: ''})"> <%= t '.add_page' %> </a> @@ -41,12 +47,12 @@ </a> </div> <div class="col-6"> - <label class="form-label visually-hidden" - :for="'page-' + index + '-name'"><%= t '.page_label' %></label> + <label class="form-label" + :for="'page-' + index + '-name'">Page secondaire</label> <select :id="'page-' + index + '-name'" class="form-select select" v-model="page.id"> - <option value="" disabled>Page</option> + <option value="" disabled>Aucune page</option> <% @block.about&.website.pages.ordered.each_with_index do |page, index| %> <option value="<%= page.id %>"><%= page.title %></option> <% 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 18ece6de1..d4525ea39 100644 --- a/app/views/admin/communication/blocks/templates/posts/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/posts/_edit.html.erb @@ -6,14 +6,15 @@ class="form-select select" v-model="data.category_id" v-on:change="data.posts_quantity = data.posts_quantity ? data.posts_quantity : 3"> - <option value="" selected>Sélection spécifique</option> + <option value="all" selected>Toutes les actualités</option> + <option value="selection">Sélection spécifique</option> <% @block.about&.website.categories.ordered.each_with_index do |category, index| %> <option value="<%= category.id %>"><%= category %></option> <% end %> </select> </div> <div class="col-md-6"> - <div v-if="data.category_id"> + <div v-if="data.category_id !== 'selection'"> <label class="form-label" for="posts_quantity">Choisissez la quantité d'articles à afficher</label> <input type="number" @@ -26,7 +27,7 @@ </div> </div> </div> -<div v-if="!data.category_id"> +<div v-if="data.category_id === 'selection'"> <a class="<%= button_classes('my-4') %>" v-on:click="data.elements.push({id: ''})"> <%= t '.add_post' %> diff --git a/app/views/admin/communication/blocks/templates/push/_edit.html.erb b/app/views/admin/communication/blocks/templates/push/_edit.html.erb index 3e7b44d7a..cc315a804 100644 --- a/app/views/admin/communication/blocks/templates/push/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/push/_edit.html.erb @@ -1,5 +1,6 @@ <div class="row"> <div class="col-xxl-4 col-md-6"> + <h3>Contenu</h3> <label class="form-label" for="text"> <%= t '.text_label' %> @@ -11,39 +12,7 @@ data-summernote-config="mini" placeholder="<%= t '.text_placeholder' %>"></textarea> </div> - <label class="form-label mt-3" - for="url"> - <%= t '.url_label' %> - </label> - <input id="url" - type="url" - class="form-control" - v-model="data.url" - placeholder="<%= t '.url_placeholder' %>" /> - - <label class="form-label mt-3" - for="button"> - <%= t '.button_label' %> - </label> - <input id="button" - type="text" - class="form-control" - v-model="data.button" - placeholder="<%= t '.button_placeholder' %>" /> - - <label class="form-label mt-3" - for="button"> - <%= t '.button_label' %> - </label> - <input id="button" - type="text" - class="form-control" - v-model="data.button" - placeholder="<%= t '.button_placeholder' %>" /> - - <hr> - - <h3><%= t '.image_title' %></h3> + <h3 class="mt-4"><%= t '.image_title' %></h3> <div class="row"> <div class="col-md-6"> <div v-if="!data.image"> @@ -84,4 +53,47 @@ </div> </div> </div> + <div class="col-xxl-4 col-md-6"> + <h3>Bouton principal</h3> + <label class="form-label" + for="url"> + <%= t '.url_label' %> + </label> + <input id="url" + type="url" + class="form-control" + v-model="data.url" + placeholder="<%= t '.url_placeholder' %>" /> + + <label class="form-label mt-3" + for="button"> + <%= t '.button_label' %> + </label> + <input id="button" + type="text" + class="form-control" + v-model="data.button" + placeholder="<%= t '.button_placeholder' %>" /> + + <h3 class="mt-4">Bouton secondaire</h3> + <label class="form-label" + for="url_2"> + <%= t '.url_label' %> + </label> + <input id="url_2" + type="url" + class="form-control" + v-model="data.url_2" + placeholder="<%= t '.url_placeholder' %>" /> + <label class="form-label mt-3" + for="button"> + <%= t '.button_label' %> + </label> + <input id="button_2" + type="text" + class="form-control" + v-model="data.button_2" + placeholder="<%= t '.button_placeholder' %>" /> + + </div> </div> \ No newline at end of file -- GitLab