Skip to content

Commit

Permalink
Permet de configurer toutes les options du bandeau d'information impo…
Browse files Browse the repository at this point in the history
…rtante dans l'admin (#166)

* Add full notice configuration options in the admin

* Fix translations
  • Loading branch information
Ash-Crow authored Aug 23, 2024
1 parent 0e2ca80 commit 62fe4ba
Show file tree
Hide file tree
Showing 13 changed files with 461 additions and 58 deletions.
2 changes: 2 additions & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@

TIME_ZONE = "UTC"

USE_L10N = True

USE_I18N = True

USE_TZ = True
Expand Down
26 changes: 21 additions & 5 deletions dsfr/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,34 @@ class DsfrConfigAdmin(admin.ModelAdmin):
fieldsets = (
("", {"fields": ("language",)}),
(
"Site",
_("Website"),
{
"fields": (
("site_title", "beta_tag"),
"site_tagline",
"notice",
"mourning",
)
},
),
(
"En-tête",
_("Notice"),
{
"fields": (
"notice_title",
"notice_description",
"notice_type",
"notice_link",
"notice_icon_class",
"notice_is_collapsible",
),
"description": _(
"The important notice banner should only be used for essential and temporary information. \
(Excessive or continuous use risks “drowning” the message.)"
),
},
),
(
_("Header"),
{
"fields": (
"header_brand",
Expand All @@ -35,7 +51,7 @@ class DsfrConfigAdmin(admin.ModelAdmin):
},
),
(
"Pied de page",
_("Footer"),
{
"fields": (
"footer_brand",
Expand All @@ -46,7 +62,7 @@ class DsfrConfigAdmin(admin.ModelAdmin):
},
),
(
"Logo opérateur",
_("Operator logo"),
{
"fields": (
"operator_logo_file",
Expand Down
28 changes: 28 additions & 0 deletions dsfr/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,34 @@
(_("Illustration colors"), COLOR_CHOICES_ILLUSTRATION),
]

# Types allowed for the site Notice
NOTICE_TYPE_CHOICES = [
(
_("Generic notices"),
[
("info", _("Information")),
("warning", _("Warning")),
("alert", _("Alert")),
],
),
(
_("Weather alert notices"),
[
("weather-orange", _("Orange weather alert")),
("weather-red", _("Red weather alert")),
("weather-purple", _("Purple weather alert")),
],
),
(
_("Alert notices"),
[
("attack", _("Attack alert")),
("witness", _("Call for witnesses")),
("cyberattack", _("Cyberattack")),
],
),
]

# Ratio classes used for medias and cards
IMAGE_RATIOS = [
("fr-ratio-32x9", "32x9"),
Expand Down
Binary file modified dsfr/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
Loading

0 comments on commit 62fe4ba

Please sign in to comment.