Skip to content

Commit

Permalink
admin: add alerts in admin s.t they can be modified without any dev help
Browse files Browse the repository at this point in the history
  • Loading branch information
laurinehu committed Oct 7, 2024
1 parent 97477e0 commit 8e4cc98
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
3 changes: 1 addition & 2 deletions pilotage/dashboards/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@


class DashboardAdmin(admin.ModelAdmin):
list_display = ("title", "metabase_db_id", "category", "active")

list_display = ("title", "metabase_db_id", "category", "active", "com_alert", "com_alert_description", "com_alert_text")

admin.site.register(Dashboard, DashboardAdmin)

Expand Down
7 changes: 7 additions & 0 deletions pilotage/dashboards/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ class Meta:
"Tally Embed ID", null=True, blank=True, max_length=10
)
active = models.fields.BooleanField("Actif", default=True)
com_alert = models.fields.BooleanField("Encart actif", default=False)
com_alert_description = models.fields.CharField(max_length=250,
default="Enquête utilisateur : votre avis est précieux pour nous aider à améliorer nos tableaux de bord !")
com_alert_text = models.fields.CharField(max_length=500,
default="Jusqu’au 20 octobre, prenez part à notre enquête sur l'usage des tableaux de bord dans vos missions et partagez vos suggestions d'amélioration.")
com_alert_link = models.fields.CharField(max_length=150,
default="https://tally.so/r/nPYGJd")
new = models.fields.BooleanField("Nouveau", default=False)

def __str__(self):
Expand Down
19 changes: 4 additions & 15 deletions pilotage/templates/dashboards/tableau_de_bord_public.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,7 @@ <h1>
{% if dashboard.new %}<span class="badge badge-base rounded-pill bg-important">Nouveau</span>{% endif %}
</h1>
{% if dashboard.description %}<div>{{ dashboard.description | markdown | safe }}</div>{% endif %}
<!-- Quick win crassou pour permettre de modifier l'encart du TB 408 -->
{% if dashboard.metabase_db_id == 408 %}
<div class="alert alert-warning mt-3 mt-md-4" role="status">
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Fermer"></button>
<p class="mb-2">
<strong>Votre retour est précieux sur ce nouveau tableau de bord !</strong>
</p>
<p class="mb-0">
Nous aimerions échanger avec quelques utilisateurs de ce nouveau tableau de bord pour collecter des retours sur son usage, ses points forts et ses points d’amélioration. Vous avez 30 minutes à nous accorder ? <a href="https://tally.so/r/3jL896">Je suis volontaire !</a>
</p>
</div>
{% else %}
{% if dashboard.com_alert %}
<div class="alert alert-info alert-dismissible fade show mt-3 mt-md-4" role="status">
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Fermer"></button>
<div class="row">
Expand All @@ -56,12 +45,12 @@ <h1>
</div>
<div class="col">
<p class="mb-2">
<strong>Enquête utilisateur : votre avis est précieux pour nous aider à améliorer nos tableaux de bord !</strong>
<strong>{{ dashboard.com_alert_description }}</strong>
</p>
<p class="mb-0">Jusqu’au 20 octobre, prenez part à notre enquête sur l'usage des tableaux de bord dans vos missions et partagez vos suggestions d'amélioration.</p>
<p class="mb-0">{{ dashboard.com_alert_text }}</p>
</div>
<div class="col-12 col-md-auto mt-3 mt-md-0 d-flex align-items-center justify-content-center">
<a class="btn btn-sm btn-primary btn-block btn-ico" href="https://tally.so/r/nPYGJd" target="_blank" rel="noopener"><span>Je participe à l’enquête</span> <i class="ri-external-link-line font-weight-medium" aria-hidden="true"></i></a>
<a class="btn btn-sm btn-primary btn-block btn-ico" href="{{ dashboard.com_alert_link }}" target="_blank" rel="noopener"><span>Je participe à l’enquête</span> <i class="ri-external-link-line font-weight-medium" aria-hidden="true"></i></a>
</div>
</div>
</div>
Expand Down

0 comments on commit 8e4cc98

Please sign in to comment.