diff options
author | Struan Donald <struan@exo.org.uk> | 2013-02-27 17:20:10 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2013-02-27 17:20:10 +0000 |
commit | 3997535ca0408ad7f2bd2649043608bc71335a75 (patch) | |
tree | a61d859154b86854450d28c0db5193e58bdc514c /www/js/router.js | |
parent | 2a6b25490db6e718fe98a6521916b33c705a9707 (diff) |
cut back to basic backbone based app
Diffstat (limited to 'www/js/router.js')
-rw-r--r-- | www/js/router.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/www/js/router.js b/www/js/router.js new file mode 100644 index 0000000..777acd9 --- /dev/null +++ b/www/js/router.js @@ -0,0 +1,34 @@ +;(function (FMS, Backbone, _, $) { + _.extend(FMS, { + appRouter: Backbone.Router.extend({ + currentView: null, + + routes: { + '': 'home', + 'home': 'home', + }, + + initialize: function() { + }, + + back: function() { + if (this.currentView && this.currentView.prev) { + this.currentView.onClickButtonPrev(); + } + }, + + home: function(){ + var homeView = new FMS.HomeView(); + this.changeView(homeView); + }, + + changeView: function(view) { + $(view.el).attr('data-role', 'page'); + view.render(); + $('body').append($(view.el)); + $.mobile.changePage($(view.el), { changeHash: false }); + this.currentView = view; + } + }) + }); +})(FMS, Backbone, _, $); |