mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +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] Update `ThesisEditController::save()` to handle cover, file deletion, new uploads
|
||||
- [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
|
||||
|
||||
@@ -100,9 +100,9 @@
|
||||
<legend>Fichiers</legend>
|
||||
|
||||
<!-- Cover image -->
|
||||
<div>
|
||||
<div class="admin-form-group">
|
||||
<label>Image de couverture :</label>
|
||||
<div>
|
||||
<div class="admin-file-input">
|
||||
<?php if (!empty($currentCover)): ?>
|
||||
<div class="admin-banner-preview">
|
||||
<img src="/media.php?path=<?= urlencode($currentCover['file_path']) ?>"
|
||||
@@ -112,17 +112,16 @@
|
||||
</label>
|
||||
</div>
|
||||
<?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>
|
||||
|
||||
<!-- Existing thesis files -->
|
||||
<?php
|
||||
$thesisFilesList = array_filter($currentFiles, fn($f) => $f['file_type'] !== 'cover');
|
||||
?>
|
||||
<?php $thesisFilesList = array_filter($currentFiles, fn($f) => $f['file_type'] !== 'cover'); ?>
|
||||
<?php if (!empty($thesisFilesList)): ?>
|
||||
<div class="admin-form-group">
|
||||
<label>Fichiers existants :</label>
|
||||
<label>Fichiers du TFE existants :</label>
|
||||
<ul class="admin-file-list">
|
||||
<?php foreach ($thesisFilesList as $f): ?>
|
||||
<li class="admin-file-list-item">
|
||||
@@ -146,26 +145,34 @@
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 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'; ?>
|
||||
</fieldset>
|
||||
|
||||
<!-- Image bannière (custom: includes current banner preview + remove checkbox) -->
|
||||
<div>
|
||||
<label>Image bannière (accueil) :</label>
|
||||
<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 class="admin-form-group">
|
||||
<label for="files">Ajouter des fichiers du TFE :</label>
|
||||
<div class="admin-file-input">
|
||||
<input type="file" id="files" name="files[]" multiple
|
||||
accept=".pdf,.jpg,.jpeg,.png,.mp4,.zip,.vtt">
|
||||
<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 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>
|
||||
|
||||
<!-- 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 -->
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user