Skip to content

Commit

Permalink
improve(Tableau de bord): L'affichage du bandeau de communication est…
Browse files Browse the repository at this point in the history
… conditionné avec une variable d'env dédiée (#4801)
  • Loading branch information
Charline-L authored Dec 20, 2024
1 parent 49f576b commit 7f7964c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions .env.docker
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ ENABLE_DASHBOARD=True
PUBLISH_BY_DEFAULT=True
ENABLE_VUE3=True
ENABLE_WASTE_MEASUREMENTS=True
SHOW_MANAGEMENT_INFORMATION_BANNER=True
1 change: 1 addition & 0 deletions docs/ONBOARDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ ENABLE_DASHBOARD= Optionnel - `True` pour montrer la nouvelle page d'accueil des
PUBLISH_BY_DEFAULT= Optionnel - `True` pour publier les cantines sauf celles qui sont identifiées autrement.
ENABLE_VUE3= Optionnel - `True` pour rendre les nouvelles vues disponibles.
ENABLE_WASTE_MEASUREMENTS= Optionnel - `True` pour rendre l'outil évaluation gaspillage alimentaire disponible
SHOW_MANAGEMENT_INFORMATION_BANNER= Optionnel - `True` pour afficher une bannière dans la page d'accueil du tableau de bord
```

### Relances automatiques par email
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<DsfrCallout noIcon>
<DsfrCallout noIcon class="mt-2">
<h2 class="fr-text font-weight-bold mb-2 mt-2">
CAMPAGNE DE TELEDECLARATION 2025 : Du 7 janvier au 31 mars
</h2>
Expand Down Expand Up @@ -43,7 +43,7 @@
import DsfrCallout from "@/components/DsfrCallout"
export default {
name: "TeledeclarationBanner",
name: "InformationBanner",
components: {
DsfrCallout,
},
Expand Down
9 changes: 4 additions & 5 deletions frontend/src/views/ManagementPage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
les cantines de votre territoire
</router-link>
</p>
<InformationBanner v-if="showInformationBanner" />
<div v-if="canteenCount > 0" class="mt-4">
<SuccessBanner v-if="showSuccessBanner" />
<TeledeclarationBanner v-else-if="teledeclarationCampaignActive && !correctionCampaignActive" />
<ActionsBanner v-else />
</div>
<div class="mt-4">
Expand Down Expand Up @@ -92,7 +92,7 @@ import CanteensPagination from "./CanteensPagination.vue"
import PageSatisfaction from "@/components/PageSatisfaction.vue"
import DsfrSegmentedControl from "@/components/DsfrSegmentedControl"
import UserTools from "./UserTools"
import TeledeclarationBanner from "./TeledeclarationBanner"
import InformationBanner from "./InformationBanner"
import CanteenCreationDialog from "./CanteenCreationDialog"
import ActionsBanner from "./ActionsBanner"
import SuccessBanner from "./SuccessBanner"
Expand All @@ -110,7 +110,7 @@ export default {
CanteensPagination,
UserTools,
PageSatisfaction,
TeledeclarationBanner,
InformationBanner,
ActionsBanner,
SuccessBanner,
CanteenCreationDialog,
Expand All @@ -123,8 +123,6 @@ export default {
canteenCount: undefined,
hasActions: false,
showCanteenCreationPrompt: null,
teledeclarationCampaignActive: window.ENABLE_TELEDECLARATION,
correctionCampaignActive: window.TELEDECLARATION_CORRECTION_CAMPAIGN,
actionsLoading: true,
resources: [
{
Expand Down Expand Up @@ -175,6 +173,7 @@ export default {
style: "background-color: #E8EDFF; border: none;", // light / background / contrast-info
},
],
showInformationBanner: window.SHOW_MANAGEMENT_INFORMATION_BANNER,
viewStyles: [
{
text: "Vue cartes",
Expand Down
1 change: 1 addition & 0 deletions macantine/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@
PUBLISH_BY_DEFAULT = os.getenv("PUBLISH_BY_DEFAULT") == "True"
ENABLE_VUE3 = os.getenv("ENABLE_VUE3") == "True"
ENABLE_WASTE_MEASUREMENTS = os.getenv("ENABLE_WASTE_MEASUREMENTS") == "True"
SHOW_MANAGEMENT_INFORMATION_BANNER = os.getenv("SHOW_MANAGEMENT_INFORMATION_BANNER") == "True"

# Custom testing

Expand Down
1 change: 1 addition & 0 deletions web/templates/vue-app.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
window.TELEDECLARATION_END_DATE = "{% teledeclaration_end_date %}" || null
window.IS_WIDGET = "{{ is_widget }}"
window.ENABLE_WASTE_MEASUREMENTS = "{% enable_waste_measurements %}" === "True"
window.SHOW_MANAGEMENT_INFORMATION_BANNER = "{% show_management_information_banner %}" === "True"
</script>

<!-- Matomo opt-out settings -->
Expand Down
5 changes: 5 additions & 0 deletions web/templatetags/featureflags.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ def enable_dashboard():
@register.simple_tag
def enable_waste_measurements():
return getattr(settings, "ENABLE_WASTE_MEASUREMENTS", "")


@register.simple_tag
def show_management_information_banner():
return getattr(settings, "SHOW_MANAGEMENT_INFORMATION_BANNER", "")

0 comments on commit 7f7964c

Please sign in to comment.