-
Notifications
You must be signed in to change notification settings - Fork 9
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
[Feat] Ajout d'un bouton de validation du Diagnostic pour une projet #932
Conversation
@etchegom J'ai fait une modification dans le model du projet (ajout de l'attribut is_diagnostic_done) pourrais-tu vérifier le model ainsi que la migration s'il te plait ? |
<div x-data="MarkDiagAsDone({{ request.user.id }}, {{ project.id }}, '{{ project.is_diagnostic_done }}' == 'True')"> | ||
<header> | ||
<h6 class="font-small text-uppercase fr-mb-1v">Diagnostic</h6> | ||
</header> | ||
<template x-if="displayDiagButton"> | ||
<button class="fr-btn fr-btn--sm fr-btn--secondary fr-mt-2w fr-py-2w fr-mb-2w text-uppercase w-100 justify-content-center" | ||
@click='handleClickMarkDiagAsDone' | ||
data-cy="button-diag-project-done"> | ||
<span class="fr-icon-double-check-line" aria-hidden="true"></span> Marquer l’appel de “diagnostic” comme fait | ||
</button> | ||
</template> | ||
<template x-if="!displayDiagButton"> | ||
<p class="fw-700 fr-my-1w" data-cy="diag-project-done"> | ||
<span class="fr-icon-double-check-line" aria-hidden="true"></span> Appel de "diagnostic" effectué | ||
</p> | ||
</template> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A titre d'exemple, avec htmx, on pourrait se passer de créer le fichier MarkDiagAsDone.js
.
Ca donnerait qq chose comme ça (non testé):
<div x-data="{displayDiagButton: false}">
<header>
<h6 class="font-small text-uppercase fr-mb-1v">Diagnostic</h6>
</header>
<template x-if="displayDiagButton">
<button class="fr-btn fr-btn--sm fr-btn--secondary fr-mt-2w fr-py-2w fr-mb-2w text-uppercase w-100 justify-content-center"
data-cy="button-diag-project-done"
hx-put={% url 'projects-project-detail' project.id %}
hx-vals='{"is_diagnostic_done": true}'
hx-on::after-request="displayDiagButton = true">
<span class="fr-icon-double-check-line" aria-hidden="true"></span> Marquer l’appel de “diagnostic” comme fait
</button>
</template>
<template x-if="!displayDiagButton">
<p class="fw-700 fr-my-1w" data-cy="diag-project-done">
<span class="fr-icon-double-check-line" aria-hidden="true"></span> Appel de "diagnostic" effectué
</p>
</template>
</div>
is_diagnostic_done: true, | ||
}); | ||
if (response.status !== 200) { | ||
throw new Error('Error while marking the diag as done'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ca envoie un message dans sentry quand on raise une erreur?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Il s'agit de :
Décrivez vos changements
Ajout d'une partie diagnostic dans la présentation d'un projet, uniquement pour les membres du staff.
Resolve #852
Checklist d'acceptation de revue de code
Demandes