From 98753e427eab186671d3424151f738116aa6d29f Mon Sep 17 00:00:00 2001 From: Teofilo Sibileau Date: Fri, 30 Dec 2016 12:40:02 -0300 Subject: [PATCH 1/2] Fixes _setupMap reference of undefined class property --- src/view.map.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/view.map.js b/src/view.map.js index be837c2b..edac3d95 100644 --- a/src/view.map.js +++ b/src/view.map.js @@ -53,6 +53,7 @@ my.Map = Backbone.View.extend({ initialize: function(options) { var self = this; + this.options = options; this.visible = this.$el.is(':visible'); this.mapReady = false; // this will be the Leaflet L.Map object (setup below) From 3035b81c5fdb8c1ab0d67a98989afb07b46910e9 Mon Sep 17 00:00:00 2001 From: Teofilo Sibileau Date: Fri, 30 Dec 2016 12:50:49 -0300 Subject: [PATCH 2/2] Builds HEAD of the branch --- dist/recline.js | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/dist/recline.js b/dist/recline.js index 14d2fbfc..5e61af6a 100644 --- a/dist/recline.js +++ b/dist/recline.js @@ -1161,7 +1161,8 @@ my.Flot = Backbone.View.extend({ y = item.datapoint[0].toFixed(2); } - var content = _.template('<%= group %> = <%= x %>, <%= series %> = <%= y %>', { + var template = _.template('<%= group %> = <%= x %>, <%= series %> = <%= y %>'); + var content = template({ group: this.state.attributes.group, x: this._xaxisLabel(x), series: item.series.label, @@ -1881,6 +1882,7 @@ my.Map = Backbone.View.extend({ initialize: function(options) { var self = this; + this.options = options; this.visible = this.$el.is(':visible'); this.mapReady = false; // this will be the Leaflet L.Map object (setup below) @@ -2282,16 +2284,27 @@ my.Map = Backbone.View.extend({ // Private: Sets up the Leaflet map control and the features layer. // - // The map uses a base layer from [OpenStreetMap.org](http://openstreetmap.org) based - // on [OpenStreetMap data](http://openstreetmap.org). + // The map uses a base layer from [Stamen](http://maps.stamen.com) based + // on [OpenStreetMap data](http://openstreetmap.org) by default, but it can + // be configured passing the `mapTilesURL` and `mapTilesAttribution` options + // (`mapTilesSubdomains` is also supported), eg: + // + // view = new recline.View.Map({ + // model: dataset, + // mapTilesURL: '//{s}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v7/{z}/{x}/{y}.png?access_token=pk.XXXX', + // mapTilesAttribution: '© MapBox etc..', + // mapTilesSubdomains: 'ab' + // }) + // // _setupMap: function(){ var self = this; this.map = new L.Map(this.$map.get(0)); + var mapUrl = this.options.mapTilesURL || 'https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.png'; + var attribution = this.options.mapTilesAttribution ||'Map tiles by Stamen Design (CC BY 3.0). Data by OpenStreetMap (CC BY SA)'; + var subdomains = this.options.mapTilesSubdomains || 'abc'; - var mapUrl = "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"; - var osmAttribution = '©OpenStreetMap contributors'; - var bg = new L.TileLayer(mapUrl, {maxZoom: 19, attribution: osmAttribution}); + var bg = new L.TileLayer(mapUrl, {maxZoom: 19, attribution: attribution, subdomains: subdomains}); this.map.addLayer(bg); this.markers = new L.MarkerClusterGroup(this._clusterOptions); @@ -3227,13 +3240,7 @@ my.SlickGrid = Backbone.View.extend({ } function sanitizeFieldName(name) { - var sanitized; - try{ - sanitized = $(name).text(); - } catch(e){ - sanitized = ''; - } - return (name !== sanitized && sanitized !== '') ? sanitized : name; + return $('
').text(name).html(); } _.each(this.model.fields.toJSON(),function(field){