aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js9
-rw-r--r--web/js/map-OpenLayers.js82
-rw-r--r--web/js/map-bing-ol.js22
3 files changed, 35 insertions, 78 deletions
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index 273e389c4..ae7b2e820 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -80,6 +80,13 @@ $(function(){
//add mobile class if small screen
if(Modernizr.mq('only screen and (max-width:48em)')) {
$('html').addClass('mobile');
+// XXX Make map full screen here?
+// if (fixmystreet.page == 'around') {
+// $('#map_box').css({
+// height: $(window).height(),
+// margin: 0
+// });
+// }
} else {
// Make map full screen on non-mobile sizes.
var map_pos = 'fixed', map_height = '100%';
@@ -353,4 +360,4 @@ $(function(){
$('#sub_map_links').animate({'right':-maplinks_width}, 1200);
}
});
-}); \ No newline at end of file
+});
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 38a2930d3..2375d5eb8 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -133,7 +133,7 @@ function fixmystreet_onload() {
var popup = new OpenLayers.Popup.FramedCloud("popup",
feature.geometry.getBounds().getCenterLonLat(),
null,
- "TITLE<br><a href=/report/id>More</a>",
+ feature.attributes.title + "<br><a href=/report/" + feature.attributes.id + ">More details</a>",
null, true, onPopupClose);
feature.popup = popup;
fixmystreet.map.addPopup(popup);
@@ -379,61 +379,14 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
},
trigger: function(e) {
- if ($('html').hasClass('mobile') && fixmystreet.page != 'new') {
- if (fixmystreet.page == 'mobile-full-map') {
- this.locate_report(e);
- $('#map_box').css({
- zIndex: 'auto', position: 'static',
- width: 'auto', height: '10em',
- margin: '0 -1em'
- });
- fixmystreet.map.updateSize();
- } else {
- this.mobile_full_screen_map(e);
- }
+ if ($('html').hasClass('mobile')) {
+ this.locate_report_mobile(e);
} else {
this.locate_report(e);
}
},
- mobile_full_screen_map: function(e) {
- if ( fixmystreet.markers.getVisibility() ) {
- $('#hide_pins_link').click();
- }
- var permalink_id;
- if ($('#map_permalink').length) {
- permalink_id = 'map_permalink';
- }
- fixmystreet.map.addControls([
- new OpenLayers.Control.Navigation({ zoomWheelEnabled: false }),
- new OpenLayers.Control.Permalink(permalink_id),
- new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
- ]);
- $('#map_box').css({
- zIndex: 0, position: 'fixed',
- top: 0, left: 0, right: 0, bottom: 0,
- width: '100%', height: '100%',
- margin: 0
- });
-
- // move and alter green banner, add close button
- $('#map_box').append('<span id="close-mobile-map">Close</span>');
- $('.big-green-banner').addClass('mobile-map-banner');
- // hide site-logo (z-index madness), show sub_map_links
- // and push map zoom down a notch
- $('#site-logo').hide();
- $('#sub_map_links').show();
-
- // need to set up a click for #close-mobile-map somehow
-
- fixmystreet.map.updateSize();
- fixmystreet.page = 'mobile-full-map';
- // To make sure the click control is on top
- this.deactivate();
- this.activate();
- },
-
- locate_report: function(e) {
+ locate_report_pin_and_council: function(e) {
var lonlat = fixmystreet.map.getLonLatFromViewPortPx(e.xy);
if (fixmystreet.page == 'new') {
/* Already have a pin */
@@ -453,7 +406,7 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
$('#hide_pins_link').click();
}
if (fixmystreet.page == 'new') {
- return;
+ return true;
}
$.getJSON('/report/new/ajax', {
latitude: $('#fixmystreet\\.latitude').val(),
@@ -467,6 +420,21 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
$('#form_category').change( form_category_onchange );
}
});
+ return false;
+ },
+
+ locate_report_mobile: function(e) {
+ if (this.locate_report_pin_and_council(e)) {
+ return;
+ }
+ fixmystreet.page = 'new';
+ location.hash = 'report';
+ },
+
+ locate_report: function(e) {
+ if (this.locate_report_pin_and_council(e)) {
+ return;
+ }
$('#side-form, #site-logo').show();
/* For some reason on IOS5 if you use the jQuery show method it
* doesn't display the JS validation error messages unless you do this
@@ -476,8 +444,6 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
document.getElementById('side-form').style.display = 'block';
}
$('#side').hide();
- //hide lots of the map ui on mobile
- $('#sub_map_links, #fms_pan_zoom, #close-mobile-map', '.mobile').hide();
heightFix('#report-a-problem-sidebar:visible', '.content', 26);
// If we clicked the map somewhere inconvenient
@@ -500,14 +466,6 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
}
}
- if (fixmystreet.page == 'mobile-full-map') {
- lonlat.transform(
- new OpenLayers.Projection("EPSG:4326"),
- fixmystreet.map.getProjectionObject()
- );
- fixmystreet.map.setCenter(lonlat);
- }
-
fixmystreet.page = 'new';
location.hash = 'report';
}
diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js
index 478bf6527..8f0ba4da0 100644
--- a/web/js/map-bing-ol.js
+++ b/web/js/map-bing-ol.js
@@ -3,21 +3,13 @@ function set_map_config(perm) {
if ($('#map_permalink').length) {
permalink_id = 'map_permalink';
}
- if ($('html').hasClass('mobile')) {
- fixmystreet.controls = [
- new OpenLayers.Control.Attribution(),
- new OpenLayers.Control.ArgParser()
- ];
- $('#sub_map_links').hide();
- } else {
- fixmystreet.controls = [
- new OpenLayers.Control.Attribution(),
- new OpenLayers.Control.ArgParser(),
- new OpenLayers.Control.Navigation({ zoomWheelEnabled: false }),
- new OpenLayers.Control.Permalink(permalink_id),
- new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
- ];
- }
+ fixmystreet.controls = [
+ new OpenLayers.Control.Attribution(),
+ new OpenLayers.Control.ArgParser(),
+ new OpenLayers.Control.Navigation({ zoomWheelEnabled: false }),
+ new OpenLayers.Control.Permalink(permalink_id),
+ new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
+ ];
fixmystreet.map_type = OpenLayers.Layer.Bing;
}