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
|
;(function (FMS, Backbone, _, $) {
_.extend( FMS, {
FMSView: Backbone.View.extend({
render: function(){
if ( !this.template ) {
console.log('no template to render');
return;
}
template = _.template( tpl.get( this.template ) );
if ( this.model ) {
this.$el.html(template(this.model.toJSON()));
} else {
this.$el.html(template());
}
this.afterRender();
return this;
},
afterRender: function() {},
afterDisplay: function() {},
onClickButtonPrev: function() {
this.navigate( this.prev, 'right' );
},
onClickButtonNext: function() {
this.navigate( this.next, 'left' );
},
destroy: function() { console.log('destory for ' + this.id); this.remove(); }
})
});
})(FMS, Backbone, _, $);
|