From 7c09523e538d929f839cd0934d303bbff38677ca Mon Sep 17 00:00:00 2001 From: baldo Date: Thu, 14 Jul 2016 16:28:17 +0200 Subject: [PATCH] Config option for tile layers. See: https://github.com/freifunkhamburg/ffffng/issues/23 --- Gruntfile.js | 6 ++++++ app/scripts/directives/nodeForm.js | 15 ++------------- app/styles/views/directives/_nodeForm.scss | 18 +++++++++++++++++- app/views/directives/nodeForm.html | 2 +- config.json.example | 3 ++- server/config.js | 3 ++- 6 files changed, 30 insertions(+), 17 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 5b571c8..9b81afb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -342,6 +342,12 @@ module.exports = function (grunt) { 'fonts/*' ] }, + { + expand: true, + cwd: '<%= yeoman.app %>/bower_components/leaflet-dist/images', + dest: '<%= yeoman.dist %>/client/styles/images', + src: ['*.png'] + }, { expand: true, cwd: '.tmp/images', diff --git a/app/scripts/directives/nodeForm.js b/app/scripts/directives/nodeForm.js index 8b1f41f..30d587b 100644 --- a/app/scripts/directives/nodeForm.js +++ b/app/scripts/directives/nodeForm.js @@ -29,20 +29,9 @@ angular.module('ffffng') zoom: config.coordsSelector.defaultZoom }, markers: {}, + hasMultipleLayers: _.size(config.coordsSelector.layers) > 1, layers: { - baselayers: { - osm: { - name: 'MapQuest (OSM)', - url: 'https://otile{s}-s.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg', - type: 'xyz', - layerOptions: { - subdomains: '1234', - attribution: - 'Tiles © MapQuest, ' + - 'Data CC-BY-SA OpenStreetMap' - } - } - } + baselayers: config.coordsSelector.layers } }; diff --git a/app/styles/views/directives/_nodeForm.scss b/app/styles/views/directives/_nodeForm.scss index 5fd2357..4f3bd1c 100644 --- a/app/styles/views/directives/_nodeForm.scss +++ b/app/styles/views/directives/_nodeForm.scss @@ -123,9 +123,25 @@ f-node-form { margin-top: 5px; margin-bottom: 20px; - .leaflet-control-layers.leaflet-control { + &.map-hide-layers-control .leaflet-control-layers.leaflet-control { display: none; } + + // reset styling from bootstrap as it breaks the layer control + .leaflet-control-layers { + input { + display: initial; + border: initial; + box-shadow: initial; + width: initial; + height: initial; + } + + input, label { + margin: initial; + padding: initial; + } + } } .buttons { diff --git a/app/views/directives/nodeForm.html b/app/views/directives/nodeForm.html index f10746c..87e117e 100644 --- a/app/views/directives/nodeForm.html +++ b/app/views/directives/nodeForm.html @@ -59,7 +59,7 @@