From e86ca03c0f4d3df8656575d1d4932637f57865a4 Mon Sep 17 00:00:00 2001 From: Cy Messenger <cy@responsiveweb.nz> Date: Sat, 30 Apr 2022 09:49:28 +1200 Subject: [PATCH 1/2] Update Marker.php Hey team. I don't mind extending the plugin in my projects but it might be a nice idea to make at least the marker name and popup content conditionally translatable by default. --- models/Marker.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/models/Marker.php b/models/Marker.php index 5b1c9f4..b34c51a 100644 --- a/models/Marker.php +++ b/models/Marker.php @@ -30,6 +30,16 @@ class Marker extends Model implements AddressObjectInterface 'lat' => 'required|numeric', 'lon' => 'required|numeric' ]; + + /** + * @var translatable marker fields + */ + public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; + + public $translatable = [ + 'name', + 'popup_content' + ]; /** * @var array Guarded fields From 6fdf5523cf1411e86626c022d2ac25d9bf6d37d8 Mon Sep 17 00:00:00 2001 From: Cy Messenger <cy@responsiveweb.nz> Date: Fri, 19 Aug 2022 10:45:57 +1200 Subject: [PATCH 2/2] Add map reset button Button to take map back to default center and zoom --- components/partials/map.htm | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/components/partials/map.htm b/components/partials/map.htm index ebf8434..92769b0 100644 --- a/components/partials/map.htm +++ b/components/partials/map.htm @@ -1,4 +1,14 @@ -<div id="{{ __SELF__ ~ '-container' }}" class="leaflet-map"></div> +<div id="{{ __SELF__ ~ '-container' }}" class="leaflet-map"> + + <button onclick="{{ mapVar }}.setView(new L.LatLng({{ __SELF__.centerLatLon }}), {{ __SELF__.initialZoom }});" + href="javascript:void(0)" + class="leaflet-map-reset"> + <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"> + <path stroke-linecap="round" stroke-linejoin="round" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" /> + </svg> + </button> + +</div> {% partial __SELF__ ~ '::map-script' %} @@ -7,5 +17,19 @@ .leaflet-map { min-height: 800px; } + .leaflet-map-reset { + position: absolute; + bottom: 1.25rem; + z-index: 99999; + margin-left: .5rem; + padding: .25rem; + background-color: #ffffff; + border: 2px solid #cccccc; + border-radius: .375rem; + color: #000000; + } + .leaflet-map-reset:hover { + background-color: #f4f4f4; + } </style> -{% endput %} \ No newline at end of file +{% endput %}