From 72bc1068a212e3eb1a25952eaa0f8e8332b9f138 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Wed, 7 Sep 2022 15:48:46 +0200
Subject: [PATCH] description for contact block

---
 app/models/communication/block/template/contact.rb           | 1 +
 .../communication/blocks/templates/contact/_edit.html.erb    | 5 +++++
 .../communication/blocks/templates/contact/_preview.html.erb | 1 +
 .../communication/blocks/templates/contact/_static.html.erb  | 1 +
 config/locales/communication/en.yml                          | 3 +++
 config/locales/communication/fr.yml                          | 3 +++
 6 files changed, 14 insertions(+)

diff --git a/app/models/communication/block/template/contact.rb b/app/models/communication/block/template/contact.rb
index b298da6c9..4ddd562dd 100644
--- a/app/models/communication/block/template/contact.rb
+++ b/app/models/communication/block/template/contact.rb
@@ -1,5 +1,6 @@
 class Communication::Block::Template::Contact < Communication::Block::Template::Base
 
+  has_component :description, :rich_text
   has_component :name, :string
   has_component :address, :text
   has_component :zipcode, :string
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 f9ae11e84..0da97e404 100644
--- a/app/views/admin/communication/blocks/templates/contact/_edit.html.erb
+++ b/app/views/admin/communication/blocks/templates/contact/_edit.html.erb
@@ -1,3 +1,8 @@
+<div class="row">
+  <div class="col-xl-6">
+    <%= block_component_edit :description %>
+  </div>
+</div>
 <div class="row mb-4">
   <div class="col-md-6 col-xl-4">
     <div class="card">
diff --git a/app/views/admin/communication/blocks/templates/contact/_preview.html.erb b/app/views/admin/communication/blocks/templates/contact/_preview.html.erb
index 5bb7098c4..579b9f6d2 100644
--- a/app/views/admin/communication/blocks/templates/contact/_preview.html.erb
+++ b/app/views/admin/communication/blocks/templates/contact/_preview.html.erb
@@ -1,3 +1,4 @@
+<%= block_component_preview :description %>
 <p>
   <%= block_component_preview :name %><br>
   <% if @block.template.address.present? %>
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 3e9f43997..16c95afe1 100644
--- a/app/views/admin/communication/blocks/templates/contact/_static.html.erb
+++ b/app/views/admin/communication/blocks/templates/contact/_static.html.erb
@@ -1,3 +1,4 @@
+<%= block_component_static :description %>
 <%= block_component_static :name %>
       address:
 <%= block_component_static :address, depth: 4 %>
diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml
index 43f86bae1..b4f034222 100644
--- a/config/locales/communication/en.yml
+++ b/config/locales/communication/en.yml
@@ -210,6 +210,9 @@ en:
               country:
                 label: Country
                 placeholder: Enter the country
+              description:
+                label: Description
+                placeholder: Enter description here
               element:
                 title: 
                   label: Day
diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml
index 29a758f33..171268b06 100644
--- a/config/locales/communication/fr.yml
+++ b/config/locales/communication/fr.yml
@@ -210,6 +210,9 @@ fr:
               country:
                 label: Pays
                 placeholder: Entrer le nom du pays
+              description:
+                label: Description
+                placeholder: Entrer la description
               element:
                 title: 
                   label: Jour
-- 
GitLab