first commit
This commit is contained in:
70
views/admin/media/index.twig
Normal file
70
views/admin/media/index.twig
Normal file
@@ -0,0 +1,70 @@
|
||||
{% extends "layout.twig" %}
|
||||
|
||||
{% block title %}Tableau de bord – Médias{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Gestion des médias</h2>
|
||||
|
||||
{% include 'partials/_admin_nav.twig' %}
|
||||
|
||||
{% if error %}
|
||||
<div class="alert alert--danger">{{ error }}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if success %}
|
||||
<div class="alert alert--success">{{ success }}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if media is not empty %}
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Aperçu</th>
|
||||
<th>URL</th>
|
||||
<th>Uploadé le</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in media %}
|
||||
<tr>
|
||||
<td data-label="Aperçu">
|
||||
<div class="upload">
|
||||
<a href="{{ item.url }}" target="_blank" rel="noopener noreferrer" class="upload__thumb-link">
|
||||
<img src="{{ item.url }}" alt="" class="upload__thumb">
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<td data-label="URL">
|
||||
<div class="upload">
|
||||
<code class="upload__url">{{ item.url }}</code>
|
||||
<div class="upload__actions">
|
||||
<button type="button" class="btn btn--sm btn--secondary"
|
||||
onclick="navigator.clipboard.writeText('{{ item.url }}').then(function() {
|
||||
var btn = this; btn.textContent = 'Copié !';
|
||||
setTimeout(function() { btn.textContent = 'Copier l\'URL'; }, 1500);
|
||||
}.bind(this))">Copier l'URL</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td data-label="Uploadé le">{{ item.createdAt|date("d/m/Y H:i") }}</td>
|
||||
<td data-label="Actions">
|
||||
<div class="u-inline-actions">
|
||||
<form method="post" action="/admin/media/delete/{{ item.id }}" class="u-inline-form">
|
||||
<input type="hidden" name="{{ csrf.keys.name }}" value="{{ csrf.name }}">
|
||||
<input type="hidden" name="{{ csrf.keys.value }}" value="{{ csrf.value }}">
|
||||
<button type="submit" class="btn btn--sm btn--danger"
|
||||
onclick="return confirm('Supprimer ce fichier ?\n\nAttention : s\'il est utilisé dans un article, l\'image n\'apparaîtra plus.')">
|
||||
Supprimer
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p><em>Aucun fichier uploadé.</em></p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user