From e03005ed568369c97fd1a369a05b2cafe237c8c4 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Mon, 25 May 2020 13:52:56 +0200 Subject: [PATCH 1/3] Fix maps and tidy up groups map code --- .../darkswarm/controllers/group_page_controller.js.coffee | 5 +---- app/views/groups/show.html.haml | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/darkswarm/controllers/group_page_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/group_page_controller.js.coffee index 7b44cb749b..ff7a695777 100644 --- a/app/assets/javascripts/darkswarm/controllers/group_page_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/group_page_controller.js.coffee @@ -1,6 +1,3 @@ -Darkswarm.controller "GroupPageCtrl", ($scope, enterprises, Enterprises, MapConfiguration, OfnMap) -> +Darkswarm.controller "GroupPageCtrl", ($scope, enterprises, Enterprises) -> $scope.Enterprises = Enterprises - - $scope.map = angular.copy MapConfiguration.options - $scope.mapMarkers = OfnMap.enterprise_markers enterprises $scope.embedded_layout = window.location.search.indexOf("embedded_shopfront=true") != -1 diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index e8318faef9..654dfac11e 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -33,11 +33,11 @@ active: "tabs.map.active", select: "select(\'map\')"} .map-container - %map{"ng-if" => "(isActive(\'/map\') && (mapShowed = true)) || mapShowed"} + %map{"ng-controller" => "MapCtrl", "ng-if" => "(isActive(\'/map\') && (mapShowed = true)) || mapShowed"} %ui-gmap-google-map{options: "map.additional_options", center: "map.center", zoom: "map.zoom", styles: "map.styles", draggable: "true"} %map-osm-tiles %map-search - %ui-gmap-markers{models: "mapMarkers", fit: "true", + %ui-gmap-markers{models: "OfnMap.enterprises", fit: "true", coords: "'self'", icon: "'icon'", click: "'reveal'"} %tab{heading: t(:groups_about), From a3660dfe377d9577706970dee6817d23582eef2e Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Mon, 25 May 2020 14:04:11 +0200 Subject: [PATCH 2/3] Extract repeated map code to new partial --- app/views/groups/show.html.haml | 9 ++------- app/views/map/index.html.haml | 8 +------- app/views/shared/_map.html.haml | 8 ++++++++ 3 files changed, 11 insertions(+), 14 deletions(-) create mode 100644 app/views/shared/_map.html.haml diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index 654dfac11e..fba9eb9005 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -32,13 +32,8 @@ %tab{heading: t(:label_map), active: "tabs.map.active", select: "select(\'map\')"} - .map-container - %map{"ng-controller" => "MapCtrl", "ng-if" => "(isActive(\'/map\') && (mapShowed = true)) || mapShowed"} - %ui-gmap-google-map{options: "map.additional_options", center: "map.center", zoom: "map.zoom", styles: "map.styles", draggable: "true"} - %map-osm-tiles - %map-search - %ui-gmap-markers{models: "OfnMap.enterprises", fit: "true", - coords: "'self'", icon: "'icon'", click: "'reveal'"} + %div{"ng-if" => "(isActive(\'/map\') && (mapShowed = true)) || mapShowed"} + = render partial: "shared/map" %tab{heading: t(:groups_about), active: "tabs.about.active", diff --git a/app/views/map/index.html.haml b/app/views/map/index.html.haml index 294fa45f8e..6f50bf757c 100644 --- a/app/views/map/index.html.haml +++ b/app/views/map/index.html.haml @@ -4,13 +4,7 @@ - content_for :injection_data do = inject_enterprise_shopfront_list -.map-container{"fill-vertical" => true} - %map{"ng-controller" => "MapCtrl"} - %ui-gmap-google-map{options: "map.additional_options", center: "map.center", zoom: "map.zoom", styles: "map.styles", draggable: "true"} - %map-osm-tiles - %map-search - %ui-gmap-markers{models: "OfnMap.enterprises", fit: "true", - coords: "'self'", icon: "'icon'", click: "'reveal'"} += render partial: "shared/map" .map-footer %a{:href => "http://www.openstreetmap.org/copyright"} © OpenStreetMap contributors diff --git a/app/views/shared/_map.html.haml b/app/views/shared/_map.html.haml new file mode 100644 index 0000000000..6f8016c81e --- /dev/null +++ b/app/views/shared/_map.html.haml @@ -0,0 +1,8 @@ +.map-container + %map{"ng-controller" => "MapCtrl"} + %ui-gmap-google-map{options: "map.additional_options", center: "map.center", zoom: "map.zoom", + styles: "map.styles", draggable: "true"} + %map-osm-tiles + %map-search + %ui-gmap-markers{models: "OfnMap.enterprises", fit: "true", + coords: "'self'", icon: "'icon'", click: "'reveal'"} From 80953713044577390be6be8ab5ce24263d8d92eb Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Mon, 25 May 2020 14:12:12 +0200 Subject: [PATCH 3/3] Ensure OpenStreetMap credits are aways shown with map and fix credits positioning for /groups page map display --- app/assets/stylesheets/darkswarm/map.css.scss | 5 +++++ app/views/map/index.html.haml | 3 --- app/views/shared/_map.html.haml | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/darkswarm/map.css.scss b/app/assets/stylesheets/darkswarm/map.css.scss index b0df5b66da..2af782f187 100644 --- a/app/assets/stylesheets/darkswarm/map.css.scss +++ b/app/assets/stylesheets/darkswarm/map.css.scss @@ -63,3 +63,8 @@ left: 0px; } } + +.tabs-content .map-footer { + position: relative; + bottom: 30px; +} diff --git a/app/views/map/index.html.haml b/app/views/map/index.html.haml index 6f50bf757c..9d074d31a9 100644 --- a/app/views/map/index.html.haml +++ b/app/views/map/index.html.haml @@ -5,6 +5,3 @@ = inject_enterprise_shopfront_list = render partial: "shared/map" - -.map-footer - %a{:href => "http://www.openstreetmap.org/copyright"} © OpenStreetMap contributors diff --git a/app/views/shared/_map.html.haml b/app/views/shared/_map.html.haml index 6f8016c81e..69f781a78c 100644 --- a/app/views/shared/_map.html.haml +++ b/app/views/shared/_map.html.haml @@ -6,3 +6,6 @@ %map-search %ui-gmap-markers{models: "OfnMap.enterprises", fit: "true", coords: "'self'", icon: "'icon'", click: "'reveal'"} + +.map-footer + %a{:href => "http://www.openstreetmap.org/copyright"} © OpenStreetMap contributors