aboutsummaryrefslogtreecommitdiffstats
path: root/www/js/router.js
blob: 777acd98dbafd826079317eff6fbc93334ac940a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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, _, $);