Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin: ajout des encarts d'alerte dans l'admin pour permettre au métier de les modifier #51

Draft
wants to merge 1 commit into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pilotage/dashboards/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@


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",
"com_alert_link",
)


admin.site.register(Dashboard, DashboardAdmin)
Expand Down
12 changes: 12 additions & 0 deletions pilotage/dashboards/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ 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"
)
Comment on lines +37 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je met un peu tout en vrac car des remarques sont communes :

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 !</span> <i class="ri-external-link-line font-weight-medium" aria-hidden="true"></i></a>
</div>
</div>
</div>
Expand Down
Loading