From aff7ac4dd36a9a6f9b1c5bc5bb21daadd782b625 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Tue, 26 Jul 2022 21:46:02 +0200 Subject: [PATCH] improvement --- .../block/component/time_slot.rb | 4 ++-- .../components/add_element/_edit.html.erb | 2 +- .../components/time_slot/_edit.html.erb | 6 +++-- .../components/time_slot/_preview.html.erb | 4 +--- .../components/time_slot/_static.html.erb | 4 ++-- .../blocks/templates/contact/_edit.html.erb | 24 ++++++++++++------- config/locales/communication/en.yml | 2 +- config/locales/communication/fr.yml | 2 +- 8 files changed, 27 insertions(+), 21 deletions(-) diff --git a/app/models/communication/block/component/time_slot.rb b/app/models/communication/block/component/time_slot.rb index 168dba1ed..77d176c7c 100644 --- a/app/models/communication/block/component/time_slot.rb +++ b/app/models/communication/block/component/time_slot.rb @@ -18,8 +18,8 @@ class Communication::Block::Component::TimeSlot < Communication::Block::Componen def default_data { - 'from' => '0', - 'to' => '0' + 'from' => '', + 'to' => '' } end 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 index 4f2a0da8a..108e3e124 100644 --- a/app/views/admin/communication/blocks/components/add_element/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/add_element/_edit.html.erb @@ -1,4 +1,4 @@ <a class="<%= button_classes('mb-4') %>" - v-on:click="data.elements.push(Object.assign({}, defaultElement))"> + v-on:click="data.elements.push(JSON.parse(JSON.stringify(defaultElement)))"> <%= label %> </a> diff --git a/app/views/admin/communication/blocks/components/time_slot/_edit.html.erb b/app/views/admin/communication/blocks/components/time_slot/_edit.html.erb index 3b069d144..087cb556b 100644 --- a/app/views/admin/communication/blocks/components/time_slot/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/time_slot/_edit.html.erb @@ -13,7 +13,8 @@ to = t 'admin.communication.blocks.components.time_slot.to' <span class="me-2 pt-1"> <%= from %> </span> - <input class="form-control me-1" + <input :id="'element-' + index + '-<%= property %>%-from'" + class="form-control me-1" v-model="<%= model %>.<%= property %>.from" type="time" /> </label> @@ -21,7 +22,8 @@ to = t 'admin.communication.blocks.components.time_slot.to' <span class="me-2 pt-1"> <%= to %> </span> - <input class="form-control" + <input :id="'element-' + index + '-<%= property %>%-to'" + class="form-control" v-model="<%= model %>.<%= property %>.to" type="time" /> </label> diff --git a/app/views/admin/communication/blocks/components/time_slot/_preview.html.erb b/app/views/admin/communication/blocks/components/time_slot/_preview.html.erb index 3377599ea..e2e6fce5a 100644 --- a/app/views/admin/communication/blocks/components/time_slot/_preview.html.erb +++ b/app/views/admin/communication/blocks/components/time_slot/_preview.html.erb @@ -1,3 +1 @@ -<% if component.present? %> - <%= component.from %> → <%= component.to %> -<% end %> +<%= component.from %> → <%= component.to %> diff --git a/app/views/admin/communication/blocks/components/time_slot/_static.html.erb b/app/views/admin/communication/blocks/components/time_slot/_static.html.erb index d419d8dae..25464183d 100644 --- a/app/views/admin/communication/blocks/components/time_slot/_static.html.erb +++ b/app/views/admin/communication/blocks/components/time_slot/_static.html.erb @@ -1,3 +1,3 @@ <%= indentation %><%= property %>: -<%= indentation %> from: "<%= value['from'] %>" -<%= indentation %> to: "<%= value['to'] %>" +<%= indentation %> from: "<%= component.from %>" +<%= indentation %> to: "<%= component.to %>" 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 7ae6dd83c..e9a904fa5 100644 --- a/app/views/admin/communication/blocks/templates/contact/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/contact/_edit.html.erb @@ -1,17 +1,23 @@ <div class="row mb-4"> <div class="col-md-6 col-xl-4"> - <h3 class="h4"><%= t '.contacts' %></h3> - <%= block_component_edit :name %> - <%= block_component_edit :address, rows: 1 %> - <div class="row"> - <div class="col-md-4"> - <%= block_component_edit :zipcode %> + <div class="card"> + <div class="card-header d-flex"> + <h3 class="h4"><%= t '.contacts' %></h3> </div> - <div class="col-md-8"> - <%= block_component_edit :city %> + <div class="card-body"> + <%= block_component_edit :name %> + <%= block_component_edit :address, rows: 1 %> + <div class="row"> + <div class="col-md-4"> + <%= block_component_edit :zipcode %> + </div> + <div class="col-md-8"> + <%= block_component_edit :city %> + </div> + </div> + <%= block_component_edit :country %> </div> </div> - <%= block_component_edit :country %> </div> <div class="col-md-6 col-xl-8"> <div class="row"> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index c6f5c61ac..bcf630102 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -205,7 +205,7 @@ en: city: label: City placeholder: Enter the city - contacts: Contacts + contacts: Mailing address country: label: Country placeholder: Enter the country diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index bcce9123c..292af67bf 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -205,7 +205,7 @@ fr: city: label: Ville placeholder: Entrer le nom de la ville - contacts: Contacts + contacts: Adresse postale country: label: Pays placeholder: Entrer le nom du pays -- GitLab