File tree Expand file tree Collapse file tree 4 files changed +21
-35
lines changed
templates/components/produit Expand file tree Collapse file tree 4 files changed +21
-35
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -160,6 +160,15 @@ def assistant(self, **kwargs):
160
160
161
161
return template .render (Context ({}))
162
162
163
+ def assistant_with_epci (self , ** kwargs ):
164
+ template = Template (
165
+ f"""
166
+ <script src="{ settings .ASSISTANT ["BASE_URL" ]} /iframe.js" data-epci="200043123" data-objet="lave-linge"></script>
167
+ """
168
+ )
169
+
170
+ return template .render (Context ({}))
171
+
163
172
def assistant_without_referrer (self , ** kwargs ):
164
173
template = Template (
165
174
f"""
Original file line number Diff line number Diff line change @@ -3,17 +3,25 @@ import { URL_PARAM_NAME_FOR_IFRAME_SCRIPT_MODE } from "../js/helpers"
3
3
4
4
const script = document . currentScript as HTMLScriptElement
5
5
const slug = script ?. dataset ?. objet
6
+ const epci = script ?. dataset ?. epci
6
7
const origin = new URL ( script ?. getAttribute ( "src" ) ) . origin
7
8
8
9
function initScript ( ) {
9
10
const parts = [ origin ]
10
11
const iframeResizerOptions = { license : "GPLv3" }
12
+
11
13
if ( slug ) {
12
14
parts . push ( "dechet" , slug )
13
15
}
14
- parts . push ( `?iframe&${ URL_PARAM_NAME_FOR_IFRAME_SCRIPT_MODE } =1` )
15
- const src = parts . join ( "/" )
16
16
17
+ const searchParams = new URLSearchParams ( )
18
+ if ( epci ) {
19
+ searchParams . set ( "epci" , epci )
20
+ }
21
+
22
+ searchParams . set ( "iframe" , "" )
23
+ searchParams . set ( URL_PARAM_NAME_FOR_IFRAME_SCRIPT_MODE , "1" )
24
+ const src = `${ parts . join ( "/" ) } ?${ searchParams . toString ( ) } `
17
25
const iframe = document . createElement ( "iframe" )
18
26
const iframeAttributes = {
19
27
src,
@@ -31,6 +39,7 @@ function initScript() {
31
39
if ( debugReferrer ) {
32
40
iframeAttributes . referrerPolicy = "no-referrer"
33
41
}
42
+
34
43
for ( var key in iframeAttributes ) {
35
44
iframe . setAttribute ( key , iframeAttributes [ key ] )
36
45
}
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ <h2 class="qf-mb-0">Où l'apporter ?</h2>
25
25
id ="{{ id }} "
26
26
allow ="geolocation; clipboard-write "
27
27
class ="qf-h-full qf-w-full "
28
- src ="{{ url_carte|default:produit.synonymes.first.url_carte }} ">
28
+ src ="{{ url_carte|default:produit.synonymes.first.url_carte }}{% if epci in request.GET %}&epci_codes={{ request.GET.epci }}{% endif %} ">
29
29
</ turbo-frame >
30
30
</ div >
31
31
</ section >
You can’t perform that action at this time.
0 commit comments