From 551244f0d156c1677bd90a7611fbad6164212705 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Fri, 3 Jun 2022 18:07:53 +0200
Subject: [PATCH] add element

---
 .../blocks/components/add_element/_edit.html.erb           | 4 ++++
 .../communication/blocks/templates/gallery/_edit.html.erb  | 7 ++-----
 2 files changed, 6 insertions(+), 5 deletions(-)
 create mode 100644 app/views/admin/communication/blocks/components/add_element/_edit.html.erb

diff --git a/app/views/admin/communication/blocks/components/add_element/_edit.html.erb b/app/views/admin/communication/blocks/components/add_element/_edit.html.erb
new file mode 100644
index 000000000..a3c609545
--- /dev/null
+++ b/app/views/admin/communication/blocks/components/add_element/_edit.html.erb
@@ -0,0 +1,4 @@
+<a  class="<%= button_classes('mb-4') %>"
+    v-on:click="data.elements.push(defaultElement)">
+    <%= label %>
+</a>
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 91becaa50..49e7b69f6 100644
--- a/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb
+++ b/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb
@@ -2,10 +2,8 @@
             layouts: Communication::Block::Template::Gallery::LAYOUTS,
             horizontal: true %>
 
-<a  class="<%= button_classes('mb-4') %>"
-    v-on:click="data.elements.push(defaultElement)">
-    <%= t '.add_image' %>
-</a>
+<%= render  'admin/communication/blocks/components/add_element/edit',
+            label: t('.add_image') %>
 
 <draggable :list="data.elements" handle=".imageHandle" class="row">
   <div v-for="(image, imageIndex) in data.elements" class="col-xxl-2 col-xl-3 col-md-4 col-6">
@@ -24,7 +22,6 @@
       </div>
       <img :src="getImageUrl(image.file)" class="img-fluid d-block" v-if="image.file.id" />
       <div class="card-body">
-
         <label  class="form-label"
                 :for="'image-file-' + imageIndex">
           <%= t '.image_label' %>
-- 
GitLab