diff --git a/app/views/admin/communication/blocks/templates/files/_edit.html.erb b/app/views/admin/communication/blocks/templates/files/_edit.html.erb index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b4355cff9351fc6294168c2562f296c54723bb67 100644 --- a/app/views/admin/communication/blocks/templates/files/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/files/_edit.html.erb @@ -0,0 +1,47 @@ +<a class="<%= button_classes('mb-4') %>" + v-on:click="data.elements.push({title: '', file: {}})"> + <%= t '.add_file' %> +</a> + +<draggable :list="data.elements" handle=".dragHandle" class="row"> + <div v-for="(element, index) in data.elements" class="col-md-4"> + <div class="card"> + <div class="card-body"> + <div class="d-flex"> + <div> + <a class="btn ps-0 pt-0 dragHandle"> + <i class="fa fa-bars handle"></i> + </a> + </div> + <div class="flex-fill"> + <label class="form-label" + :for="'element-' + index + '-title'"><%= t '.title_label' %></label> + <input class="form-control mb-3" + v-model="element.title" + placeholder="<%= t '.title_placeholder' %>" + type="text" + :id="'element-' + index + '-title'" /> + + <div v-if="!element.file.id"> + <label class="form-label" + :for="'element-' + index + '-file'"> + <%= t '.file_label' %> + </label> + <input class="form-control mb-4" + type="file" + @change="onFileImageChange( $event, element, 'file' )" + :id="'element-' + index + '-file'"> + </div> + <div v-if="element.file"> + <a class="btn btn-sm btn-danger mt-2" + v-on:click="element.file=null"> + <i class="fas fa-times"></i> + <%= t '.remove_file' %> + </a> + </div> + </div> + </div> + </div> + </div> + </div> +</draggable> diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 954e23bafd5546e45a19fe9403f82670c8053006..848836300be58a3912b95400d29b3d12baf87f69 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -176,6 +176,13 @@ fr: code_placeholder: Entrez ici le code transcription_label: Transcription textuelle du contenu transcription_placeholder: Entrez ici la transcription + files: + edit: + add_file: Ajouter un fichier + remove_file: Supprimer le fichier + file_label: Fichier + title_label: Titre + title_placeholder: Entrer le titre de la définition gallery: edit: add_image: Ajouter une image