From 05f4e2ae83082a57499f52f53e18950296c77140 Mon Sep 17 00:00:00 2001 From: Mike Chambers Date: Tue, 30 Apr 2024 10:36:02 +0100 Subject: [PATCH 1/3] Update LegacyMapConfig.cs to allow string or int zoom value --- .../Models/Legacy/LegacyMapConfig.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs b/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs index 4fb2c53..172c2fb 100644 --- a/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs +++ b/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs @@ -9,8 +9,20 @@ internal class LegacyMapConfig : MapConfig [JsonPropertyName("mapcenter")] public string MapCenter { get; set; } + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public new string Zoom { get; set; } + [JsonProperty("zoom")] [JsonPropertyName("zoom")] - public new string Zoom { get; set; } + public object _value + { + get + { + if (int.TryParse(Zoom, out var intValue)) return intValue; + return this.Zoom; + } + set { this.Zoom = value.ToString(); } + } } } From 0e9929c89df0d36109cfd5247ed950d1aca686d4 Mon Sep 17 00:00:00 2001 From: Robert Foster Date: Sat, 14 Dec 2024 21:51:03 +1100 Subject: [PATCH 2/3] Fixes for issues #182 and #179 --- ...v9.cs => ServerVariablesParsingHandler.cs} | 0 .../Models/Legacy/LegacyMap.cs | 4 +-- .../Models/Legacy/LegacyMapConfig.cs | 29 ++++++++++++++++++- Our.Umbraco.GMaps.Core/Models/MapType.cs | 2 +- .../Our.Umbraco.GMaps.Core.csproj | 4 +-- .../SingleMapPropertyValueConverter.cs | 4 +++ .../Our.Umbraco.GMaps.UmbracoV13.csproj | 2 +- Our.Umbraco.GMaps/Our.Umbraco.GMaps.csproj | 4 +-- .../wwwroot/js/maps.controller.js | 3 +- Our.Umbraco.GMaps/wwwroot/js/maps.factory.js | 2 +- 10 files changed, 43 insertions(+), 11 deletions(-) rename Our.Umbraco.GMaps.Core/Composing/{ServerVariablesParsingHandler.v9.cs => ServerVariablesParsingHandler.cs} (100%) diff --git a/Our.Umbraco.GMaps.Core/Composing/ServerVariablesParsingHandler.v9.cs b/Our.Umbraco.GMaps.Core/Composing/ServerVariablesParsingHandler.cs similarity index 100% rename from Our.Umbraco.GMaps.Core/Composing/ServerVariablesParsingHandler.v9.cs rename to Our.Umbraco.GMaps.Core/Composing/ServerVariablesParsingHandler.cs diff --git a/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMap.cs b/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMap.cs index b24fed7..d315da9 100644 --- a/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMap.cs +++ b/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMap.cs @@ -9,12 +9,12 @@ internal class LegacyMap [DataMember(Name = "address")] [JsonProperty("address")] [JsonPropertyName("address")] - internal LegacyAddress Address { get; set; } + public LegacyAddress Address { get; set; } [DataMember(Name = "mapconfig")] [JsonProperty("mapconfig")] [JsonPropertyName("mapconfig")] - internal LegacyMapConfig MapConfig { get; set; } + public LegacyMapConfig MapConfig { get; set; } } } \ No newline at end of file diff --git a/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs b/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs index 172c2fb..d59ba2b 100644 --- a/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs +++ b/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs @@ -15,7 +15,7 @@ internal class LegacyMapConfig : MapConfig [JsonProperty("zoom")] [JsonPropertyName("zoom")] - public object _value + public object _zoom { get { @@ -24,5 +24,32 @@ public object _value } set { this.Zoom = value.ToString(); } } + + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public new MapType MapType { get; set; } + + [JsonProperty("maptype")] + [JsonPropertyName("maptype")] + public new object _mapType + { + get + { + return this.MapType; + //return base.MapType?.ToString().ToLower(); + } + set { + this.MapType = value switch + { + "roadmap" => Models.MapType.Roadmap, + "satellite" => Models.MapType.Satellite, + "hybrid" => Models.MapType.Hybrid, + "terrain" => Models.MapType.Terrain, + "styled_map" => Models.MapType.StyledMap, + "styled map" => Models.MapType.StyledMap, + _ => Models.MapType.Roadmap, + }; + } + } } } diff --git a/Our.Umbraco.GMaps.Core/Models/MapType.cs b/Our.Umbraco.GMaps.Core/Models/MapType.cs index aa857ae..52ce667 100644 --- a/Our.Umbraco.GMaps.Core/Models/MapType.cs +++ b/Our.Umbraco.GMaps.Core/Models/MapType.cs @@ -16,6 +16,6 @@ public enum MapType [EnumMember(Value = "terrain")] Terrain, [EnumMember(Value = "styled_map")] - StyledMap + StyledMap } } \ No newline at end of file diff --git a/Our.Umbraco.GMaps.Core/Our.Umbraco.GMaps.Core.csproj b/Our.Umbraco.GMaps.Core/Our.Umbraco.GMaps.Core.csproj index 5418126..3aced0c 100644 --- a/Our.Umbraco.GMaps.Core/Our.Umbraco.GMaps.Core.csproj +++ b/Our.Umbraco.GMaps.Core/Our.Umbraco.GMaps.Core.csproj @@ -1,9 +1,9 @@  - net6.0;net7.0 + net6.0;net7.0;net8.0 True - 3.0.2 + 3.0.3 Arnold Visser Arnold Visser Basic Google Maps with autocomplete property editor for Umbraco 8+. This package contains the Core DLL only. diff --git a/Our.Umbraco.GMaps.Core/PropertyValueConverter/SingleMapPropertyValueConverter.cs b/Our.Umbraco.GMaps.Core/PropertyValueConverter/SingleMapPropertyValueConverter.cs index 557d739..617701d 100644 --- a/Our.Umbraco.GMaps.Core/PropertyValueConverter/SingleMapPropertyValueConverter.cs +++ b/Our.Umbraco.GMaps.Core/PropertyValueConverter/SingleMapPropertyValueConverter.cs @@ -54,6 +54,10 @@ public override object ConvertIntermediateToObject(IPublishedElement owner, IPub { model.MapConfig.Zoom = string.IsNullOrEmpty(intermediate.MapConfig.Zoom) ? 17 : Convert.ToInt32(intermediate.MapConfig.Zoom); } + if (model.MapConfig.MapType == null) + { + model.MapConfig.MapType = intermediate.MapConfig.MapType; + } } else { diff --git a/Our.Umbraco.GMaps.UmbracoV13/Our.Umbraco.GMaps.UmbracoV13.csproj b/Our.Umbraco.GMaps.UmbracoV13/Our.Umbraco.GMaps.UmbracoV13.csproj index 0f6dede..b0feb70 100644 --- a/Our.Umbraco.GMaps.UmbracoV13/Our.Umbraco.GMaps.UmbracoV13.csproj +++ b/Our.Umbraco.GMaps.UmbracoV13/Our.Umbraco.GMaps.UmbracoV13.csproj @@ -6,7 +6,7 @@ - + diff --git a/Our.Umbraco.GMaps/Our.Umbraco.GMaps.csproj b/Our.Umbraco.GMaps/Our.Umbraco.GMaps.csproj index 8397596..4db4aa0 100644 --- a/Our.Umbraco.GMaps/Our.Umbraco.GMaps.csproj +++ b/Our.Umbraco.GMaps/Our.Umbraco.GMaps.csproj @@ -1,13 +1,13 @@  - net6.0;net7.0 + net6.0;net7.0;net8.0 App_Plugins/Our.Umbraco.GMaps true . false true - 3.0.2 + 3.0.3 Arnold Visser Arnold Visser Basic Google Maps with autocomplete property editor for Umbraco 8+ diff --git a/Our.Umbraco.GMaps/wwwroot/js/maps.controller.js b/Our.Umbraco.GMaps/wwwroot/js/maps.controller.js index 1b51f9d..00c3032 100644 --- a/Our.Umbraco.GMaps/wwwroot/js/maps.controller.js +++ b/Our.Umbraco.GMaps/wwwroot/js/maps.controller.js @@ -260,6 +260,7 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element var mapOptions = { zoom: vm.zoomLevel, + mapId: 'DEMO_MAP_ID', center: latLngMapCenter, streetViewControl: false, // Fix for #15 gestureHandling: 'cooperative', @@ -281,7 +282,7 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element vm.map.setMapTypeId(mapTypeId) - vm.marker = new google.maps.Marker({ + vm.marker = new google.maps.marker.AdvancedMarkerElement({ position: latLng, title: 'Marker', map: vm.map, diff --git a/Our.Umbraco.GMaps/wwwroot/js/maps.factory.js b/Our.Umbraco.GMaps/wwwroot/js/maps.factory.js index 9d5ab7a..5627ef0 100644 --- a/Our.Umbraco.GMaps/wwwroot/js/maps.factory.js +++ b/Our.Umbraco.GMaps/wwwroot/js/maps.factory.js @@ -10,7 +10,7 @@ return { initialize: function (apiKey) { - var url = 'https://maps.googleapis.com/maps/api/js?key=' + apiKey + '&libraries=places&callback=googleMapsInitialized'; + var url = 'https://maps.googleapis.com/maps/api/js?key=' + apiKey + '&libraries=places&libraries=marker&callback=googleMapsInitialized&v=weekly'; if (!scriptExists(url)) { var script = document.createElement('script'); script.async = true; From beb3a2725e130f4be2c631c4fe677df5630dbcc9 Mon Sep 17 00:00:00 2001 From: Robert Foster Date: Sat, 14 Dec 2024 21:56:01 +1100 Subject: [PATCH 3/3] Upgraded git actions/upload-artifact --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a4fa538..e5461bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,7 @@ jobs: # https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/7.0/solution-level-output-no-longer-valid - name: Upload artifacts - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: nuget path: ${{ env.OUTPUT_PATH }} \ No newline at end of file