aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--www/about.html2
-rw-r--r--www/account.html5
-rw-r--r--www/around.html1
-rw-r--r--www/js/fixmystreet.js14
-rw-r--r--www/js/map-OpenLayers.js35
-rw-r--r--www/js/mobile.js96
-rw-r--r--www/my_reports.html9
7 files changed, 45 insertions, 117 deletions
diff --git a/www/about.html b/www/about.html
index 262c16d..d537a97 100644
--- a/www/about.html
+++ b/www/about.html
@@ -1,7 +1,5 @@
<div class="wrapper" data-role="page">
<div class="table-cell">
- <div id="user-meta">
- </div>
<div class="container" data-role="content">
<div class="content" role="main">
<div class="tablewrapper">
diff --git a/www/account.html b/www/account.html
index 5482ae4..0a06da5 100644
--- a/www/account.html
+++ b/www/account.html
@@ -1,10 +1,5 @@
<div class="wrapper" id="account-page" data-role="page">
<div class="table-cell">
- <!-- header id="site-header" role="banner">
- <div class="container">
- <span id="site-logo"></span>
- </div>
- </header -->
<div id="user-meta">
diff --git a/www/around.html b/www/around.html
index 66fd243..d303fbb 100644
--- a/www/around.html
+++ b/www/around.html
@@ -38,7 +38,6 @@
<p id="sub_map_links">
<a id="hide_pins_link" rel="nofollow" href="">Hide pins</a>
<a id="all_pins_link" rel="nofollow" href="">Show old</a>
- <a rel="nofollow" href="index.html">home</a>
</p>
</div>
</form>
diff --git a/www/js/fixmystreet.js b/www/js/fixmystreet.js
index c7cf324..2d29326 100644
--- a/www/js/fixmystreet.js
+++ b/www/js/fixmystreet.js
@@ -78,9 +78,7 @@ function tabs(elem, indirect) {
$(document).delegate( '#front-page', 'pageshow', function(event, ui) {
- // Geolocation
if (geo_position_js.init() && !$('#geolocate_link').length) {
- console.log('adding thing');
$('#postcodeForm').after('<a href="#" id="geolocate_link">&hellip; or locate me automatically</a>');
$('#geolocate_link').click(getPosition);
}
@@ -158,18 +156,6 @@ $(document).bind('pageshow', function(){
});
*/
- if (!$('#been_fixed_no').prop('checked') && !$('#been_fixed_unknown').prop('checked')) {
- $('#another_qn').hide();
- }
- $('#been_fixed_no').click(function() {
- $('#another_qn').show('fast');
- });
- $('#been_fixed_unknown').click(function() {
- $('#another_qn').show('fast');
- });
- $('#been_fixed_yes').click(function() {
- $('#another_qn').hide('fast');
- });
// FIXME - needs to use translated string
jQuery.validator.addMethod('validCategory', function(value, element) {
diff --git a/www/js/map-OpenLayers.js b/www/js/map-OpenLayers.js
index 57fb9e9..a25e43f 100644
--- a/www/js/map-OpenLayers.js
+++ b/www/js/map-OpenLayers.js
@@ -206,7 +206,9 @@ function fixmystreet_onload() {
}
});
- fixmystreet.map.addControl( new OpenLayers.Control.Crosshairs(null) );
+ if (fixmystreet.page == 'around' ) {
+ fixmystreet.map.addControl( new OpenLayers.Control.Crosshairs(null) );
+ }
}
OpenLayers.Map.prototype.getCurrentSize = function() {
var mapDiv = $(this.div);
@@ -241,35 +243,6 @@ function ensureNonZeroHeight(containerid) {
}
}
-$(document).delegate('#submit-problem', 'pageshow', function(event) {
- $('#mapForm').submit(postReport);
- $('#mapForm :input[type=submit]').on('click', function() { submit_clicked = $(this); });
- $('#side-form, #site-logo').show();
- $('#pc').val(localStorage.pc);
- $('#fixmystreet\\.latitude').val(localStorage.latitude);
- $('#fixmystreet\\.longitude').val(localStorage.longitude);
- if ( !localStorage.offline ) {
- $.getJSON( CONFIG.FMS_URL + 'report/new/ajax', {
- latitude: $('#fixmystreet\\.latitude').val(),
- longitude: $('#fixmystreet\\.longitude').val()
- }, function(data) {
- if (data.error) {
- // XXX If they then click back and click somewhere in the area, this error will still show.
- $('#side-form').html('<h1>Reporting a problem</h1><p>' + data.error + '</p>');
- return;
- }
- $('#councils_text').html(data.councils_text);
- $('#form_category_row').html(data.category);
- });
- } else {
- $('#councils_text').html("You are currently operating in offline mode so you can save the details of the problem but you'll need to finish reporting when you have internet access.");
- $('#form_category_row').hide();
- $('#email_label').hide();
- $('#form_email').hide();
- $('#form_sign_in').hide();
- }
-});
-
function show_map(event) {
ensureNonZeroHeight();
@@ -514,7 +487,7 @@ OpenLayers.Format.FixMyStreet = OpenLayers.Class(OpenLayers.Format.JSON, {
});
/* Click handler */
-OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
+OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
defaultHandlerOptions: {
'single': true,
'double': false,
diff --git a/www/js/mobile.js b/www/js/mobile.js
index 38c714d..7f7dca1 100644
--- a/www/js/mobile.js
+++ b/www/js/mobile.js
@@ -35,14 +35,6 @@ function valid_postcode(pc) {
return false;
}
-function checkConnection() {
- var networkState = navigator.network.connection.type;
- if ( networkState == Connection.NONE || networkState == Connection.UNKNOWN ) {
- $('#main').hide();
- $('#noconnection').show();
- }
-}
-
function use_lat_long( lat, long ) {
show_around( lat, long );
}
@@ -142,6 +134,7 @@ function locate() {
}
return false;
}
+
var watch_id = null;
var watch_count = 0;
@@ -430,41 +423,6 @@ function display_account_page() {
}
}
-function sign_out() {
- jQuery.ajax( {
- url: CONFIG.FMS_URL + "auth/ajax/sign_out?" + new Date().getTime(),
- type: 'GET',
- success: function(data) {
- if ( data.signed_out ) {
- localStorage.signed_out = 1;
- localStorage.name = null;
- $.mobile.changePage('sign_in.html');
- }
- }
- } );
-}
-
-function sign_out_around() {
- jQuery.ajax( {
- url: CONFIG.FMS_URL + "auth/ajax/sign_out?" + new Date().getTime(),
- type: 'GET',
- success: function(data) {
- $('#user-meta').html('');
- $('#email_label').show();
- $('#form_email').show();
- $('#now_submit').show();
- $('#have_password').show();
- $('#form_sign_in_yes').show();
- $('#let_me_confirm').show();
- $('#password_register').show();
- $('#password_surround').show();
- $('#providing_password').show();
- $('#form_name').val( '' );
- $('.form-focus-hidden').hide();
- }
- } );
-}
-
function set_location() {
var cross = fixmystreet.map.getControlsByClass(
"OpenLayers.Control.Crosshairs");
@@ -481,7 +439,6 @@ function set_location() {
}
function account() {
- $('.mobile-sign-in-banner').show();
$('#account').show();
if ( localStorage.name ) {
if ( $('body').hasClass('signed-in-page') ) {
@@ -607,16 +564,43 @@ function display_saved_report() {
}
function submit_problem_show() {
- if ( localStorage.name ) {
- $('.form-focus-hidden').show();
+ $('#mapForm').submit(postReport);
+ $('#mapForm :input[type=submit]').on('click', function() { submit_clicked = $(this); });
+ $('#side-form, #site-logo').show();
+ $('#pc').val(localStorage.pc);
+ $('#fixmystreet\\.latitude').val(localStorage.latitude);
+ $('#fixmystreet\\.longitude').val(localStorage.longitude);
+
+ if ( localStorage.offline == 1 ) {
+ $('#councils_text').html("You are currently operating in offline mode so you can save the details of the problem but you'll need to finish reporting when you have internet access.");
+ $('#form_category_row').hide();
+ $('#email_label').hide();
+ $('#form_email').hide();
+ $('#form_sign_in').hide();
} else {
- $('.form-focus-hidden').hide();
+ if ( localStorage.name ) {
+ $('.form-focus-hidden').show();
+ } else {
+ $('.form-focus-hidden').hide();
+ }
+
+ $.getJSON( CONFIG.FMS_URL + 'report/new/ajax', {
+ latitude: $('#fixmystreet\\.latitude').val(),
+ longitude: $('#fixmystreet\\.longitude').val()
+ }, function(data) {
+ if (data.error) {
+ // XXX If they then click back and click somewhere in the area, this error will still show.
+ $('#side-form').html('<h1>Reporting a problem</h1><p>' + data.error + '</p>');
+ return;
+ }
+ $('#councils_text').html(data.councils_text);
+ $('#form_category_row').html(data.category);
+ });
}
}
$(document).bind('pageinit', function() {
$('#postcodeForm').submit(locate);
- $('#mapForm').submit(postReport);
$('#signInForm').submit(sign_in);
$('#ffo').click(getPosition);
$('#forget').on('click', forget);
@@ -625,19 +609,14 @@ $(document).bind('pageinit', function() {
account();
});
-document.addEventListener("deviceready", onDeviceReady, false);
-
-$(document).delegate('#report-created', 'pageshow',function() {
- var uri = CONFIG.FMS_URL + 'report/' + localStorage.report;
- $('#report_url').html( '<a href="' + uri + '">' + uri + '</a>' );
-});
-
function decide_front_page() {
if ( !can_geolocate ) {
window.setTimeout( decide_front_page, 100 );
return;
}
+
localStorage.offline = 0;
+
if ( navigator.network.connection.type == Connection.NONE ||
navigator.network.connection.type == Connection.UNKNOWN ) {
localStorage.offline = 1;
@@ -647,6 +626,13 @@ function decide_front_page() {
}
}
+document.addEventListener("deviceready", onDeviceReady, false);
+
+$(document).delegate('#report-created', 'pageshow',function() {
+ var uri = CONFIG.FMS_URL + 'report/' + localStorage.report;
+ $('#report_url').html( '<a href="' + uri + '">' + uri + '</a>' );
+});
+
$(document).delegate('#front-page', 'pageshow', decide_front_page);
$(document).delegate('#account-page', 'pageshow', display_account_page);
$(document).delegate('#my-reports-page', 'pageshow', display_saved_reports);
diff --git a/www/my_reports.html b/www/my_reports.html
index 16773a7..c7a0d8e 100644
--- a/www/my_reports.html
+++ b/www/my_reports.html
@@ -1,14 +1,5 @@
<div class="wrapper" id="my-reports-page" data-role="page">
<div class="table-cell">
- <!-- header id="site-header" role="banner">
- <div class="container">
- <span id="site-logo"></span>
- </div>
- </header -->
-
- <div id="user-meta">
-
- </div>
<div class="container" data-role="content">
<div class="content" id="reports" role="main" data-enhance="false">