forked from joaool/MotherGithub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bbmodal.js
34 lines (32 loc) · 828 Bytes
/
bbmodal.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
var MainView = Backbone.View.extend({
el: 'body',
events: {
'click #open': 'openModal'
},
template: '<a id="open" class="btn">open modal</a>',
openModal: function() {
var view = new ModalView();
var modal = new Backbone.BootstrapModal({
content: view,
title: 'modal header',
animate: true
});
modal.open(function(){ console.log('clicked OK') });
},
render: function() {
this.$el.html(this.template);
return this;
}
});
var ModalView = Backbone.View.extend({
tagName: 'p',
template: 'this is modal content',
render: function() {
this.$el.html(this.template);
return this;
}
});
$(document).ready(function() {
var mainView = new MainView();
mainView.render();
});