Skip to content
Snippets Groups Projects
Commit 58537a32 authored by alexisben's avatar alexisben
Browse files

Block contact WIP

parent e4dded88
No related branches found
No related tags found
No related merge requests found
Showing
with 128 additions and 2 deletions
app/assets/images/communication/blocks/templates/contact.jpg

94.9 KiB

......@@ -51,13 +51,14 @@ class Communication::Block < ApplicationRecord
partners: 200,
posts: 500,
pages: 600,
contact: 601,
}
CATEGORIES = {
basic: [:chapter, :image, :video, :datatable],
storytelling: [:key_figures, :gallery, :call_to_action, :testimonials, :timeline],
references: [:pages, :posts, :organization_chart, :partners],
utilities: [:files, :definitions, :embed]
utilities: [:files, :definitions, :embed, :contact]
}
scope :published, -> { where(published: true) }
......
class Communication::Block::Component::TimeSlot < Communication::Block::Component::Base
def default_data
{
'from' => '0',
'to' => '0'
}
end
end
class Communication::Block::Template::Contact < Communication::Block::Template::Base
has_component :name, :string
has_component :phone_numbers, :array
has_component :emails, :array
has_component :address, :text
has_elements
end
class Communication::Block::Template::Contact::Element < Communication::Block::Template::Base
has_component :title, :string
has_component :time_slot_morning, :time_slot
has_component :time_slot_afternoon, :time_slot
end
<% rows ||= 3 %>
<div class="d-flex align-items-center mb-2">
<label class="form-label me-1 mb-0"
aria-label="<%= label %>">
<%= label %> De
</label>
<input class="form-control me-1"
v-model="<%= model %>.<%= property %>.from"
placeholder="<%= placeholder %> from"
type="time" />
<label class="form-label me-1 mb-0"
aria-label="<%= label %>">
<%= label %> à
</label>
<input class="form-control"
v-model="<%= model %>.<%= property %>.to"
placeholder="<%= placeholder %> to"
type="time" />
</div>
\ No newline at end of file
<%= simple_format value %>
......@@ -24,7 +24,7 @@
<%= render 'admin/application/a11y/widget', about: @block %>
</div>
</div>
<textarea name="communication_block[data]" rows="20" cols="200" class="d-none">
<textarea name="communication_block[data]" rows="20" cols="200" class="d-non">
{{ JSON.stringify(data) }}
</textarea>
<% content_for :action_bar_left do %>
......
<%# TODO: traduction %>
<h3 class="h4">Contact</h3>
<div class="row">
<div class="col-md-4">
<%= block_component_edit :name,
label: "Nom (personne, établissement...)",
placeholder: t('admin.communication.blocks.components.text.placeholder') %>
<%= block_component_edit :address,
label: "Adresse",
placeholder: t('admin.communication.blocks.components.text.placeholder') %>
</div>
<div class="col-md-4">
<h3 class="h4">Téléphones</h3>
<div v-for="(element, index) in data.phone_numbers" class="list-group-item">
<div class="d-flex">
<input type="tel"
class="form-control"
maxlength="12"
v-model="data.phone_numbers[index]">
<a class="btn btn-danger ms-2"
v-on:click="data.phone_numbers.splice(index, 1)">
<i class="fas fa-times"></i>
</a>
</div>
</div>
<a class="btn btn-primary mt-1"
v-on:click="data.phone_numbers.push('')">
<i class="fas fa-plus"></i> ajouter une numéro de téléphone
</a>
</div>
<div class="col-md-4">
<h3 class="h4">Emails</h3>
<div v-for="(element, index) in data.emails" class="list-group-item">
<div class="d-flex">
<input type="email"
class="form-control"
v-model="data.emails[index]">
<a class="btn btn-danger ms-2"
v-on:click="data.emails.splice(index, 1)">
<i class="fas fa-times"></i>
</a>
</div>
</div>
<a class="btn btn-primary mt-1"
v-on:click="data.emails.push('')">
<i class="fas fa-plus"></i> ajouter un email
</a>
</div>
</div>
<h3 class="h4 mt-5">Horaires</h3>
<div class="row">
<div v-for="(element, index) in data.elements" class="col-md-4">
<div class="card">
<a class="btn btn-sm btn-danger position-absolute top-0 end-0"
v-on:click="data.elements.splice(index, 1)">
<i class="fas fa-times"></i>
</a>
<div class="card-body">
<%= block_component_edit :title, template: @element, label: 'Jour' %>
<%# TODO: Refactor des créneaux horaires %>
<%= block_component_edit :time_slot_morning, template: @element %>
<%= block_component_edit :time_slot_afternoon, template: @element %>
</div>
</div>
</div>
</div>
<%= block_component_add_element 'Ajouter un créneau horaire' %>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment