diff --git a/app/models/communication/block.rb b/app/models/communication/block.rb index f180bd78ccea3767c8e81a7b21214ac05710d9a7..e3484e18e1130fca39b69316050a564528933214 100644 --- a/app/models/communication/block.rb +++ b/app/models/communication/block.rb @@ -87,7 +87,7 @@ class Communication::Block < ApplicationRecord basic: [:chapter, :image, :video, :sound, :datatable], storytelling: [:key_figures, :features, :gallery, :call_to_action, :testimonials, :timeline], references: [:pages, :posts, :organization_chart, :partners, :programs], - utilities: [:files, :definitions, :embed, :contact] + utilities: [:files, :definitions, :contact, :embed] } scope :published, -> { where(published: true) } diff --git a/app/models/communication/block/template/contact.rb b/app/models/communication/block/template/contact.rb index 4ddd562dd364aa1bf7c343c2058d87d427b20253..b180c8a543a4491ec294645c77d45bde331e39ae 100644 --- a/app/models/communication/block/template/contact.rb +++ b/app/models/communication/block/template/contact.rb @@ -3,9 +3,11 @@ class Communication::Block::Template::Contact < Communication::Block::Template:: has_component :description, :rich_text has_component :name, :string has_component :address, :text + has_component :information, :rich_text has_component :zipcode, :string has_component :city, :string has_component :country, :string + has_component :url, :string has_component :phone_numbers, :array has_component :emails, :array 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 39326a4d56b0cb21c82151bdd9d0b3378d0f3ed6..1e1cf40d5ce9fc70ea2fafa00295bd98230559e5 100644 --- a/app/views/admin/communication/blocks/templates/contact/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/contact/_edit.html.erb @@ -1,12 +1,13 @@ <div class="row pure__row--small"> - <div class="col-xl-6"> + <div class="col-xxl-6"> <%= block_component_edit block, :description %> </div> </div> <div class="row pure__row--small mb-4"> - <div class="col-xl-6"> + <div class="col-xxl-6"> <%= osuny_panel t('.contacts') do %> <%= block_component_edit block, :name %> + <%= block_component_edit block, :information %> <%= block_component_edit block, :address %> <div class="row pure__row--small"> <div class="col-md-4"> @@ -19,7 +20,10 @@ <%= block_component_edit block, :country %> <% end %> </div> - <div class="col-xl-6"> + <div class="col-xxl-6"> + <%= osuny_panel t('.website') do %> + <%= block_component_edit block, :url %> + <% end %> <% action = "<a class=\"#{ button_classes }\" v-on:click=\"data.phone_numbers.push('')\">#{ t('.add') }</a>" placeholder = t '.phones.placeholder' @@ -68,13 +72,13 @@ </div> <div class="flex-fill"> <div class="row pure__row--small mb-n3"> - <div class="col-xl-4"> + <div class="col-xxl-4"> <%= block_component_edit block, :title, template: @element %> </div> - <div class="col-xl-4 col-md-6"> + <div class="col-xxl-4 col-md-6"> <%= block_component_edit block, :time_slot_morning, template: @element %> </div> - <div class="col-xl-4 col-md-6"> + <div class="col-xxl-4 col-md-6"> <%= block_component_edit block, :time_slot_afternoon, template: @element %> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/contact/_show.html.erb b/app/views/admin/communication/blocks/templates/contact/_show.html.erb index ff0377df38021dbfedbffdc3f04a9d81f2d1c7f4..071cc99c0a1a32596dca4bd14a8242b5261b9163 100644 --- a/app/views/admin/communication/blocks/templates/contact/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/contact/_show.html.erb @@ -26,6 +26,9 @@ end <% unless block.template.name.blank? %> <p><%= block_component_show block, :name %></p> <% end %> + <% if block.template.information.present? %> + <%= block_component_show block, :information %> + <% end %> <div itemprop="address" itemscope itemtype="https://schema.org/PostalAddress"> <span itemprop="streetAddress"> <%= block_component_show block, :address %> @@ -41,6 +44,13 @@ end </span> </div> + <% if block.template.url.present? %> + <% url = block.template.url %> + <a href="<%= social_website_to_url url %>" target="_blank" rel="noreferrer"> + <%= social_website_to_s url %> + </a> + <% end %> + <p> <% block.template.phone_numbers.each do |phone_number| %> <a itemprop="telephone" href="tel:<%= phone_number %>%>"><%= phone_number %></a><br> @@ -54,7 +64,9 @@ end <% block.template.elements.each do |element| %> <li> <span><%= block_component_show block, :title, template: element %></span> - <span><time datetime="<%= block_component_show block, :time_slot_morning, template: element %>"><%= block_component_show block, :time_slot_morning, template: element %></time></span> + <% if element.time_slot_morning['to'].present? %> + <span><time datetime="<%= block_component_show block, :time_slot_morning, template: element %>"><%= block_component_show block, :time_slot_morning, template: element %></time></span> + <% end %> <span><time datetime="<%= block_component_show block, :time_slot_afternoon, template: element %>"><%= block_component_show block, :time_slot_afternoon, template: element %></time></span> </li> <% end %> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 144a82fb5bd28c492f63617dc6d48ec78f83c841..ac788040f39a6f32fc96ca6894924f171cf870ec 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -332,12 +332,14 @@ en: label: Morning (if necessary) time_slot_afternoon: label: Afternoon (or full day) + information: + label: Additional data + mails: + label: Mails + placeholder: Enter the mail name: label: Name (person, organization...) placeholder: Enter the text - zipcode: - label: Zipcode - placeholder: Enter the zipcode mails: label: Mails placeholder: Enter the mail @@ -345,6 +347,13 @@ en: label: Telephone numbers placeholder: Enter the number slots: Opening times + url: + label: URL + placeholder: https://... + website: Website + zipcode: + label: Zipcode + placeholder: Enter the zipcode datatable: description: A table of data, as responsive and accessible as possible. edit: diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 63f58839bb6391d029dace6e71fad47b410f8de2..9f52cbd6066f6e617aa1a534727d06d82667ea32 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -332,19 +332,25 @@ fr: label: Matin (si nécessaire) time_slot_afternoon: label: Après-midi (ou jour complet) - name: - label: Nom (personne, établissement...) - placeholder: Entrer le texte - zipcode: - label: Code postal - placeholder: Entrer le code postal + information: + label: Informations complémentaires mails: label: Mails placeholder: Entrer le mail + name: + label: Nom (personne, établissement...) + placeholder: Entrer le texte phones: label: Téléphones placeholder: Entrer le numéro slots: Horaires + url: + label: URL + placeholder: https://... + website: Site Web + zipcode: + label: Code postal + placeholder: Entrer le code postal datatable: description: Un tableau de données, aussi responsive et accessible que possible. edit: