diff options
-rw-r--r-- | www/index.html | 19 | ||||
-rw-r--r-- | www/js/mobile.js | 26 |
2 files changed, 41 insertions, 4 deletions
diff --git a/www/index.html b/www/index.html index b9dbe1a..1ac5272 100644 --- a/www/index.html +++ b/www/index.html @@ -57,9 +57,22 @@ <div class="table-cell"> <div class="container"> <div class="content" role="main"> - <div class="tablewrapper" style="text-align: center; padding-top: 50%"> - Determining location<br> - <span id="accuracy"></span> + <div class="tablewrapper"> + <div id="locating" class="nodisplay" style="text-align: center; padding-top: 50%"> + Determining location<br> + <span id="accuracy"></span> + </div> + <div id="have_saved" class="nodisplay"> + <p> + You have an incomplete report saved. Would you like to: + </p> + <ul> + <li><input type="button" id="use_saved" value="Complete Saved Report"></li> + <li>Or create a new report and:</li> + <li><input type="button" id="delete_saved" value="Delete Saved Report"></li> + <li><input type="button" id="continue" value="Keep Saved Report"></li> + </ul> + </div> </div> </div> </div> diff --git a/www/js/mobile.js b/www/js/mobile.js index 49c4437..6078ce4 100644 --- a/www/js/mobile.js +++ b/www/js/mobile.js @@ -164,6 +164,9 @@ function notFoundLocation() { } function getPosition() { + $.mobile.loading( 'show' ); + $('#have_saved').hide(); + $('#locating').show(); if ( !can_geolocate ) { window.setTimeout( getPosition, 200 ); return; @@ -387,6 +390,7 @@ function create_offline() { function save_report() { _submit_save_report(); + delete localStorage.currentReport; $.mobile.changePage('my_reports.html'); } @@ -804,6 +808,16 @@ function prep_front_page() { $('#accuracy').text(''); } +function keep_saved_report() { + delete localStorage.currentReport; + getPosition(); +} + +function delete_saved_report() { + remove_saved_report(); + getPosition(); +} + function decide_front_page() { $.mobile.loading( 'show' ); if ( !can_geolocate && ( !navigator.network || !navigator.network.connection ) ) { @@ -818,7 +832,13 @@ function decide_front_page() { geocheck_count = 0; localStorage.offline = 0; - delete localStorage.currentReport; + if ( localStorage.currentReport ) { + $.mobile.loading( 'hide' ); + $('#have_saved').show(); + return; + } + + $('#locating').show(); if ( navigator && navigator.network && ( navigator.network.connection.type == Connection.NONE || navigator.network.connection.type == Connection.UNKNOWN ) ) { @@ -883,3 +903,7 @@ $(document).on('vclick', '#details-page a.ui-btn-right', detail_nav); $(document).on('vclick', '#details-page a.ui-btn-left', detail_nav); $(document).on('vclick', '#submit-page a.ui-btn-left', submit_nav); + +$(document).on('vclick', '#front-page #use_saved', complete_report); +$(document).on('vclick', '#front-page #delete_saved', delete_saved_report); +$(document).on('vclick', '#front-page #continue', keep_saved_report); |