aboutsummaryrefslogtreecommitdiffstats
path: root/www/js/views
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/views')
-rw-r--r--www/js/views/existing.js26
-rw-r--r--www/js/views/home.js2
2 files changed, 28 insertions, 0 deletions
diff --git a/www/js/views/existing.js b/www/js/views/existing.js
new file mode 100644
index 0000000..b4af574
--- /dev/null
+++ b/www/js/views/existing.js
@@ -0,0 +1,26 @@
+(function (FMS, Backbone, _, $) {
+ _.extend( FMS, {
+ ExistingView: FMS.FMSView.extend({
+ template: 'existing',
+ id: 'existing',
+
+ events: {
+ 'pagehide': 'destroy',
+ 'pageshow': 'afterDisplay',
+ 'click #use_report': 'useReport',
+ 'click #discard': 'discardReport'
+ },
+
+ useReport: function() {
+ localStorage.currentDraftID = FMS.currentDraft.id;
+ this.navigate('around');
+ },
+
+ discardReport: function() {
+ FMS.currentDraft.destroy();
+ FMS.currentDraft = new FMS.Draft();
+ this.navigate('around');
+ }
+ })
+ });
+})(FMS, Backbone, _, $);
diff --git a/www/js/views/home.js b/www/js/views/home.js
index 0a0480f..9c169a9 100644
--- a/www/js/views/home.js
+++ b/www/js/views/home.js
@@ -27,6 +27,8 @@
navigator.connection.type == Connection.UNKNOWN ) ) {
localStorage.offline = 1;
this.navigate( 'no_connection' );
+ } else if ( FMS.currentDraft && FMS.currentDraft.get('lat') ) {
+ this.navigate( 'existing' );
} else {
this.navigate( 'around' );
}