From 1320c7ff433e751f93d33144fcbec46afe0b1d43 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= <fpeters@entrouvert.com>
Date: Tue, 16 Aug 2022 10:25:25 +0200
Subject: [PATCH] templates: use global_context to get to form options &
 variables (#68173)

---
 templates/qommon/forms/widgets/nearby-forms.html            | 6 +++---
 templates/qommon/forms/widgets/pieces-daact-cartads.html    | 2 +-
 templates/qommon/forms/widgets/pieces-doc-cartads.html      | 2 +-
 .../variants/toodego/qommon/forms/widgets/nearby-list.html  | 6 +++---
 .../toodego/qommon/forms/widgets/pn-notifications.html      | 2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/templates/qommon/forms/widgets/nearby-forms.html b/templates/qommon/forms/widgets/nearby-forms.html
index b4f97ea9..72d11044 100644
--- a/templates/qommon/forms/widgets/nearby-forms.html
+++ b/templates/qommon/forms/widgets/nearby-forms.html
@@ -11,15 +11,15 @@
   data-readonly="true"
   {% for key, value in widget.map_attributes.items %}{{key}}="{{value}}" {% endfor %}
   {% localize off %}
-  data-init-lat="{{ form_var_carte_lat }}"
-  data-init-lng="{{ form_var_carte_lon }}"
+  data-init-lat="{{ global_context.form_var_carte_lat }}"
+  data-init-lng="{{ global_context.form_var_carte_lon }}"
   {% endlocalize %}
 ></div>
 {% block list-header %}
   <h3>Si votre signalement ne figure pas dans la liste ci-dessous, continuez</h3>
 {% endblock %}
 <ul class="nearby-forms">
-  {% with distance=form_option_distance|default:100|add:50 %}
+  {% with distance=global_context.form_option_distance|default:100|add:50 %}
   {% with demands=form.objects.pending|distance_filter:distance %}
   {% for formdata in demands %}
       <li data-id="{{formdata.number}}" class="nearby-form"
diff --git a/templates/qommon/forms/widgets/pieces-daact-cartads.html b/templates/qommon/forms/widgets/pieces-daact-cartads.html
index 7a7268c6..d911e5fe 100644
--- a/templates/qommon/forms/widgets/pieces-daact-cartads.html
+++ b/templates/qommon/forms/widgets/pieces-daact-cartads.html
@@ -1,7 +1,7 @@
 {% extends "qommon/forms/widgets/comment.html" %}
 
 {% block widget-content %}
-{% if form_var_dossier_tracking_code %}
+{% if global_context.form_var_dossier_tracking_code %}
 {% with webservice.cartads_pieces_daact.data as pieces %}
 {% for piece in pieces %}
   {% include "qommon/forms/widgets/includes/cartads-piece.html" with piece=piece grid="grid-1-3" only %}
diff --git a/templates/qommon/forms/widgets/pieces-doc-cartads.html b/templates/qommon/forms/widgets/pieces-doc-cartads.html
index f8336de9..b9a06005 100644
--- a/templates/qommon/forms/widgets/pieces-doc-cartads.html
+++ b/templates/qommon/forms/widgets/pieces-doc-cartads.html
@@ -1,7 +1,7 @@
 {% extends "qommon/forms/widgets/comment.html" %}
 
 {% block widget-content %}
-{% if form_var_dossier_tracking_code %}
+{% if global_context.form_var_dossier_tracking_code %}
 {% with webservice.cartads_pieces_doc.data as pieces %}
 {% for piece in pieces %}
   {% include "qommon/forms/widgets/includes/cartads-piece.html" with piece=piece grid="grid-1-3" only %}
diff --git a/templates/variants/toodego/qommon/forms/widgets/nearby-list.html b/templates/variants/toodego/qommon/forms/widgets/nearby-list.html
index 78a71874..f6a11878 100644
--- a/templates/variants/toodego/qommon/forms/widgets/nearby-list.html
+++ b/templates/variants/toodego/qommon/forms/widgets/nearby-list.html
@@ -15,14 +15,14 @@ map field, optional, with template-nearby-list in "css extra classes".
   data-readonly="true"
   {% for key, value in widget.map_attributes.items %}{{key}}="{{value}}" {% endfor %}
   {% localize off %}
-  data-init-lat="{{ form_var_carte_lat }}"
-  data-init-lng="{{ form_var_carte_lon }}"
+  data-init-lat="{{ global_context.form_var_carte_lat }}"
+  data-init-lng="{{ global_context.form_var_carte_lon }}"
   {% endlocalize %}
 ></div>
 
 <h3>Si votre signalement ne figure pas dans la liste ci-dessous, continuez</h3>
 <div id="nearby-list">
-{% with distance=form_option_distance|default:100|add:50 %}
+{% with distance=global_context.form_option_distance|default:100|add:50 %}
 {% with demands=form.objects.pending|distance_filter:distance %}
   {% for formdata in demands %}
       <div data-id="{{formdata.number}}" style="display: none"
diff --git a/templates/variants/toodego/qommon/forms/widgets/pn-notifications.html b/templates/variants/toodego/qommon/forms/widgets/pn-notifications.html
index caa54bcd..fac364e3 100644
--- a/templates/variants/toodego/qommon/forms/widgets/pn-notifications.html
+++ b/templates/variants/toodego/qommon/forms/widgets/pn-notifications.html
@@ -1,4 +1,4 @@
-{% if cards|objects:"pn_message"|with_custom_view:"publies-sur-les-formulaires"|count > 0 %}{% for fiche in cards|objects:"pn_message"|with_custom_view:"publies-sur-les-formulaires" %}{% if form_option_type_notification_raw in fiche|get:"typeformulairemulti" %}
+{% if cards|objects:"pn_message"|with_custom_view:"publies-sur-les-formulaires"|count > 0 %}{% for fiche in cards|objects:"pn_message"|with_custom_view:"publies-sur-les-formulaires" %}{% if global_context.form_option_type_notification_raw in fiche|get:"typeformulairemulti" %}
     {% if fiche|get:"priseencompte" == "Non" %}
     {% include "qommon/forms/widgets/pn-single-notification.html" with refimgc="refimgdefaut" %}
     {% endif %}
-- 
2.37.2

