Skip to content

Commit

Permalink
Merge pull request #118 from ArnoldV/develop
Browse files Browse the repository at this point in the history
Release 2.1.0
  • Loading branch information
robertjf committed Jul 2, 2022
2 parents 4749434 + aa98772 commit 8ec42d5
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Our.Umbraco.GMaps.Core/Models/MapConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class MapConfig

[DataMember(Name = "zoom")]
[JsonProperty("zoom")]
public string Zoom { get; set; }
public int Zoom { get; set; }

[DataMember(Name = "centerCoordinates")]
[JsonProperty("centerCoordinates")]
Expand Down
2 changes: 1 addition & 1 deletion Our.Umbraco.GMaps.Core/Our.Umbraco.GMaps.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFrameworks>net5.0;net472</TargetFrameworks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>

<Version>2.0.7</Version>
<Version>2.1.0</Version>
<Authors>Arnold Visser</Authors>
<Company>Arnold Visser</Company>
<Description>Basic Google Maps with autocomplete property editor for Umbraco 8+. This package contains the Core DLL only.</Description>
Expand Down
59 changes: 59 additions & 0 deletions Our.Umbraco.GMaps.UmbracoV10/Controllers/MapTestController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Our.Umbraco.GMaps.Models;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Web.Common.Controllers;

namespace Our.Umbraco.GMaps.UmbracoV10.Controllers
{
public class MapTestController : UmbracoApiController
{
private readonly IContentService contentService;

public MapTestController(IContentService contentService)
{
this.contentService = contentService;
}

public IActionResult CreateMapEntry()
{
double lat = -35.23989947459226;
double lng = 149.149934680426;
Map gmap = new()
{
Address = new Address
{
Coordinates = new Location
{
Latitude = lat,
Longitude = lng
}
},
MapConfig = new MapConfig
{
Zoom = 15,
CenterCoordinates = new Location
{
Latitude = lat,
Longitude = lng
}
}
};

string json = JsonConvert.SerializeObject(gmap);

//Hack to get zoom to an int. Probably bug that's a string in model.
//If a string the map won't show up and there is an error saying that zoom is not an int.
json = json.Replace("\"zoom\":\"15\"", "\"zoom\":15");

var testContent = contentService.GetRootContent();
foreach (var n in testContent)
{
n.SetValue("singleMap", json);
contentService.SaveAndPublish(n);
}

return Ok();
}
}
}
Binary file modified Our.Umbraco.GMaps.UmbracoV10/umbraco/Data/Umbraco.sqlite.db
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element
if (!coordinates) {
coordinates = $scope.address.coordinates
}
const mapCenterCoordinates = $scope.mapCenter
var mapCenterCoordinates = $scope.mapCenter
if (!mapCenterCoordinates) {
mapCenterCoordinates = coordinates
}
Expand All @@ -257,7 +257,7 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element
if (vm.mapType === 'styled_map' && !useMapStyle) {
mapTypeId = google.maps.MapTypeId.ROADMAP
}

var mapOptions = {
zoom: vm.zoomLevel,
center: latLngMapCenter,
Expand Down Expand Up @@ -339,11 +339,12 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element
// Set the map center as well.
$scope.mapCenter = coordTest
vm.marker.setPosition($scope.address.coordinates)
vm.map.setCenter($scope.address.coordinates)
vm.marker.setVisible(true)
vm.map.setCenter($scope.address.coordinates)
actResetCenter.isDisabled = true
} else {
initMapMarker($scope.address.coordinates)
}
initMapMarker($scope.address.coordinates)
return
} else {

Expand All @@ -370,7 +371,7 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element
}
// default zoom when set on data type config
if ($scope.model.config.zoom) {
vm.zoomLevel = $scope.model.config.zoom
vm.zoomLevel = +$scope.model.config.zoom
}
if ($scope.model.config.apikey) {
vm.apiKey = $scope.model.config.apikey
Expand Down Expand Up @@ -419,7 +420,7 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element
if ($scope.model.value.mapconfig) {

if ($scope.model.value.mapconfig.zoom) {
vm.zoomLevel = $scope.model.value.mapconfig.zoom
vm.zoomLevel = +$scope.model.value.mapconfig.zoom
}

if ($scope.model.value.mapconfig.maptype) {
Expand Down
2 changes: 1 addition & 1 deletion Our.Umbraco.GMaps/Our.Umbraco.GMaps.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<IncludeBuildOutput>false</IncludeBuildOutput>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

<Version>2.0.7</Version>
<Version>2.1.0</Version>
<Authors>Arnold Visser</Authors>
<Company>Arnold Visser</Company>
<Description>Basic Google Maps with autocomplete property editor for Umbraco 8+</Description>
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ PM> nuget pack Our.Umbraco.GMaps.Core\Our.Umbraco.GMaps.Core.csproj -Build
## Breaking Changes

- Coordinates in the strongly typed models are now represented using the `Location` object with individual `Latitude` and `Longitude` properties.
- `MapConfig.Zoom` is now an `int` as it should be (was a `string`)


## Change Log

- 2.1.0: Breaking change - `MapConfig.Zoom` is now an `int` as it should be (was a `string`).
- 2.0.7: Added ability to re-center the map via Editor Actions and can now directly input a set of coordinates.

## Demo site Umbraco Backoffice Login Details

Expand All @@ -90,4 +97,4 @@ Special thanks to:
- [prjseal](https://github.com/prjseal) for the Visual Studio project setup and included demo-site
- [robertjf](https://github.com/robertjf) for making the Umbraco 9 version a reality, accepting and testing PR's and setting up release automation

<a href="https://www.flaticon.com/free-icons/google-maps" title="google maps icons">Google maps icons created by Freepik - Flaticon</a>
[Google maps icons created by Freepik - Flaticon](https://www.flaticon.com/free-icons/google-maps)
8 changes: 7 additions & 1 deletion README.nuget.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

Basic Google Maps with autocomplete property editor for Umbraco 8+ including property value converter.

## Change Log

- 2.1.0: Breaking change - `MapConfig.Zoom` is now an `int` as it should be (was a `string`).
- 2.0.7: Added ability to re-center the map via Editor Actions and can now directly input a set of coordinates.

## Features

- Search for address using autocomplete and place marker
Expand Down Expand Up @@ -60,4 +65,5 @@ Special thanks to [prjseal](https://github.com/prjseal) for the Visual Studio pr

Special thanks to [robertjf](https://github.com/robertjf) for contributing to this project and setting up the Release Workflow #h5yr!

<a href="https://www.flaticon.com/free-icons/google-maps" title="google maps icons">Google maps icons created by Freepik - Flaticon</a>

[Google maps icons created by Freepik - Flaticon](https://www.flaticon.com/free-icons/google-maps)<a href="https://www.flaticon.com/free-icons/google-maps" title="google maps icons">Google maps icons created by Freepik - Flaticon</a>

0 comments on commit 8ec42d5

Please sign in to comment.