aboutsummaryrefslogtreecommitdiffstats
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/map-OpenLayers.js7
-rw-r--r--www/js/views/around.js37
2 files changed, 42 insertions, 2 deletions
diff --git a/www/js/map-OpenLayers.js b/www/js/map-OpenLayers.js
index c5ce747..cd01de1 100644
--- a/www/js/map-OpenLayers.js
+++ b/www/js/map-OpenLayers.js
@@ -297,7 +297,7 @@ function show_map(event) {
fixmystreet_onload();
fixContentHeight(fixmystreet.map);
- var crosshairsControls, i, markHere, newX, newY;
+ var crosshairsControls, i, markHere, confirm, newX, newY;
if (typeof fixmystreet !== 'undefined' && typeof fixmystreet.map !== "undefined") {
// Update the position of any crosshairs controls:
@@ -308,12 +308,17 @@ function show_map(event) {
}
// Also reposition the "Tap here to mark this point" button:
markHere = $('#mark-here');
+ confirm = $('#confirm');
newX = $(window).width() / 2 - markHere.width() / 2;
newY = $(window).height() * 4 / 5 - markHere.height() / 2;
markHere.css({
left: newX + "px",
top: newY + "px"
});
+ confirm.css({
+ left: newX + "px",
+ top: newY + "px"
+ });
}
diff --git a/www/js/views/around.js b/www/js/views/around.js
index 454f427..a323d7e 100644
--- a/www/js/views/around.js
+++ b/www/js/views/around.js
@@ -6,12 +6,19 @@
events: {
'pagehide': 'destroy',
+ 'pagebeforeshow': 'beforeDisplay',
'pageshow': 'afterDisplay',
'click #locate_search': 'goSearch',
'click #reports': 'goReports',
'click #search': 'goSearch',
'click #relocate': 'centerMapOnPosition',
- 'click #mark-here': 'onClickReport'
+ 'click #cancel': 'onClickCancel',
+ 'click #confirm': 'onClickReport',
+ 'click #mark-here': 'onClickMark'
+ },
+
+ beforeDisplay: function() {
+ $('#cancel').hide();
},
afterDisplay: function() {
@@ -48,6 +55,7 @@
var centre = this.projectCoords( coords );
fixmystreet.map.panTo(centre);
}
+ this.displayButtons();
FMS.locator.trackPosition();
},
@@ -97,6 +105,33 @@
this.navigate('search');
},
+ displayButtons: function() {
+ if ( this.model.get('lat') ) {
+ $('#cancel').show();
+ $('#confirm').show();
+ $('#mark-here').hide();
+ } else {
+ $('#cancel').hide();
+ $('#confirm').hide();
+ $('#mark-here').show();
+ }
+ },
+
+ onClickMark: function() {
+ $('#cancel').show();
+ $('#confirm').show();
+ $('#mark-here').hide();
+ },
+
+ onClickCancel: function(e) {
+ e.preventDefault();
+ $('#cancel').hide();
+ $('#confirm').hide();
+ $('#mark-here').show();
+ this.model.set('lat', null);
+ this.model.set('lon', null);
+ },
+
onClickReport: function() {
var position = this.getCrossHairPosition();