diff options
-rw-r--r-- | www/index.html | 1 | ||||
-rw-r--r-- | www/js/app.js | 2 | ||||
-rw-r--r-- | www/js/router.js | 6 | ||||
-rw-r--r-- | www/js/views/existing.js | 26 | ||||
-rw-r--r-- | www/js/views/home.js | 2 | ||||
-rw-r--r-- | www/templates/en/existing.html | 28 |
6 files changed, 64 insertions, 1 deletions
diff --git a/www/index.html b/www/index.html index b5cc3e0..4f47a89 100644 --- a/www/index.html +++ b/www/index.html @@ -39,6 +39,7 @@ <script type="text/javascript" src="js/views/home.js"></script> <script type="text/javascript" src="js/views/around.js"></script> <script type="text/javascript" src="js/views/search.js"></script> + <script type="text/javascript" src="js/views/existing.js"></script> <script type="text/javascript" src="js/views/photo.js"></script> <script type="text/javascript" src="js/views/details.js"></script> <script type="text/javascript" src="js/views/submit.js"></script> diff --git a/www/js/app.js b/www/js/app.js index f717da9..e79d7a7 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -38,7 +38,7 @@ var tpl = { (function (FMS, Backbone, _, $) { _.extend(FMS, { templates: [ - 'home', 'around', 'address_search', 'photo', 'details', 'submit', 'submit_email', 'submit_name', 'submit_password', 'sent' + 'home', 'around', 'address_search', 'existing', 'photo', 'details', 'submit', 'submit_email', 'submit_name', 'submit_password', 'sent' ], initialized: 0, diff --git a/www/js/router.js b/www/js/router.js index c259c05..f220422 100644 --- a/www/js/router.js +++ b/www/js/router.js @@ -8,6 +8,7 @@ 'home': 'home', 'around': 'around', 'search': 'search', + 'existing': 'existing', 'photo': 'photo', 'details': 'details', 'submit': 'submit', @@ -42,6 +43,11 @@ this.changeView(searchView); }, + existing: function(){ + var existingView = new FMS.ExistingView({ model: FMS.currentDraft }); + this.changeView(existingView); + }, + home: function(){ var homeView = new FMS.HomeView({ model: FMS.currentDraft }); this.changeView(homeView); 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' ); } diff --git a/www/templates/en/existing.html b/www/templates/en/existing.html new file mode 100644 index 0000000..5406feb --- /dev/null +++ b/www/templates/en/existing.html @@ -0,0 +1,28 @@ +<div data-role="header" data-position="fixed" > + <h1>Draft Report</h1> +</div> +<div class="container" data-enhance="false"> + <div class="content" role="main"> + <h1>You have an unsubmitted report</h1> + + <% if ( title ) { %> + <p>title: <%= title %></p> + <% } %> + + <% if ( details ) { %> + <p>details: <%= details %></p> + <% } %> + + <% if ( category && category != '-- Pick a category --' ) { %> + <p>category: <%= category %></p> + <% } %> + + + <% if ( file ) { %> + <p><img src="<%= file %>" width="200"></p> + <% } %> + + <input id="use_report" type="button" value="use" /> + <input id="discard" type="button" value="discard" /> + </div> +</div> |