mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
edit.php: rework Fichiers fieldset layout
- Drop file-field.php partial for cover/banner (it added a second label) - Inline all three file inputs with admin-file-input wrapper - Move banner inside the Fichiers fieldset - Each entry: one label, one input, one small hint — no duplicate labels - Context-aware hints: 'Laisser vide pour conserver...' when file already exists
This commit is contained in:
1
TODO.md
1
TODO.md
@@ -7,6 +7,7 @@
|
|||||||
- [x] Add `deleteThesisFile()` and `handleCoverUpload()` to Database.php
|
- [x] Add `deleteThesisFile()` and `handleCoverUpload()` to Database.php
|
||||||
- [x] Update `ThesisEditController::save()` to handle cover, file deletion, new uploads
|
- [x] Update `ThesisEditController::save()` to handle cover, file deletion, new uploads
|
||||||
- [x] Update `ThesisEditController::load()` to expose `currentFiles` + `currentCover`
|
- [x] Update `ThesisEditController::load()` to expose `currentFiles` + `currentCover`
|
||||||
|
- [x] Rework Fichiers fieldset layout: inline file inputs (no partial double-label), banner moved inside fieldset, one label per field
|
||||||
|
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@@ -100,9 +100,9 @@
|
|||||||
<legend>Fichiers</legend>
|
<legend>Fichiers</legend>
|
||||||
|
|
||||||
<!-- Cover image -->
|
<!-- Cover image -->
|
||||||
<div>
|
<div class="admin-form-group">
|
||||||
<label>Image de couverture :</label>
|
<label>Image de couverture :</label>
|
||||||
<div>
|
<div class="admin-file-input">
|
||||||
<?php if (!empty($currentCover)): ?>
|
<?php if (!empty($currentCover)): ?>
|
||||||
<div class="admin-banner-preview">
|
<div class="admin-banner-preview">
|
||||||
<img src="/media.php?path=<?= urlencode($currentCover['file_path']) ?>"
|
<img src="/media.php?path=<?= urlencode($currentCover['file_path']) ?>"
|
||||||
@@ -112,17 +112,16 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php $name = 'couverture'; $label = empty($currentCover) ? 'Image de couverture :' : 'Remplacer la couverture :'; $accept = 'image/jpeg,image/png'; $hint = 'JPG, PNG. Max 10 MB.'; include APP_ROOT . '/templates/partials/form/file-field.php'; ?>
|
<input type="file" id="couverture" name="couverture" accept="image/jpeg,image/png">
|
||||||
|
<small><?= empty($currentCover) ? 'JPG, PNG. Max 10 MB.' : 'Laisser vide pour conserver la couverture actuelle. JPG, PNG. Max 10 MB.' ?></small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Existing thesis files -->
|
<!-- Existing thesis files -->
|
||||||
<?php
|
<?php $thesisFilesList = array_filter($currentFiles, fn($f) => $f['file_type'] !== 'cover'); ?>
|
||||||
$thesisFilesList = array_filter($currentFiles, fn($f) => $f['file_type'] !== 'cover');
|
|
||||||
?>
|
|
||||||
<?php if (!empty($thesisFilesList)): ?>
|
<?php if (!empty($thesisFilesList)): ?>
|
||||||
<div class="admin-form-group">
|
<div class="admin-form-group">
|
||||||
<label>Fichiers existants :</label>
|
<label>Fichiers du TFE existants :</label>
|
||||||
<ul class="admin-file-list">
|
<ul class="admin-file-list">
|
||||||
<?php foreach ($thesisFilesList as $f): ?>
|
<?php foreach ($thesisFilesList as $f): ?>
|
||||||
<li class="admin-file-list-item">
|
<li class="admin-file-list-item">
|
||||||
@@ -146,26 +145,34 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<!-- New thesis files -->
|
<!-- New thesis files -->
|
||||||
<?php $name = 'files'; $label = 'Ajouter des fichiers :'; $accept = '.pdf,.jpg,.jpeg,.png,.mp4,.zip,.vtt'; $hint = 'PDF, JPG, PNG, MP4, ZIP. Max 50 MB par fichier. Pour les vidéos, un fichier .vtt peut être joint.'; $multiple = true; include APP_ROOT . '/templates/partials/form/file-field.php'; ?>
|
<div class="admin-form-group">
|
||||||
</fieldset>
|
<label for="files">Ajouter des fichiers du TFE :</label>
|
||||||
|
<div class="admin-file-input">
|
||||||
<!-- Image bannière (custom: includes current banner preview + remove checkbox) -->
|
<input type="file" id="files" name="files[]" multiple
|
||||||
<div>
|
accept=".pdf,.jpg,.jpeg,.png,.mp4,.zip,.vtt">
|
||||||
<label>Image bannière (accueil) :</label>
|
<small>PDF, JPG, PNG, MP4, ZIP. Max 50 MB par fichier. Pour les vidéos, un fichier .vtt de sous-titres peut être joint.</small>
|
||||||
<div>
|
|
||||||
<?php if (!empty($thesis['banner_path'])): ?>
|
|
||||||
<div class="admin-banner-preview">
|
|
||||||
<img src="/media.php?path=<?= urlencode($thesis['banner_path']) ?>"
|
|
||||||
alt="Bannière actuelle">
|
|
||||||
<label class="admin-checkbox-label">
|
|
||||||
<input type="checkbox" name="remove_banner" value="1"> Supprimer la bannière
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
|
||||||
<input type="file" name="banner" accept="image/jpeg,image/png,image/webp">
|
|
||||||
<small>JPG, PNG ou WEBP. Format paysage recommandé (4:1). Max 5 MB.</small>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
<!-- Banner image -->
|
||||||
|
<div class="admin-form-group">
|
||||||
|
<label>Image bannière (accueil) :</label>
|
||||||
|
<div class="admin-file-input">
|
||||||
|
<?php if (!empty($thesis['banner_path'])): ?>
|
||||||
|
<div class="admin-banner-preview">
|
||||||
|
<img src="/media.php?path=<?= urlencode($thesis['banner_path']) ?>"
|
||||||
|
alt="Bannière actuelle">
|
||||||
|
<label class="admin-checkbox-label">
|
||||||
|
<input type="checkbox" name="remove_banner" value="1"> Supprimer la bannière
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<input type="file" name="banner" accept="image/jpeg,image/png,image/webp">
|
||||||
|
<small><?= empty($thesis['banner_path']) ? 'JPG, PNG ou WEBP. Format paysage recommandé (4:1). Max 5 MB.' : 'Laisser vide pour conserver la bannière actuelle. JPG, PNG ou WEBP. Format paysage recommandé (4:1). Max 5 MB.' ?></small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<!-- Publication toggle -->
|
<!-- Publication toggle -->
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user