-
Notifications
You must be signed in to change notification settings - Fork 22
Reset button national dashboard #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,19 @@ angular.module('taarifaWaterpointsApp') | |
| $scope.hoverText = "" | ||
| $scope.choroChoice = "percFun" | ||
|
|
||
| map = null | ||
| osmLayer = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', | ||
| attribution: '(c) OpenStreetMap' | ||
| ) | ||
|
|
||
| satLayer = L.tileLayer('http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', | ||
| attribution: '(c) Esri' | ||
| ) | ||
|
|
||
| regionLayer = null | ||
| districtLayer = null | ||
| wardLayer = null | ||
|
|
||
| # FIXME: "ward" and "region" should be defined elsewhere I think | ||
| getFeaturedItem = (feature) -> | ||
| res = {} | ||
|
|
@@ -115,13 +128,6 @@ angular.module('taarifaWaterpointsApp') | |
| ############## | ||
| ### LAYERS ### | ||
| ############## | ||
| osmLayer = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', | ||
| attribution: '(c) OpenStreetMap' | ||
| ) | ||
|
|
||
| satLayer = L.tileLayer('http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', | ||
| attribution: '(c) Esri' | ||
| ) | ||
|
|
||
| categoryMap = | ||
| "functional" : 0 | ||
|
|
@@ -239,4 +245,18 @@ angular.module('taarifaWaterpointsApp') | |
| # Initialise the map | ||
| initMap([], new L.LatLng(-6.3153, 35.15625)) | ||
| modalSpinner.close() | ||
|
|
||
| $scope.$on "dashMapReset", (event) -> | ||
| modalSpinner.open() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have not tested this (so could be wrong!) but my suspicion is that the code here executes fast enough that the spinner would just flash and disappear immediately (or display for its minimum time). In that case I would leave it out. |
||
| if map? | ||
| if map.hasLayer osmLayer | ||
| map.removeLayer osmLayer | ||
| map.addLayer satLayer | ||
| map.setView(new L.LatLng(-6.3153, 35.15625), 5) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These coordinates are listed twice in this file and are also listed at least once somewhere else (services.coffee). For now I can live with it but in an ideal world the national dashboard should use the map factory from services instead of define its own. That would solve the fundamental problem. |
||
| map.removeLayer districtLayer if map.hasLayer districtLayer | ||
| map.removeLayer wardLayer if map.hasLayer wardLayer | ||
| map.addLayer regionLayer unless map.hasLayer regionLayer | ||
| $scope.choroChoice = "percFun" | ||
| modalSpinner.close() | ||
|
|
||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Niggle, this section "header" no longer really reflects the contents. Worth rewording/rejigging slightly?