Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos-tav
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
agplv3
kohinos-tav
Commits
05e11820
Commit
05e11820
authored
Mar 18, 2026
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Homepage map: add filters to display prestataire from specifif rubriques
parent
0f72de5c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
4 deletions
+59
-4
carte.html.twig
templates/themes/kohinos/presta/block/carte.html.twig
+5
-0
cartejs.html.twig
templates/themes/kohinos/presta/block/cartejs.html.twig
+54
-4
No files found.
templates/themes/kohinos/presta/block/carte.html.twig
View file @
05e11820
...
...
@@ -5,3 +5,7 @@
<h4><i
class=
"fa fa-map"
></i>
{{
title
}}
</h4>
</div>
<div
id=
"
{{
id
}}
"
style=
"
{{
style
}}
"
class=
'my-3'
></div>
<div>
<button
class=
"btn btn-primary"
id=
"map-filter-food-shops"
>
Commerces alimentaires
</button>
<button
class=
"btn btn-primary"
id=
"map-filter-markets"
>
Marchés
</button>
</div>
\ No newline at end of file
templates/themes/kohinos/presta/block/cartejs.html.twig
View file @
05e11820
{%
set
idmap
=
id
|
default
(
'mapid'
)
%}
{%
set
prestataires
=
getAllPrestataires
()
%}
<script>
var
mymap
=
null
;
var
mapFilters
=
[];
$
(
function
()
{
$
(
'[data-toggle="tooltip"]'
).
tooltip
()
if
(
$
(
'#
{{
idmap
}}
'
).
length
)
{
var
mymap
=
L
.
map
(
'
{{
idmap
}}
'
).
setView
(
{{
KOH_MAP_CENTER
}}
,
{{
KOH_MAP_ZOOM
}}
);
$
(
'[data-toggle="tooltip"]'
).
tooltip
();
function
drawMap
()
{
if
(
$
(
'#
{{
idmap
}}
'
).
length
)
{
mymap
=
L
.
map
(
'
{{
idmap
}}
'
).
setView
(
{{
KOH_MAP_CENTER
}}
,
{{
KOH_MAP_ZOOM
}}
);
L
.
tileLayer
(
'https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png'
,
{
maxZoom
:
18
,
attribution
:
'© Openstreetmap France | © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).
addTo
(
mymap
);
{# AJOUTER L
ES MARQUEURS SUR LA CARTE #}
{# AJOUT D
ES MARQUEURS SUR LA CARTE #}
{%
set
count
=
1
%}
{%
for
presta
in
prestataires
%}
{%
if
presta.geolocs
|
length
>
0
%}
{%
for
geolocp
in
presta.geolocs
%}
{%
if
geolocp.enabled
and
geolocp.geoloc.lat
!=
null
and
geolocp.geoloc.lon
!=
null
%}
var
prestaRubriquesCount
=
parseInt
(
'
{{
presta.rubriques
|
length
}}
'
);
var
prestaRubriqueSlug
=
prestaRubriquesCount
>
0
?
'
{{
presta.rubriques.first.slug
}}
'
:
''
;
if
(
mapFilters
.
length
===
0
||
mapFilters
.
length
>
0
&&
mapFilters
.
includes
(
prestaRubriqueSlug
)
)
{
{%
if
presta.rubriques
|
length
>
0
and
presta.rubriques.first.media
is
not
null
%}
var
iconClassName
=
'kohinos-map-icon'
;
{%
if
date
(
presta.getCreatedAt
())
>
date
(
'-2months'
)
%}
...
...
@@ -45,10 +57,48 @@
{%
endfor
%}
{%
endspaceless
%}
"
);
{%
set
count
=
count
+
1
%}
}
{%
endif
%}
{%
endfor
%}
{%
endif
%}
{%
endfor
%}
}
}
drawMap
();
if
(
$
(
'#map-filter-food-shops'
).
length
)
{
$
(
'#map-filter-food-shops'
).
click
(()
=>
{
let
index
=
mapFilters
.
indexOf
(
'commerce-alimentaire'
);
if
(
index
===
-
1
)
{
mapFilters
.
push
(
'commerce-alimentaire'
);
$
(
'#map-filter-food-shops'
).
removeClass
(
'btn-primary'
).
addClass
(
'btn-success'
);
}
else
{
mapFilters
.
splice
(
index
,
1
);
$
(
'#map-filter-food-shops'
).
addClass
(
'btn-primary'
).
removeClass
(
'btn-success'
);
}
// Redraw map
mymap
.
remove
();
drawMap
();
});
}
if
(
$
(
'#map-filter-markets'
).
length
)
{
$
(
'#map-filter-markets'
).
click
(()
=>
{
let
index
=
mapFilters
.
indexOf
(
'marches-amap'
);
if
(
index
===
-
1
)
{
mapFilters
.
push
(
'marches-amap'
);
$
(
'#map-filter-markets'
).
removeClass
(
'btn-primary'
).
addClass
(
'btn-success'
);
}
else
{
mapFilters
.
splice
(
index
,
1
);
$
(
'#map-filter-markets'
).
addClass
(
'btn-primary'
).
removeClass
(
'btn-success'
);
}
// Redraw map
mymap
.
remove
();
drawMap
();
});
}
})
</script>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment