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');
module.exports = Marionette.Layout.extend({
template: tpl,
ui: {
app: '#todoapp'
},
regions: {
header: '#header',
main: '#main',
chart: '#chart',
footer: '#footer'
},
updateFilter: function(filter) {
this.ui.app.attr('class', 'filter-' + filter);
},
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));
}
});