aboutsummaryrefslogtreecommitdiffstats
path: root/www/js/views/existing.js
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-04-09 11:13:24 +0100
committerStruan Donald <struan@exo.org.uk>2013-04-09 11:13:24 +0100
commit890cfcddffd1c70df10bf655d63e7b8fd162d853 (patch)
tree594caa04a48a0bef5c6e89672d4b7ec646710ca9 /www/js/views/existing.js
parent3c9714c131708393316dc24f72bec9245902d405 (diff)
if the user has a saved report then ask them if they want to use that
when they start the app
Diffstat (limited to 'www/js/views/existing.js')
-rw-r--r--www/js/views/existing.js26
1 files changed, 26 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, _, $);