diff options
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, _, $); |