ref(emargements): recallage sur submission_index

pull/65/head
François Poulain 2023-02-01 17:04:56 +01:00
Parent 15e1e81fda
révision 566f87c025
3 fichiers modifiés avec 58 ajouts et 65 suppressions

Voir le fichier

@ -619,7 +619,7 @@ class CSVExportMixin:
class ScrutinAttendees(AdminMixin, CSVExportMixin, detail.DetailView):
model = models.Scrutin
template_name = 'modeladmin/index_attendees.html'
template_name = 'wagtailforms/attendees_index.html'
def get_csv_response(self, context):
"""Returns a CSV response"""

Voir le fichier

@ -1,64 +0,0 @@
{% extends "wagtailadmin/base.html" %}
{% load static i18n accessors %}
{% block titletag %}Émargement pour « {{ object.title }} »{% endblock %}
{% block content %}
<header class="nice-padding" role="banner">
<form action="" method="get" novalidate>
<div class="row">
<div class="left">
<div class="col header-title">
<h1 class="icon icon-form">
Émargement pour « {{ object.title }} »
</h1>
<div class="row">
{% include "includes/participation.html" with participation=object.get_participation %}
</div>
</div>
</div>
<div class="right">
<button name="action" value="CSV" class="button bicolor icon icon-download">{% trans 'Download CSV' %}</button>
</div>
</div>
</form>
</header>
<div class="nice-padding">
{% if attendees.emargement %}
<div class="overflow">
<table class="listing">
<thead>
<tr>
{% for field in attendees.basic_fields %}
<th id="{{ field }}">
{{ attendees.emargement.model | verbose_fieldname:field | default_if_none:'-' | title }}
</th>
{% endfor %}
{% with field="courriels" %}
<th id="{{ field | slugify }}">
{{ field | title }}
</th>
{% endwith %}
{% for field in attendees.extended_fields %}
<th id="{{ field | slugify }}">
{{ field | title }}
</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for pouvoir_data in attendees.emargement_with_data %}
<tr>
{% for field in pouvoir_data %}
<td>
{{ field | default_if_none:'-' | truncatechars:100 }}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="no-results-message">Il n'y a pas encore de répondant à ce scrutin.</p>
{% endif %}
</div>
{% endblock %}

Voir le fichier

@ -0,0 +1,57 @@
{% extends "wagtailforms/submissions_index.html" %}
{% load i18n wagtailadmin_tags accessors %}
{% block titletag %}Émargement pour « {{ object.title }} »{% endblock %}
{% block extra_js %}
{% endblock %}
{% block content %}
{% fragment as form_actions %}
<a href="?action=CSV" class="button bicolor button--icon">
{% icon name="download" wrapped=1 %}{% trans 'Download CSV' %}
</a>
{% endfragment %}
{% include "includes/participation_header.html" with classname="w-header--no-border" title="Émargement pour" subtitle=object.title|capfirst icon="form" merged=1 extra_actions=form_actions form_page=object %}
<div class="nice-padding">
<div class="report__results w-overflow-y-hidden w-overflow-x-scroll w-pb-6">
{% if attendees.emargement %}
<table class="listing">
<thead>
<tr>
{% for field in attendees.basic_fields %}
<th id="{{ field }}">
{{ attendees.emargement.model | verbose_fieldname:field | default_if_none:'-' | title }}
</th>
{% endfor %}
{% with field="courriels" %}
<th id="{{ field | slugify }}">
{{ field | title }}
</th>
{% endwith %}
{% for field in attendees.extended_fields %}
<th id="{{ field | slugify }}">
{{ field | title }}
</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for pouvoir_data in attendees.emargement_with_data %}
<tr>
{% for field in pouvoir_data %}
<td>
{{ field | default_if_none:'-' | truncatechars:100 }}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="no-results-message">Il n'y a pas encore de réponse à ce scrutin.</p>
{% endif %}
</div>
</div>
{% endblock %}