Skip to content
Snippets Groups Projects
Unverified Commit dabbc124 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

Description + Alphabetical order in datatable elements

parent 51f5ce90
No related branches found
No related tags found
No related merge requests found
......@@ -3,5 +3,15 @@ class Communication::Block::Template::Datatable < Communication::Block::Template
has_elements
has_component :columns, :array
has_component :caption, :text
has_component :description, :rich_text
has_component :alphabetical, :boolean
def elements
if alphabetical
@elements.sort_by! do |element|
"#{element.cells&.first&.to_s&.parameterize&.downcase}"
end
end
@elements
end
end
<div class="row">
<div class="col-xl-6">
<%= block_component_edit :description %>
</div>
<div class="col-xl-6">
<label class="form-label">&nbsp;</label>
<%= block_component_edit :alphabetical %>
</div>
</div>
<div class="table-responsive mb-5">
<div class="fake-table table">
<div class="thead">
......
<div class="description">
<%= block_component_preview :description %>
</div>
<div class="table-responsive">
<caption><%= block_component_preview :caption %></caption>
<table class="<%= table_classes %>">
......
<%= block_component_static :description %>
<%= block_component_static :columns %>
rows:
<% block.template.elements.each do |element| %>
......
......@@ -277,9 +277,13 @@ fr:
datatable:
description: Un tableau de données, aussi responsive et accessible que possible.
edit:
alphabetical:
label: Ordre alphabétique
caption:
label: Transcription textuelle
placeholder: Entrer ici la transcription textuelle du tableau
description:
label: Description
definitions:
description: Une liste de termes et leur définition. Un genre de dictionnaire, finalement.
edit:
......
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