Skip to content

Commit

Permalink
load map attribution from settings
Browse files Browse the repository at this point in the history
  • Loading branch information
goapunk authored and fuzzylogic2000 committed May 4, 2023
1 parent 38ee2fb commit 006e908
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bplan/assets/js/app/components/map/mapControllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ angular.module('app.map.controllers', [])
$scope.places = PlacesService;

$scope.baseurl = map_baseurl;
$scope.attribution = map_attribution;
$scope.polygons = {};
$scope.polygons.aul = {};
$scope.polygons.bbg = {};
Expand Down Expand Up @@ -144,7 +145,7 @@ angular.module('app.map.controllers', [])
}
}).addTo(map)

map.attributionControl.setPrefix('<a href=\"https://www.maptiler.com/copyright/\" target=\"_blank\">&copy; MapTiler</a> <a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\">&copy; OpenStreetMap contributors</a>');
map.attributionControl.setPrefix($scope.attribution);

$scope.districtMarkers = L.layerGroup();

Expand Down
1 change: 1 addition & 0 deletions bplan/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
area = "{% block area %}{% endblock %}";
afs_behoer = "{{ afs_behoer }}";
map_baseurl = "{{ map_baseurl }}";
map_attribution = "{{ map_attribution }}";
</script>
</head>

Expand Down
4 changes: 3 additions & 1 deletion bplan/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['afs_behoer'] = self.request.GET.get('afs_behoer', '')
context['map_baseurl'] = settings.MAP_BASEURL
context['map_attribution'] = settings.MAP_ATTRIBUTION
return context


Expand All @@ -36,8 +37,9 @@ def dispatch(self, *args, **kwargs):

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['map_baseurl'] = settings.MAP_BASEURL
context['afs_behoer'] = self.request.GET.get('afs_behoer', '')
context['map_baseurl'] = settings.MAP_BASEURL
context['map_attribution'] = settings.MAP_ATTRIBUTION
return context


Expand Down
3 changes: 3 additions & 0 deletions django_zbp/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,6 @@
CORS_ORIGIN_ALLOW_ALL = True
CORS_URLS_REGEX = r'^/api/addresses/.*$'
MAP_BASEURL = "https://basemap.berlin.de/gdz_basemapde_vektor/styles/bm_web_col.json"
MAP_ATTRIBUTION = (
'© 2023 basemap.de / BKG | Datenquellen: © GeoBasis-DE'
)

0 comments on commit 006e908

Please sign in to comment.