Changes for page Homeopaths

Last modified by Jip-jan Alunkel on March 14, 20:13

From version 8.83
edited by Jip-jan Alunkel
on December 08, 16:38
Change comment: Renamed from xwiki:practices.WebHome
To version 8.96
edited by Jip-jan Alunkel
on December 08, 18:38
Change comment: Renamed from xwiki:practices.WebHome

Summary

Details

Page properties
Content
... ... @@ -87,7 +87,7 @@
87 87   "data-create-xobj" : "true",
88 88   "data-xobj-classname" : "homeopaths.Code.homeopathsClass",
89 89   "data-xobj-fieldname" : "address",
90 - "help-block" : 'Input and select the address of your practice.'
90 + "help-block" : 'Input street and number and select the address of your practice.'
91 91  })
92 92  #createFormElement($address)
93 93  #set($submit = {
XWiki.JavaScriptExtension[0]
Code
... ... @@ -5,3 +5,48 @@
5 5   }).addTo(map);
6 6   map.attributionControl.setPrefix('');
7 7  
8 + #set($query = $services.query.xwql("from doc.object('homeopaths.Code.homeopathsClass') as homeopathObj"))
9 + #set($result = $query.execute())
10 + #set($map = {})
11 + #foreach($item in $result)
12 + #set($result_doc = $xwiki.getDocument("${item}"))
13 + #set($result_obj = $result_doc.getObject("homeopaths.Code.homeopathsClass"))
14 + #set($addressArray = $result_obj.getProperty("address").value.split(","))
15 + #set($address = "")
16 + #foreach($address_item in $addressArray)
17 + #if($foreach.hasNext)
18 + #set($linebreak = "<br />")
19 + #else
20 + #set($linebreak = "")
21 + #end
22 + #set($address = "${address}${address_item.trim()}${linebreak}")
23 + #end
24 + #set($info = "<h4><a href='$xwiki.getURL($result_doc.documentReference)'>${stringtool.capitalize($result_doc.documentReference.getName())}</a></h4><address>${address}</address>")
25 + #set($discard = $map.put($info, $result_obj.getProperty("latlong").value))
26 + #end
27 + #if($objecttool.allNull($map))
28 + #set($mapJSON = {})
29 + #else
30 + #set($mapJSON = $jsontool.serialize(${map}))
31 + #end
32 +
33 + var mapJSON = $jsontool.parse($mapJSON),
34 + markers = [];
35 + for(const property in mapJSON) {
36 + let latlong = mapJSON[property].split("/"),
37 + lat = latlong[0],
38 + long = latlong[1],
39 + latlongArray = [long, lat, property];
40 + markers.push(latlongArray)
41 + }
42 +
43 + for (var i=0; i<markers.length; i++) {
44 + let lon = markers[i][0],
45 + lat = markers[i][1],
46 + popupText = markers[i][2],
47 + markerLocation = new L.LatLng(lat, lon),
48 + marker = new L.Marker(markerLocation);
49 + map.addLayer(marker);
50 + marker.bindPopup(popupText);
51 + }
52 +
XWiki.StyleSheetExtension[0]
Code
... ... @@ -4,7 +4,10 @@
4 4   height: 400px;
5 5   margin: 0 2rem;
6 6  }
7 -.leaflet-popup-content {
7 +#homeopaths_map .leaflet-popup {
8 + min-width: 26rem;
9 +}
10 +#homeopaths_map .leaflet-popup-content {
8 8   margin: 0;
9 9   line-height: unset;
10 10   font-size: unset;
... ... @@ -14,5 +14,9 @@
14 14   margin-top: 2rem;
15 15  }
16 16  .leaflet-popup-content address {
17 -
20 + font-size: 1.2rem;
21 + margin: 0 2rem 1.5rem 2rem;
18 18  }
23 +body.preference-underlining-only-inline-links #homeopaths_map a {
24 + text-decoration: none;
25 +}