Skip to content

Commit

Permalink
Affichage de la visibilité au masculin
Browse files Browse the repository at this point in the history
  • Loading branch information
alanzirek committed Feb 27, 2025
1 parent e4bfafc commit 388bbe6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions core/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ def get_visibilite_display_text(self) -> str:
case Visibilite.NATIONALE:
return "Toutes les structures"

@property
def visibility_display(self) -> str:
return Visibilite.get_masculine_label(self.visibilite)

def save(self, *args, **kwargs):
if self.pk:
if self.is_visibilite_limitee and self.allowed_structures.count() == 0:
Expand Down
5 changes: 5 additions & 0 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,8 @@ class Visibilite(models.TextChoices):
LOCALE = "locale", "Votre structure et l'administration centrale pourront consulter et modifier la fiche"
LIMITEE = "limitee", "Les structures de votre choix pourront consulter et modifier la fiche"
NATIONALE = "nationale", "La fiche sera visible et modifiable par toutes les structures"

@classmethod
def get_masculine_label(cls, value):
masculine_labels = {cls.LOCALE: "Local", cls.LIMITEE: "Limité", cls.NATIONALE: "National"}
return masculine_labels.get(value)
5 changes: 3 additions & 2 deletions sv/display.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from dataclasses import dataclass

from sv.models import FicheDetection, OrganismeNuisible, FicheZoneDelimitee


Expand Down Expand Up @@ -27,7 +28,7 @@ def from_fiche_zone(cls, fiche: FicheZoneDelimitee):
is_ac_notified=fiche.evenement.is_ac_notified,
date_creation=fiche.date_creation.strftime("%d/%m/%Y"),
createur=str(fiche.createur),
visibilite=str(fiche.evenement.visibilite),
visibilite=fiche.evenement.visibility_display,
**fiche.evenement.get_etat_data_from_fin_de_suivi(fiche.has_fin_de_suivi),
communes_list=[],
get_absolute_url=fiche.get_absolute_url() + "#tabpanel-zone-panel",
Expand All @@ -45,7 +46,7 @@ def from_fiche_detection(cls, fiche: FicheDetection):
date_creation=fiche.date_creation.strftime("%d/%m/%Y"),
createur=str(fiche.createur),
**fiche.evenement.get_etat_data_from_fin_de_suivi(fiche.has_fin_de_suivi),
visibilite=str(fiche.evenement.visibilite),
visibilite=fiche.evenement.visibility_display,
communes_list=fiche.lieux_list_with_commune,
get_absolute_url=fiche.get_absolute_url() + f"?detection={fiche.pk}",
numero_evenement=str(fiche.evenement.numero) if fiche.evenement.numero else "non attribué",
Expand Down
2 changes: 1 addition & 1 deletion sv/templates/sv/_evenement_badges.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
{% if evenement.is_ac_notified %}
<p class="fr-badge ac-notified"><span class="fr-icon-notification-3-line fr-mr-2v fr-icon--sm" aria-hidden="true"></span> Déclaré AC</p>
{% endif %}
<p class="fr-badge fr-badge--no-icon">{{ evenement.visibilite }}</p>
<p class="fr-badge fr-badge--no-icon">{{ evenement.visibility_display }}</p>
<p class="fr-badge fr-badge--{{etat.etat|etat_fiche_color}} fr-badge--no-icon">{{ etat.readable_etat }}</p>
</div>

0 comments on commit 388bbe6

Please sign in to comment.