From c1d9a61bf69db7a48ba33c95cdc0b8fc00f1755c Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Tue, 5 Mar 2013 16:29:09 +0000 Subject: save personal details when we submit, load them when we start and use them in the submit form --- www/js/app.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index 035c0ae..54fc8b9 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -42,6 +42,7 @@ var tpl = { ], initialized: 0, + users: new FMS.Users(), currentUser: null, currentLocation: null, @@ -59,6 +60,15 @@ var tpl = { router: new FMS.appRouter() }); + // we only ever have the details of one user + FMS.users.fetch(); + if ( FMS.users.length > 0 ) { + FMS.currentUser = FMS.users.get(1); + } + if ( !FMS.currentUser ) { + FMS.currentUser = new FMS.User({id: 1}); + } + document.addEventListener('backbutton', function() { FMS.router.back(); }, true); Backbone.history.start(); -- cgit v1.2.3