Skip to content
Snippets Groups Projects
Commit a9a4b2a4 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

style

parent 455773f8
No related branches found
No related tags found
No related merge requests found
class Communication::Block::Template::Datatable < Communication::Block::Template::Base class Communication::Block::Template::Datatable < Communication::Block::Template::Base
has_array :columns
has_elements Communication::Block::Template::Datatable::Row has_elements Communication::Block::Template::Datatable::Row
has_array :columns
has_text :caption has_text :caption
end end
class Communication::Block::Template::Datatable::Row < Communication::Block::Template::Base class Communication::Block::Template::Datatable::Row < Communication::Block::Template::Base
has_array :cells has_array :cells
end end
<a class="<%= button_classes('mb-4 me-2') %>"
v-on:click="data.columns.pop(); data.elements.forEach(row => row.cells.pop());">
Supprimer la dernière colonne
</a>
<div class="table-responsive mb-5"> <div class="table-responsive mb-5">
<table class="table table-striped table-hover"> <table class="table table-bordered table-hover">
<thead> <thead>
<tr> <tr>
<td></td>
<td v-for="(column, index) in data.columns"> <td v-for="(column, index) in data.columns">
<input <div class="d-flex">
type="text" <input type="text"
v-model="data.columns[index]"> class="form-control"
<a class="btn btn-sm btn-danger ms-2" v-model="data.columns[index]">
<a class="btn btn-danger ms-2"
v-on:click="data.columns.splice(index, 1); data.elements.forEach(row => row.cells.splice(index, 1));"> v-on:click="data.columns.splice(index, 1); data.elements.forEach(row => row.cells.splice(index, 1));">
<i class="fas fa-times"></i> <i class="fas fa-times"></i>
</a> </a>
</div>
</td> </td>
<td> <td class="text-end">
<a class="<%= button_classes("btn-sm") %>" <a class="btn btn-primary me-2"
v-on:click="data.columns.push('')"> v-on:click="data.columns.push('')">
<i class="fas fa-plus"></i> colonne <i class="fas fa-plus"></i> colonne
</a> </a>
<a class="btn btn-primary"
v-on:click="data.elements.push({cells: []})">
<i class="fas fa-plus"></i> ligne
</a>
</td> </td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<draggable :list="data.elements" handle=".dragHandle"> <draggable :list="data.elements" handle=".dragHandle">
<tr v-for="(row, index) in data.elements"> <tr v-for="(row, index) in data.elements">
<td>
<a class="btn p-0 dragHandle">
<i class="fa fa-bars handle"></i>
</a>
</td>
<td v-for="(column, columnIndex) in data.columns"> <td v-for="(column, columnIndex) in data.columns">
<input <input type="text"
type="text" class="form-control"
v-model="row.cells[columnIndex]"> v-model="row.cells[columnIndex]">
</td> </td>
<td> <td class="text-end">
<a class="btn btn-sm btn-danger" <div class="d-flex">
v-on:click="data.elements.splice(index, 1);"> <a class="btn btn-danger"
<i class="fas fa-times"></i> v-on:click="data.elements.splice(index, 1)">
</a> <i class="fas fa-times"></i>
</a>
<a class="btn ms-auto dragHandle">
<i class="fa fa-bars handle"></i>
</a>
</div>
</td> </td>
</tr> </tr>
</draggable> </draggable>
</tbody> </tbody>
</table> </table>
<a class="<%= button_classes('btn-sm') %>"
v-on:click="data.elements.push({cells: []})">
<i class="fas fa-plus"></i> ligne
</a>
</div> </div>
...@@ -63,7 +57,5 @@ ...@@ -63,7 +57,5 @@
placeholder: "Écrivez-ici la transcription textuelle du tableau" %> placeholder: "Écrivez-ici la transcription textuelle du tableau" %>
<%#= block_component_add_element "Ajouter une ligne" %> <%#= block_component_add_element "Ajouter une ligne" %>
<%# Comportement non attendu dans ce context %> <%# Comportement non attendu dans ce context %>
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