Source: views/layout/layout.js

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
var Marionette = require('backbone.marionette');
var HeaderView = require('./header/header');
var TodosView = require('../todos/collection');
var ChartView = require('./chart/chart');
var FooterView = require('./footer/footer');
var tpl = require('./layout.hbs');

/**
 * @version 1.0.0
 * @description Layout View - Root layout view. Requires the modules
 * {@link module:views/layout/header/header},
 * {@link module:views/todos/collection},
 * {@link module:views/layout/chart/chart},and
 * {@link module:views/layout/footer/footer}
 * @module views/layout/layout
 * @requires module:views/layout/header/header
 * @requires module:views/layout/chart/chart
 * @requires module:views/todos/collection
 * @requires module:views/layout/footer/footer
 * @link {http://marionettejs.com/}
 */
module.exports = Marionette.Layout.extend({

    /** template */
    template: tpl,

    /**
     * @desc UI bindings create cached attributes that
     * point to jQuery selected objects
     */
    ui: {
        app: '#todoapp'
    },

    /** regions */
    regions: {
        header: '#header',
        main: '#main',
        chart: '#chart',
        footer: '#footer'
    },

    /**
     * @func updateFilter
     * @param filter
     */
    updateFilter: function(filter) {
        this.ui.app.attr('class', 'filter-' + filter);
    },

    /**
     * @func onShow
     */
    onShow: function() {
        var options = {collection: this.options.todosCollection};

        this.header.show(new HeaderView(options));
        this.main.show(new TodosView(options));
        this.chart.show(new ChartView(options));
        this.footer.show(new FooterView(options));
    }

});
DocStrap Copyright © 2012-2014 The contributors to the JSDoc3 and DocStrap projects.
Documentation generated by JSDoc 3.2.2 on Mon May 18th 2015 using the DocStrap template.