mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-24 00:31:16 +00:00
Sli
3af5d96bf5
* Convert FileModerationView into ListView and add pagination with htmx * Don't allow sas moderation in file moderation view * Split up base.jinja and introduce base_fragment.jinja * Improve FileModerationView performances and make it root only * Add permissions tests for file modération
54 lines
1.8 KiB
Django/Jinja
54 lines
1.8 KiB
Django/Jinja
{% if is_fragment %}
|
|
{% extends "core/base_fragment.jinja" %}
|
|
|
|
{# Don't display tabs and errors #}
|
|
{% block tabs %}
|
|
{% endblock %}
|
|
{% block errors %}
|
|
{% endblock %}
|
|
{% else %}
|
|
{% extends "core/base.jinja" %}
|
|
{% endif %}
|
|
|
|
{% from "core/macros.jinja" import paginate_htmx %}
|
|
|
|
{% block title %}
|
|
{% trans %}File moderation{% endtrans %}
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<h3>{% trans %}File moderation{% endtrans %}</h3>
|
|
<div>
|
|
{% for f in object_list %}
|
|
<div
|
|
id="file-{{ loop.index }}"
|
|
style="margin: 2px; padding: 2px; border: solid 1px red; text-align: center"
|
|
>
|
|
{% if f.is_folder %}
|
|
<strong>Folder</strong>
|
|
{% else %}
|
|
<strong>File</strong>
|
|
{% endif %}
|
|
<p>
|
|
<a href="{{ url("core:file_detail", file_id=f.id) }}">{{ f.name }}</a><br/>
|
|
{% trans %}Full name: {% endtrans %}{{ f.get_parent_path()+'/'+f.name }}<br/>
|
|
{% trans %}Owner: {% endtrans %}{{ f.owner.get_display_name() }}<br/>
|
|
{% trans %}Date: {% endtrans %}{{ f.date|date(DATE_FORMAT) }} {{ f.date|time(TIME_FORMAT) }}<br/>
|
|
</p>
|
|
<p><button
|
|
hx-get="{{ url('core:file_moderate', file_id=f.id) }}"
|
|
hx-target="#content"
|
|
hx-swap="outerHtml"
|
|
>{% trans %}Moderate{% endtrans %}</button> -
|
|
{% set current_page = url('core:file_moderation') + "?page=" + page_obj.number | string %}
|
|
<button
|
|
hx-get="{{ url('core:file_delete', file_id=f.id) }}?next={{ current_page | urlencode }}&previous={{ current_page | urlencode }}"
|
|
hx-target="#file-{{ loop.index }}"
|
|
hx-swap="outerHtml"
|
|
>{% trans %}Delete{% endtrans %}</button></p>
|
|
</div>
|
|
{% endfor %}
|
|
{{ paginate_htmx(page_obj, paginator) }}
|
|
</div>
|
|
{% endblock %}
|