From 8c2ed2e639a3088e661ce5226bc17fbe277821bc Mon Sep 17 00:00:00 2001 From: Arvind Date: Fri, 4 Oct 2013 13:04:24 +0530 Subject: [PATCH] Feature completions - Adding an option to specify shapefiles in geoJSON format - login.html uses the new bootstrap file now --- mouchak/static/js/editor.js | 3 ++- mouchak/static/js/models.js | 3 ++- mouchak/static/js/views.js | 5 +++++ mouchak/templates/editor.html | 7 +++++++ mouchak/templates/login.html | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/mouchak/static/js/editor.js b/mouchak/static/js/editor.js index 6383aaa..42ab16e 100644 --- a/mouchak/static/js/editor.js +++ b/mouchak/static/js/editor.js @@ -313,7 +313,8 @@ else if(type === "map"){ var template = _.template($('#map-template').html()); $('#specific-content').html(template({ - tileLayer: this.model.get('tileLayer') + tileLayer: this.model.get('tileLayer'), + shp: this.model.get('shp') })); } }, diff --git a/mouchak/static/js/models.js b/mouchak/static/js/models.js index abbd865..244dbcd 100644 --- a/mouchak/static/js/models.js +++ b/mouchak/static/js/models.js @@ -61,7 +61,8 @@ // Map model var Map = BaseType.extend({ defaults: _.extend(BaseType.prototype.defaults, { - tileLayer: "" + tileLayer:"", + shp: "" }), initialize: function(){ BaseType.prototype.initialize.call(this, arguments); diff --git a/mouchak/static/js/views.js b/mouchak/static/js/views.js index 5806c3b..a074137 100644 --- a/mouchak/static/js/views.js +++ b/mouchak/static/js/views.js @@ -124,6 +124,11 @@ var restrictBounds = new L.LatLngBounds(southWest, northEast); M.map = new L.Map('map',{mapBounds: restrictBounds, zoom: 2, worldCopyJump: true, center:[14.604847155053898, 2.8125] }); L.tileLayer(this.model.get("tileLayer")).addTo(M.map); + if(this.model.has("shp")){ + $.getJSON(this.model.get("shp"), function(data){ + L.geoJSON(data); + }); + } } }); diff --git a/mouchak/templates/editor.html b/mouchak/templates/editor.html index 1f278c6..128bdfb 100644 --- a/mouchak/templates/editor.html +++ b/mouchak/templates/editor.html @@ -204,6 +204,13 @@ m-data-target="tileLayer"> +
+
+ Shapefile + +
+
diff --git a/mouchak/templates/login.html b/mouchak/templates/login.html index 7655efb..8910424 100644 --- a/mouchak/templates/login.html +++ b/mouchak/templates/login.html @@ -13,7 +13,7 @@ - +