Skip to content
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

Realtime Django Bugfix #152

Merged
merged 6 commits into from
Feb 16, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
issue about showing latest flood in map:
- show latest flood as default. inasafe/inasafe-realtime#42
- add stroke color for hazard style. inasafe/inasafe-realtime#48
lucernae committed Feb 7, 2017

Verified

This commit was signed with the committer’s verified signature.
droidmonkey Jonathan White
commit 958e6cac61bc58403f32815b169b157faa9e3ebb
28 changes: 23 additions & 5 deletions django_project/realtime/static/realtime/js/flood/flood.js
Original file line number Diff line number Diff line change
@@ -91,22 +91,30 @@ function createShowFeaturesHandler(event_features_url){
}
var style_classes = {
1: {
color: "#bdc5f7",
stroke: true,
color: "#000",
weight: 2,
fillColor: "#bdc5f7",
fillOpacity: 0.8
},
2: {
color: "#fffe73",
stroke: true,
color: "#000",
weight: 2,
fillColor: "#fffe73",
fillOpacity: 0.8
},
3: {
color: "#fea865",
stroke: true,
color: "#000",
weight: 2,
fillColor: "#fea865",
fillOpacity: 0.8
},
4: {
color: "#da6c7b",
stroke: true,
color: "#000",
weight: 2,
fillColor: "#da6c7b",
fillOpacity: 0.8
}
@@ -115,6 +123,16 @@ function createShowFeaturesHandler(event_features_url){
style: function(feature){
return style_classes[feature.properties.hazard_data];
},
filter: function(feature){
if(feature.properties){
var props = feature.properties;
var hazard_data = props.hazard_data;
return hazard_data >= 1;
}
else {
return false;
}
},
onEachFeature: function(feature, layer) {
// Set popup content
if (feature.properties) {
@@ -134,7 +152,7 @@ function createShowFeaturesHandler(event_features_url){
scrollTop: $("#"+map_id).offset().top
}, 500);
var fitBoundsOption = {
maxZoom: 10,
maxZoom: 15,
pan: {
animate: true,
duration: 0.5
6 changes: 6 additions & 0 deletions django_project/realtime/templates/realtime/flood/index.html
Original file line number Diff line number Diff line change
@@ -152,6 +152,12 @@ <h3 class="panel-title">{% trans "Flood" %}</h3>
dynatable.paginationPerPage.set(100);
dynatable.sorts.add('time', -1);
dynatable.process();

// programatically show first flood in row
if(jsonTableContents.length > 0) {
var flood_id = jsonTableContents[0].event_id;
showFeaturesHandler(flood_id);
}
}

// Create handler for table