Skip to content

Commit

Permalink
🚸(dashboard ) redesign consent pages and revamp error page design.
Browse files Browse the repository at this point in the history
Introduced a new structure with clearer messaging about the error and possible user actions.
Added markdown for potential enhancements like contact options, following design standards.
Refactored the home page, the consent summary page and the consent manage with the `dsfr` style.
Add alert message and cusomise it with the `dsfr` style.
Added app.css stylesheet.
Update dashboard CHANGELOG entries : rearranged the entries under the "Added" section for clarity.
Moved static files from consent/static/consent/ to consent/static/apps/consent/.
Updated the 403, 404 and 500 error page to enhance user experience by redesigning its layout and content presentation.
  • Loading branch information
ssorin committed Dec 12, 2024
1 parent 6c0274a commit f7a5340
Show file tree
Hide file tree
Showing 17 changed files with 383 additions and 179 deletions.
11 changes: 6 additions & 5 deletions src/dashboard/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ and this project adheres to
### Added

- bootstrap dashboard project
- add dashboard homepage
- add internationalization and language switcher
- add authentication system
- introduce new custom user model
- add custom user model
- add core app with Entity and DeliveryPoint models
- add consent app with Consent model
- add core app with Entity and DeliveryPoint models
- add basic authentication system
- add internationalization and language switcher
- add dashboard homepage
- add consent form to manage consents of one or many entities
- integration of custom 403, 404 and 500 pages

[unreleased]: https://github.com/MTES-MCT/qualicharge/compare/main...bootstrap-dashboard-project

8 changes: 8 additions & 0 deletions src/dashboard/apps/consent/static/apps/consent/css/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.consent-wrapper {
position: relative;
border: 1px solid grey;
}

.consent-wrapper__inner {
padding: 0 1.5rem;
}
8 changes: 8 additions & 0 deletions src/dashboard/apps/consent/static/apps/consent/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* check/uncheck all checkbox in consent form
*/
document.getElementById("toggle-all")
.addEventListener("change", function() {
const checkboxes = document.getElementsByName("status");
checkboxes.forEach(checkbox => checkbox.checked = this.checked);
});
6 changes: 6 additions & 0 deletions src/dashboard/apps/consent/templates/consent/base.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{% extends "base.html" %}

{% load static %}

{% block dashboard_extra_css %}
<link rel="stylesheet" href="{% static "apps/consent/css/app.css" %}">
{% endblock dashboard_extra_css %}

{% block dashboard_content %}
{% endblock dashboard_content %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% load i18n %}

{% if entities %}
<strong>{% trans "Validated consent for all entities" %}</strong>
<ul class="fr-links-group fr-mb-2w">
<li>
<a class="fr-link fr-icon-arrow-right-line fr-link--icon-right"
href="{% url "consent:manage" %}"
data-fr-js-link-actionee="true">
{% trans "Validate content for all entities" %}
</a>
</li>
</ul>

<strong class="fr-mt-2w">{% trans "Validated consent entity by entity" %}</strong>
<ul class="fr-links-group">
{% for entity in entities %}
<li>
<a class="fr-link fr-icon-arrow-right-line fr-link--icon-right"
href="{% url "consent:manage" entity.slug %}"
data-fr-js-link-actionee="true">
{{ entity.name }} :
{% blocktranslate with consent_total=entity.get_consents.count entity_count=entity.count_awaiting_consents pluralize=entity.count_awaiting_consents|pluralize %}
{{ entity_count }}/{{ consent_total }} consent{{ pluralize }} to validate
{% endblocktranslate %}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% load i18n %}

<div class="fr-card">
<div class="fr-card__body">
<div class="fr-card__content">
<h3 class="fr-card__title">
{{ resume_title }}
</h3>
{% if resume_description %}
<p class="fr-card__desc">
{{ resume_description }}
</p>
{% endif %}
</div>

<div class="fr-card__footer">
{% if resume_validated %}
{% include "consent/includes/_consent_summary_validated.html" %}
{% endif %}
{% if resume_awaiting %}
{% include "consent/includes/_consent_summary_awaiting.html" %}
{% endif %}

</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% load i18n %}

{% if entities %}
<ul class="fr-links-group">
{% for entity in entities %}
<li>
{{ entity.name }}:
{% blocktranslate with consent_total=entity.get_consents.count consent_count=entity.count_validated_consents pluralize=entity.count_validated_consents|pluralize %}
{{ consent_count }}/{{ consent_total }} consent{{ pluralize }} validated
{% endblocktranslate %}
</li>
{% endfor %}
</ul>
{% endif %}

This file was deleted.

This file was deleted.

17 changes: 15 additions & 2 deletions src/dashboard/apps/consent/templates/consent/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
{% load i18n %}

{% block dashboard_content %}
{% include "consent/includes/_resume_awaiting_consents.html" %}
{% include "consent/includes/_resume_validated_consents.html" %}
<div class="fr-grid-row fr-grid-row--gutters fr-mb-1w">
<div class="fr-col-md-6 fr-col-12">
{% trans "Validated entities" as resume_title %}
{% trans "Lorem [...] elit ut." as resume_description %}

{% include "consent/includes/_consent_summary_card.html" with resume_validated=True resume_title=resume_title resume_description=resume_description %}
</div>

<div class="fr-col-md-6 fr-col-12">
{% trans "Awaiting consents" as resume_title %}
{% trans "Lorem [...] elit ut." as resume_description %}

{% include "consent/includes/_consent_summary_card.html" with resume_awaiting=True resume_title=resume_title resume_description=resume_description %}
</div>
</div>
{% endblock dashboard_content %}
115 changes: 68 additions & 47 deletions src/dashboard/apps/consent/templates/consent/manage.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,85 @@
{% load i18n static %}

{% block dashboard_content %}
<h2>{% trans "Manage consents" %}</h2>
<h2>
{% trans "Manage consents" %}
</h2>

{% if entities %}
<form action="" method="post">
{% csrf_token %}

{% if entities %}
<form action="" method="post">
{% csrf_token %}
<fieldset class="fr-fieldset" id="checkboxes" aria-labelledby="checkboxes-legend checkboxes-messages">

<legend class="fr-fieldset__legend--regular fr-fieldset__legend"
id="checkboxes-legend"> {% trans "Legend for all elements" %}
</legend>

{# toggle button #}
<div class="fr-fieldset__element">
<div class="fr-checkbox-group">
<input type="checkbox" id="toggle-all" name="toggle-all"
aria-describedby="toggle-all-messages"
data-fr-js-checkbox-input="true"
<input type="checkbox"
id="toggle-all"
name="toggle-all"
aria-describedby="toggle-all-messages"
data-fr-js-checkbox-input="true"
data-fr-js-checkbox-actionee="true">
<label class="fr-label" for="toggle-all">{% trans "Toggle All" %}</label>
<label class="fr-label" for="toggle-all">
<strong>{% trans "Toggle All" %}</strong>
</label>
</div>
</div>

{% for entity in entities %}
<strong>{{ entity.name }}</strong>

{% for consent in entity.get_consents %}
<div class="fr-fieldset__element">
<div class="fr-checkbox-group">
<input type="checkbox"
name="status"
value="{{ consent.id }}"
id="{{ consent.id }}"
{% if consent.status == "VALIDATED" %} checked{% endif %}
aria-describedby="{{ consent.id }}-messages"
data-fr-js-checkbox-input="true"
data-fr-js-checkbox-actionee="true"
>
<label class="fr-label" for="{{ consent.id }}">{{ consent.delivery_point.provider_assigned_id }} </label>
<div class="fr-messages-group" id="{{ consent.id }}-messages" aria-live="assertive"></div>
</div>
</div>
{% endfor %}
{% endfor %}

<div class="fr-messages-group" id="checkboxes-messages" aria-live="assertive">
{{ field.errors }}
<div class="consent-wrapper fr-py-6v fr-mb-6v">
<div class="consent-wrapper__inner">
{% for entity in entities %}
<fieldset class="fr-fieldset"
id="checkboxes"
aria-labelledby="checkboxes-legend checkboxes-messages">
<legend class="fr-fieldset__legend--regular fr-fieldset__legend"
id="checkboxes-legend">
{{ entity.name }}
</legend>

{% for consent in entity.get_consents %}
<div class="fr-fieldset__element">
<div class="fr-checkbox-group">
<input type="checkbox"
name="status"
value="{{ consent.id }}"
id="{{ consent.id }}"
{% if consent.status == 'VALIDATED' %} checked{% endif %}
aria-describedby="{{ consent.id }}-messages"
data-fr-js-checkbox-input="true"
data-fr-js-checkbox-actionee="true" />
<label class="fr-label" for="{{ consent.id }}">
{{ consent.delivery_point.provider_assigned_id }}
</label>
<div class="fr-messages-group"
id="{{ consent.id }}-messages"
aria-live="assertive">
</div>
</div>
</div>
{% endfor %}

<div class="fr-messages-group"
id="checkboxes-messages"
aria-live="assertive">
{{ field.errors }}
</div>
</fieldset>
{% endfor %}
</div>
</div>
</fieldset>
<button class="fr-btn" type="submit" name="submit">
{% trans "submit" %}
</button>
</form>

<button class="fr-btn" type="submit" name="submit"> {% trans "submit" %} </button>
</form>

{% else %}
<p>{% trans "No consents to validate" %}</p>
<p>
{% trans "No consents to validate" %}
</p>
{% endif %}
{% endblock dashboard_content %}

{% block extra_dashboard_js %}
<script src="{% static 'consent/js/app.js' %}">
</script>
{% endblock extra_dashboard_js %}
{% block dashboard_extra_js %}
{% if entities %}
<script src="{% static 'apps/consent/js/app.js' %}"></script>
{% endif %}
{% endblock dashboard_extra_js %}
48 changes: 8 additions & 40 deletions src/dashboard/apps/home/templates/home/cards/consentement.html
Original file line number Diff line number Diff line change
@@ -1,43 +1,11 @@
{% load i18n %}
{% load i18n dsfr_tags %}

{# todo: add real content to the card #}
{% comment %}
todo: add real content and image to the card
{% endcomment %}

<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-col-12 fr-col-md-6">
<div class="fr-card">
<div class="fr-card__body">
{% translate "Consent Management" as consent_card_title %}
{% translate "Lorem [...] elit ut." as consent_card_description %}
{% url 'consent:index' as consent_index_url %}

<div class="fr-card__content">
<p class="fr-card__title">
<a href="{% url 'consent:index' %}" rel="noopener noreferrer" title="">
{% trans "Consent Management" %}
</a>
</p>
<p class="fr-card__desc">
Texte de la carte.
</p>
</div>
<!-- /.fr-card__content -->

<div class="fr-card__footer">
<ul>
<li>
<a class="fr-link fr-icon-arrow-right-line fr-link--icon-right" href="#">
Lien interne
</a>
</li>
<li>
<a class="fr-link fr-icon-arrow-right-line fr-link--icon-right" href="#">
Lien interne
</a>
</li>
</ul>

</div>
<!-- /.fr-card__footer -->

</div>
</div>
</div>
</div>
{% dsfr_card title=consent_card_title link=consent_index_url description=consent_card_description extra_class="fr-card--horizontal" image_url="https://www.systeme-de-design.gouv.fr/img/placeholder.16x9.png" %}
16 changes: 12 additions & 4 deletions src/dashboard/apps/home/templates/home/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
{% load i18n %}

{% block dashboard_content %}
<h2>
{% trans "QualiCharge dashboard" %}
</h2>
<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-col-12 fr-col-md-12">
<h2>
{% trans "QualiCharge dashboard" %}
</h2>
</div>
</div>

{% include "home/cards/consentement.html" %}
<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-col-12 fr-col-md-6">
{% include "home/cards/consentement.html" %}
</div>
</div>
{% endblock dashboard_content %}
Loading

0 comments on commit f7a5340

Please sign in to comment.