diff --git a/src/dashboard/CHANGELOG.md b/src/dashboard/CHANGELOG.md index 32e1b86f..74cf975e 100644 --- a/src/dashboard/CHANGELOG.md +++ b/src/dashboard/CHANGELOG.md @@ -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 diff --git a/src/dashboard/apps/consent/static/apps/consent/css/app.css b/src/dashboard/apps/consent/static/apps/consent/css/app.css new file mode 100644 index 00000000..88ae5f02 --- /dev/null +++ b/src/dashboard/apps/consent/static/apps/consent/css/app.css @@ -0,0 +1,8 @@ +.consent-wrapper { + position: relative; + border: 1px solid grey; +} + +.consent-wrapper__inner { + padding: 0 1.5rem; +} diff --git a/src/dashboard/apps/consent/static/apps/consent/js/app.js b/src/dashboard/apps/consent/static/apps/consent/js/app.js new file mode 100644 index 00000000..938eb111 --- /dev/null +++ b/src/dashboard/apps/consent/static/apps/consent/js/app.js @@ -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); +}); diff --git a/src/dashboard/apps/consent/templates/consent/base.html b/src/dashboard/apps/consent/templates/consent/base.html index 848cf306..f7981581 100644 --- a/src/dashboard/apps/consent/templates/consent/base.html +++ b/src/dashboard/apps/consent/templates/consent/base.html @@ -1,4 +1,10 @@ {% extends "base.html" %} +{% load static %} + +{% block dashboard_extra_css %} + +{% endblock dashboard_extra_css %} + {% block dashboard_content %} {% endblock dashboard_content %} diff --git a/src/dashboard/apps/consent/templates/consent/includes/_consent_summary_awaiting.html b/src/dashboard/apps/consent/templates/consent/includes/_consent_summary_awaiting.html new file mode 100644 index 00000000..f40ff8fb --- /dev/null +++ b/src/dashboard/apps/consent/templates/consent/includes/_consent_summary_awaiting.html @@ -0,0 +1,30 @@ +{% load i18n %} + +{% if entities %} + {% trans "Validated consent for all entities" %} + + + {% trans "Validated consent entity by entity" %} + +{% endif %} diff --git a/src/dashboard/apps/consent/templates/consent/includes/_consent_summary_card.html b/src/dashboard/apps/consent/templates/consent/includes/_consent_summary_card.html new file mode 100644 index 00000000..abb77758 --- /dev/null +++ b/src/dashboard/apps/consent/templates/consent/includes/_consent_summary_card.html @@ -0,0 +1,26 @@ +{% load i18n %} + +
+
+
+

+ {{ resume_title }} +

+ {% if resume_description %} +

+ {{ resume_description }} +

+ {% endif %} +
+ + +
+
diff --git a/src/dashboard/apps/consent/templates/consent/includes/_consent_summary_validated.html b/src/dashboard/apps/consent/templates/consent/includes/_consent_summary_validated.html new file mode 100644 index 00000000..3e19f9cc --- /dev/null +++ b/src/dashboard/apps/consent/templates/consent/includes/_consent_summary_validated.html @@ -0,0 +1,14 @@ +{% load i18n %} + +{% if entities %} + +{% endif %} diff --git a/src/dashboard/apps/consent/templates/consent/includes/_resume_awaiting_consents.html b/src/dashboard/apps/consent/templates/consent/includes/_resume_awaiting_consents.html deleted file mode 100644 index b611592e..00000000 --- a/src/dashboard/apps/consent/templates/consent/includes/_resume_awaiting_consents.html +++ /dev/null @@ -1,28 +0,0 @@ -{% load i18n %} - -

- {% trans "Consents summary" %} -

- -

- - - {% trans "Validate content for all entities" %} - - -

- - diff --git a/src/dashboard/apps/consent/templates/consent/includes/_resume_validated_consents.html b/src/dashboard/apps/consent/templates/consent/includes/_resume_validated_consents.html deleted file mode 100644 index c8cc05ba..00000000 --- a/src/dashboard/apps/consent/templates/consent/includes/_resume_validated_consents.html +++ /dev/null @@ -1,15 +0,0 @@ -{% load i18n %} - -

{% trans "Validated entities" %}

- - diff --git a/src/dashboard/apps/consent/templates/consent/index.html b/src/dashboard/apps/consent/templates/consent/index.html index 6272ba35..a9c07c87 100644 --- a/src/dashboard/apps/consent/templates/consent/index.html +++ b/src/dashboard/apps/consent/templates/consent/index.html @@ -3,6 +3,19 @@ {% load i18n %} {% block dashboard_content %} - {% include "consent/includes/_resume_awaiting_consents.html" %} - {% include "consent/includes/_resume_validated_consents.html" %} +
+
+ {% 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 %} +
+ +
+ {% 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 %} +
+
{% endblock dashboard_content %} diff --git a/src/dashboard/apps/consent/templates/consent/manage.html b/src/dashboard/apps/consent/templates/consent/manage.html index d6b3d22f..aa5e17ad 100644 --- a/src/dashboard/apps/consent/templates/consent/manage.html +++ b/src/dashboard/apps/consent/templates/consent/manage.html @@ -3,64 +3,85 @@ {% load i18n static %} {% block dashboard_content %} -

{% trans "Manage consents" %}

+

+ {% trans "Manage consents" %} +

+ + {% if entities %} +
+ {% csrf_token %} -{% if entities %} - - {% csrf_token %} -
- - {% trans "Legend for all elements" %} - - {# toggle button #}
- - +
- - {% for entity in entities %} - {{ entity.name }} - - {% for consent in entity.get_consents %} -
-
- - -
-
-
- {% endfor %} - {% endfor %} -
- {{ field.errors }} + -
+ +
- - - {% else %} -

{% trans "No consents to validate" %}

+

+ {% trans "No consents to validate" %} +

{% endif %} {% endblock dashboard_content %} -{% block extra_dashboard_js %} - -{% endblock extra_dashboard_js %} +{% block dashboard_extra_js %} + {% if entities %} + + {% endif %} +{% endblock dashboard_extra_js %} diff --git a/src/dashboard/apps/home/templates/home/cards/consentement.html b/src/dashboard/apps/home/templates/home/cards/consentement.html index 1e0f0b46..dbc8a552 100644 --- a/src/dashboard/apps/home/templates/home/cards/consentement.html +++ b/src/dashboard/apps/home/templates/home/cards/consentement.html @@ -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 %} -
-
-
-
+{% translate "Consent Management" as consent_card_title %} +{% translate "Lorem [...] elit ut." as consent_card_description %} +{% url 'consent:index' as consent_index_url %} -
-

- - {% trans "Consent Management" %} - -

-

- Texte de la carte. - … -

-
- - - - - -
-
-
-
+{% 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" %} diff --git a/src/dashboard/apps/home/templates/home/index.html b/src/dashboard/apps/home/templates/home/index.html index fee5f3ac..afb77acb 100644 --- a/src/dashboard/apps/home/templates/home/index.html +++ b/src/dashboard/apps/home/templates/home/index.html @@ -3,9 +3,17 @@ {% load i18n %} {% block dashboard_content %} -

- {% trans "QualiCharge dashboard" %} -

+
+
+

+ {% trans "QualiCharge dashboard" %} +

+
+
- {% include "home/cards/consentement.html" %} +
+
+ {% include "home/cards/consentement.html" %} +
+
{% endblock dashboard_content %} diff --git a/src/dashboard/templates/403.html b/src/dashboard/templates/403.html new file mode 100644 index 00000000..3a38b1f9 --- /dev/null +++ b/src/dashboard/templates/403.html @@ -0,0 +1,65 @@ +{% extends "base.html" %} +{% load static i18n %} + +{% comment %} +todo: revoir le contenu rédactionnel de cette page +Faut-il ajouter un bouton contact et un formulaire comme préconisé dans le DSFR: +https://www.systeme-de-design.gouv.fr/composants-et-modeles/modeles/page-d-erreurs/ +{% endcomment %} + +{% block page_title %} + {% trans "Permission denied" %} +{% endblock page_title %} + +{% block content %} +
+
+
+
+

+ {% trans "Permission denied" %} +

+

+ {% trans "Error 403" %} +

+

+ {% trans "Sorry, You do not have the necessary permissions to access this page.." %} +

+

+ {% blocktranslate %} + If you think this is a mistake, you can contact our team.
+ Otherwise, to continue your visit you can consult our home page. + {% endblocktranslate %} +

+ + + +
+
+ + + + + + + + + + + + +
+
+
+
+{% endblock content %} diff --git a/src/dashboard/templates/404.html b/src/dashboard/templates/404.html index 7f46c1cb..555ca6d6 100644 --- a/src/dashboard/templates/404.html +++ b/src/dashboard/templates/404.html @@ -1,23 +1,66 @@ {% extends "base.html" %} {% load static i18n %} -{# todo: revoir le contenu rédactionnel de cette page #} +{% comment %} +todo: revoir le contenu rédactionnel de cette page +Faut-il ajouter un bouton contact et un formulaire comme préconisé dans le DSFR: +https://www.systeme-de-design.gouv.fr/composants-et-modeles/modeles/page-d-erreurs/ +{% endcomment %} {% block page_title %} - {% trans "Page not found (Err 404)" %} + {% trans "Page not found" %} {% endblock page_title %} {% block content %} -
-

- {% trans "Page not found (Err 404)" %} -

- {% url 'home:index' as url_home %} -

- {% blocktranslate %} - Sorry but this page does not exist.
- You can return to the home page. - {% endblocktranslate %} -

-
+
+
+
+
+

+ {% trans "Page not found" %} +

+

+ {% trans "Error 404" %} +

+

+ {% trans "The page you are looking for could not be found. We apologize for the inconvenience." %} +

+

+ {% blocktranslate %} If you typed the web address in the +browser, check that it is correct. The page may no longer be +available.
In this case, to continue your visit you can consult +our home page.{% endblocktranslate %} +

+ +
+
+ + + + + + + + + + + + +
+
+
+
{% endblock content %} diff --git a/src/dashboard/templates/500.html b/src/dashboard/templates/500.html index 2f3f1983..9958bea3 100644 --- a/src/dashboard/templates/500.html +++ b/src/dashboard/templates/500.html @@ -1,23 +1,57 @@ {% extends "base.html" %} {% load static i18n %} -{# todo: revoir le contenu rédactionnel de cette page #} +{% comment %} +todo: revoir le contenu rédactionnel de cette page +Faut-il ajouter un bouton contact et un formulaire comme préconisé dans le DSFR: +https://www.systeme-de-design.gouv.fr/composants-et-modeles/modeles/page-d-erreurs/ +{% endcomment %} {% block page_title %} - {% trans "Server Error (Err. 500)" %} + {% trans "Unexpected error" %} {% endblock page_title %} {% block content %} -
-

- {% trans "Server Error (Err 500)" %} -

- {% url 'home:index' as url_home %} -

- {% blocktrans %} - Oops, It seems that the server has a problem.
- You can try to return to the home page. - {% endblocktrans %} -

-
+
+
+
+
+

+ {% trans "Unexpected error" %} +

+

+ {% trans "Error 500" %} +

+

+ {% trans "Sorry, there is a problem with the service, we are working to resolve it as quickly as possible." %} +

+

+ {% trans "Try refreshing the page or try again later." %} +

+ {% comment %} + + {% endcomment %} +
+
+ + + + + + + + + + + + +
+
+
+
{% endblock content %} diff --git a/src/dashboard/templates/base.html b/src/dashboard/templates/base.html index 9c8b2baf..0d3a0f09 100644 --- a/src/dashboard/templates/base.html +++ b/src/dashboard/templates/base.html @@ -1,25 +1,27 @@ {% extends "dsfr/base.html" %} -{% load static i18n %} +{% load static i18n dsfr_tags %} + +{% block extra_css %} + {% block dashboard_extra_css %} + {% endblock dashboard_extra_css %} +{% endblock extra_css %} {% block header %} {% include "blocks/header.html" %} {% endblock header %} {% block content %} - {% if messages %} - - {% endif %} - {% block dashboard_content %}{% endblock dashboard_content %} + {% dsfr_django_messages %} + + {% block dashboard_content %} + {% endblock dashboard_content %} {% endblock content %} {% block extra_js %} - {% block extra_dashboard_js %}{% endblock extra_dashboard_js %} + {% block dashboard_extra_js %} + {% endblock dashboard_extra_js %} {% endblock extra_js %} {# djlint:off #}