aboutsummaryrefslogtreecommitdiffstats
path: root/www/js/views/existing.js
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2014-10-03 15:07:08 +0100
committerDave Arter <davea@mysociety.org>2015-08-28 14:27:15 +0100
commita69d425c0e5c004145ac1ab70e2f7f9fc329b54c (patch)
tree8eb7ff0ff7aaa0fce8bc7214ec6e15b694fddbdc /www/js/views/existing.js
parent8fd15b58733c51d7f001f9eac66b7d03830ec0b4 (diff)
update Android to Cordova 3.6
Required due to security issue Remove Android directory as no longer required, move src -> www to match standard layout, update .gitignore to avoid including the standard platform files, update README based on Steve's zurich one
Diffstat (limited to 'www/js/views/existing.js')
-rw-r--r--www/js/views/existing.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/www/js/views/existing.js b/www/js/views/existing.js
new file mode 100644
index 0000000..a34fd0b
--- /dev/null
+++ b/www/js/views/existing.js
@@ -0,0 +1,50 @@
+(function (FMS, Backbone, _, $) {
+ _.extend( FMS, {
+ ExistingView: FMS.FMSView.extend({
+ template: 'existing',
+ id: 'existing',
+
+ events: {
+ 'pagehide': 'destroy',
+ 'pagebeforeshow': 'beforeDisplay',
+ 'pageshow': 'afterDisplay',
+ 'vclick #use_report': 'useReport',
+ 'vclick #save_report': 'saveReport',
+ 'vclick #discard': 'discardReport'
+ },
+
+ _back: function() {
+ navigator.app.exitApp();
+ },
+
+ setHeight: function(content, height) {
+ content.css( 'min-height', content + 'px');
+ },
+
+ useReport: function(e) {
+ e.preventDefault();
+ FMS.setCurrentDraft(this.model);
+ this.navigate('around');
+ },
+
+ saveReport: function(e) {
+ e.preventDefault();
+ FMS.clearCurrentDraft();
+ this.navigate('around');
+ },
+
+ discardReport: function(e) {
+ e.preventDefault();
+ var reset = FMS.removeDraft(this.model.id, true);
+ var that = this;
+ reset.done( function() { that.onDraftRemove(); } );
+ reset.fail( function() { that.onDraftRemove(); } );
+ },
+
+ onDraftRemove: function() {
+ FMS.clearCurrentDraft();
+ this.navigate( 'around', 'left' );
+ }
+ })
+ });
+})(FMS, Backbone, _, $);