Working state
This commit is contained in:
@@ -21,12 +21,14 @@
|
||||
<tr>
|
||||
<th>Aperçu</th>
|
||||
<th>URL</th>
|
||||
<th>Usage</th>
|
||||
<th>Uploadé le</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in media %}
|
||||
{% set usage = mediaUsage[item.id] ?? {'count': 0, 'posts': []} %}
|
||||
<tr>
|
||||
<td data-label="Aperçu">
|
||||
<div class="upload">
|
||||
@@ -47,6 +49,18 @@
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td data-label="Usage">
|
||||
{% if usage.count > 0 %}
|
||||
<strong>{{ usage.count }} article{{ usage.count > 1 ? 's' : '' }}</strong>
|
||||
<ul>
|
||||
{% for post in usage.posts %}
|
||||
<li><a href="/admin/posts/edit/{{ post.id }}">{{ post.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<span class="admin-table__muted">Aucun</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td data-label="Uploadé le">{{ item.createdAt|date("d/m/Y H:i") }}</td>
|
||||
<td data-label="Actions">
|
||||
<div class="u-inline-actions">
|
||||
@@ -54,7 +68,8 @@
|
||||
<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.')">
|
||||
{% if usage.count > 0 %}disabled title="Supprimez ou remplacez d'abord l'image dans les articles référencés"{% endif %}
|
||||
onclick="return confirm('Supprimer ce fichier ?')">
|
||||
Supprimer
|
||||
</button>
|
||||
</form>
|
||||
@@ -64,6 +79,8 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% include 'partials/_pagination.twig' with { pagination: pagination } %}
|
||||
{% else %}
|
||||
<p><em>Aucun fichier uploadé.</em></p>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user