diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9e101dc26..3e288fecd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -60,7 +60,7 @@ Concernant les langues : Pour vérifier son code, on peut intégrer le linter adapté à son IDE et aussi faire ceci : ```{ .bash } -make checkstyle +make quality ``` Une vérification automatique est faite via des *pre-commit hooks*, qui ont normalement été installés via le `make init`. diff --git a/Makefile b/Makefile index 381273ce6..394a8c9f2 100644 --- a/Makefile +++ b/Makefile @@ -12,12 +12,12 @@ else endif # Commands -checkstyle: - poetry run pre-commit run --all-files +.PHONY: collectstatic collectstatic: poetry run python manage.py collectstatic --noinput +.PHONY: init init: poetry install poetry run pre-commit install @@ -34,12 +34,19 @@ messages: compilemessages: poetry run django-admin compilemessages +.PHONY: quality +quality: + poetry run pre-commit run --all-files + +.PHONY: runserver runserver: poetry run python manage.py runserver $(local_port) +.PHONY: test test: poetry run python manage.py test +.PHONY: update_dsfr update_dsfr: bash scripts/download_latest.sh poetry run python manage.py trim_dist @@ -47,9 +54,11 @@ update_dsfr: poetry run python manage.py make_icon_picker_files make collectstatic +.PHONY: static_server static_server: python -m http.server 1$(local_port) -d docs/ +.PHONY: export_static export_static: poetry run python manage.py migrate poetry run python manage.py import_sample_data diff --git a/dsfr/checksums.py b/dsfr/checksums.py index 63a74ce1d..a8bdb31f7 100644 --- a/dsfr/checksums.py +++ b/dsfr/checksums.py @@ -23,11 +23,6 @@ "sha384-pXDVyHuMGAo5xGPXnYhmr6rOcGwSZsrAVCJdC6J2PRRxcJL9jFMK//yzaUqMhsBw" ) -# dsfr/static/dsfr/dist/utility/icons/icons.min.css -INTEGRITY_CSS_ICONS = ( - "sha384-00cql3NHF4SSck9bB/Ca/LHBQnO4sy17TUWBr2QlKc1fqcPQ9EIG4g6Mt22uP9Vp" -) - # dsfr/static/dsfr/dist/favicon/apple-touch-icon.png INTEGRITY_FAVICON_APPLE = ( "sha384-bE/sjT09LYXMMjd/7ovUY40XBU2WQoLkIRw4/eBcHdBVsJOhoomJuSSa+qEFGku/" diff --git a/dsfr/locale/fr/LC_MESSAGES/django.mo b/dsfr/locale/fr/LC_MESSAGES/django.mo index 53ac5828e..9d8492326 100644 Binary files a/dsfr/locale/fr/LC_MESSAGES/django.mo and b/dsfr/locale/fr/LC_MESSAGES/django.mo differ diff --git a/dsfr/locale/fr/LC_MESSAGES/django.po b/dsfr/locale/fr/LC_MESSAGES/django.po index 3f0edad43..9b3b59c8e 100644 --- a/dsfr/locale/fr/LC_MESSAGES/django.po +++ b/dsfr/locale/fr/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-23 11:10+0200\n" -"PO-Revision-Date: 2024-08-23 11:12+0200\n" +"POT-Creation-Date: 2025-03-03 16:55+0100\n" +"PO-Revision-Date: 2025-03-03 16:55+0100\n" "Last-Translator: \n" "Language-Team: \n" "Language: fr\n" @@ -440,12 +440,12 @@ msgstr "Qu’est-ce que FranceConnect ?" msgid "Menu" msgstr "Menu" -#: dsfr/templates/dsfr/header.html:87 dsfr/templates/dsfr/theme_modale.html:13 +#: dsfr/templates/dsfr/header.html:91 dsfr/templates/dsfr/theme_modale.html:13 #: dsfr/templates/dsfr/transcription.html:30 msgid "Close" msgstr "Fermer" -#: dsfr/templates/dsfr/header.html:91 +#: dsfr/templates/dsfr/header.html:95 msgid "Main menu" msgstr "Menu principal" diff --git a/dsfr/management/commands/integrity_checksums.py b/dsfr/management/commands/integrity_checksums.py index e3f3014b8..6f8e3d318 100644 --- a/dsfr/management/commands/integrity_checksums.py +++ b/dsfr/management/commands/integrity_checksums.py @@ -17,7 +17,6 @@ def handle(self, *args, **options): {"path": "dsfr/dsfr.nomodule.min.js", "constant": "INTEGRITY_JS_NOMODULE"}, {"path": "dsfr/dsfr.min.css", "constant": "INTEGRITY_CSS"}, {"path": "utility/utility.min.css", "constant": "INTEGRITY_UTILITY_CSS"}, - {"path": "utility/icons/icons.min.css", "constant": "INTEGRITY_CSS_ICONS"}, { "path": "favicon/apple-touch-icon.png", "constant": "INTEGRITY_FAVICON_APPLE", diff --git a/dsfr/management/commands/make_icon_picker_files.py b/dsfr/management/commands/make_icon_picker_files.py index 37137f2d5..29aaae6cf 100644 --- a/dsfr/management/commands/make_icon_picker_files.py +++ b/dsfr/management/commands/make_icon_picker_files.py @@ -45,4 +45,6 @@ def handle(self, *args, **options): json.dump(icons_dict, fp) fp.write("\n") - print("Folders created or updated: ", all_folders) + self.stdout.write( + self.style.SUCCESS(f"Folders created or updated: {all_folders}") + ) diff --git a/dsfr/management/commands/trim_dist.py b/dsfr/management/commands/trim_dist.py index fe60c150b..7a2855ceb 100644 --- a/dsfr/management/commands/trim_dist.py +++ b/dsfr/management/commands/trim_dist.py @@ -10,7 +10,8 @@ class Command(BaseCommand): BASE_PATH = "dsfr/static/dsfr/dist" def handle(self, *args, **options): - print("Delete CSS map files and non-minified CSS files") + self.stdout.write("Delete CSS map files and non-minified CSS files") + deleted_files = 0 all_css_map_files = self.get_files_by_ext("*.css.map") for file in all_css_map_files: @@ -22,9 +23,10 @@ def handle(self, *args, **options): os.remove(file) deleted_files += 1 - print(f"{deleted_files} files deleted.") + self.stdout.write(f"{deleted_files} files deleted.") + + self.stdout.write("Delete JS map files and non-minified files") - print("Delete JS map files and non-minified files") deleted_files = 0 all_js_map_files = self.get_files_by_ext("*.js.map") for file in all_js_map_files: @@ -36,9 +38,9 @@ def handle(self, *args, **options): os.remove(file) deleted_files += 1 - print(f"{deleted_files} files deleted.") + self.stdout.write(f"{deleted_files} files deleted.") - print("Removing mentions of deleted files") + self.stdout.write("Removing mentions of deleted files") edited_files = 0 all_minified_js_files = self.get_files_by_ext("*.min.js") for filename in all_minified_js_files: @@ -51,7 +53,7 @@ def handle(self, *args, **options): file.truncate() edited_files += 1 - print(f"{edited_files} files edited.") + self.stdout.write(f"{edited_files} files edited.") def get_files_by_ext(self, extension) -> list: return [ diff --git a/dsfr/templatetags/dsfr_tags.py b/dsfr/templatetags/dsfr_tags.py index 3983ea45d..6a610a1e3 100644 --- a/dsfr/templatetags/dsfr_tags.py +++ b/dsfr/templatetags/dsfr_tags.py @@ -12,7 +12,6 @@ from dsfr.checksums import ( INTEGRITY_CSS, INTEGRITY_UTILITY_CSS, - INTEGRITY_CSS_ICONS, INTEGRITY_FAVICON_APPLE, INTEGRITY_FAVICON_ICO, INTEGRITY_FAVICON_MANIFEST, @@ -228,7 +227,7 @@ def dsfr_alert(*args, **kwargs) -> dict: "collapsible_attrs", { "onclick": ( - "const alert = this.parentNode; " "alert.parentNode.removeChild(alert)" + "const alert = this.parentNode; alert.parentNode.removeChild(alert);" ) }, ) diff --git a/dsfr/test/test_templatetags.py b/dsfr/test/test_templatetags.py index 97cb93f1b..227353653 100644 --- a/dsfr/test/test_templatetags.py +++ b/dsfr/test/test_templatetags.py @@ -175,7 +175,7 @@ def test_alert_tag_has_collapse_button(self): rendered_template = self.template_to_render.render(self.context) self.assertInHTML( """ - """, # noqa diff --git a/example_app/locale/fr/LC_MESSAGES/django.mo b/example_app/locale/fr/LC_MESSAGES/django.mo index 6dec56d17..eb5fb35e4 100644 Binary files a/example_app/locale/fr/LC_MESSAGES/django.mo and b/example_app/locale/fr/LC_MESSAGES/django.mo differ diff --git a/example_app/locale/fr/LC_MESSAGES/django.po b/example_app/locale/fr/LC_MESSAGES/django.po index 19ce0d14f..cf567497a 100644 --- a/example_app/locale/fr/LC_MESSAGES/django.po +++ b/example_app/locale/fr/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-23 11:21+0200\n" -"PO-Revision-Date: 2024-08-23 11:22+0200\n" +"POT-Creation-Date: 2025-03-03 16:55+0100\n" +"PO-Revision-Date: 2025-03-03 16:55+0100\n" "Last-Translator: \n" "Language-Team: \n" "Language: fr\n" @@ -105,7 +105,7 @@ msgstr "Menu" msgid "Close" msgstr "Fermer" -#: example_app/templates/example_app/blocks/language_selector.html:10 +#: example_app/templates/example_app/blocks/language_selector.html:7 msgid "Select language" msgstr "Sélectionner une langue" diff --git a/example_app/templates/example_app/blocks/language_selector.html b/example_app/templates/example_app/blocks/language_selector.html index 73b98f13a..7ac5465fe 100644 --- a/example_app/templates/example_app/blocks/language_selector.html +++ b/example_app/templates/example_app/blocks/language_selector.html @@ -4,10 +4,11 @@ {% get_available_languages as LANGUAGES %} {% get_language_info_list for LANGUAGES as languages %}
+ {% translate "Select language" as select_language %} diff --git a/example_app/templates/example_app/index.html b/example_app/templates/example_app/index.html index 856fc8c4c..68e4ff7a1 100644 --- a/example_app/templates/example_app/index.html +++ b/example_app/templates/example_app/index.html @@ -2,12 +2,6 @@ {% load static dsfr_tags %} {% block extra_css %} - {% endblock extra_css %} {% block breadcrumb %} diff --git a/example_app/templates/example_app/page_colors.html b/example_app/templates/example_app/page_colors.html index 6f19cdef8..ee5b958fa 100644 --- a/example_app/templates/example_app/page_colors.html +++ b/example_app/templates/example_app/page_colors.html @@ -62,7 +62,7 @@

- Il faut utiliser une classe de type fr-background-alt--<color-name> (par exemple, fr-background-alt--green-archipel.) + Il faut utiliser une classe de type fr-background-alt--<color-name> (par exemple, fr-background-alt--green-archipel.)

@@ -95,7 +95,7 @@

Personnalise la couleur du fond et du texte.

- Il faut utiliser une classe de type fr-badge--<color-name> (par exemple, fr-quote--green-archipel.) + Il faut utiliser une classe de type fr-badge--<color-name> (par exemple, fr-badge--green-archipel.)

@@ -109,7 +109,7 @@

Personnalise la couleur de l’icône.

- Il faut utiliser une classe de type fr-quote--<color-name> (par exemple, fr-quote--green-archipel.) + Il faut utiliser une classe de type fr-quote--<color-name> (par exemple, fr-quote--green-archipel.)

{% dsfr_quote components_data.quote.sample_data.0 %} @@ -120,7 +120,7 @@

Personnalise la couleur du fond et de la bordure.

- Il faut utiliser une classe de type fr-callout--<color-name> (par exemple, fr-callout--green-archipel.) + Il faut utiliser une classe de type fr-callout--<color-name> (par exemple, fr-callout--green-archipel.)

{% dsfr_callout components_data.callout.sample_data.0 %} @@ -131,7 +131,7 @@

Personnalise la couleur de la bordure.

- Il faut utiliser une classe de type fr-highlight--<color-name> (par exemple, fr-highlight--green-archipel.) + Il faut utiliser une classe de type fr-highlight--<color-name> (par exemple, fr-highlight--green-archipel.)

{% dsfr_highlight components_data.highlight.sample_data.0 %} @@ -142,7 +142,7 @@

Personnalise la couleur du fond, du texte et de l’icône. Seuls les tags cliquables sont pris en compte.

- Il faut utiliser une classe de type fr-tag--<color-name> (par exemple, fr-tag--green-archipel.) + Il faut utiliser une classe de type fr-tag--<color-name> (par exemple, fr-tag--green-archipel.)

  • @@ -155,7 +155,7 @@

{% endblock content %} {% block extra_js %} -