forked from minikomi/Bootstrap-Form-Builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtab.js
More file actions
33 lines (32 loc) · 1012 Bytes
/
tab.js
File metadata and controls
33 lines (32 loc) · 1012 Bytes
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
define([
'jquery', 'underscore', 'backbone'
, "text!templates/app/tab-nav.html"
], function($, _, Backbone,
_tabNavTemplate){
return Backbone.View.extend({
tagName: "div"
, className: "tab-pane"
, initialize: function() {
this.id = this.options.title.toLowerCase().replace(/\W/g,'');
this.tabNavTemplate = _.template(_tabNavTemplate);
this.render();
}
, render: function(){
// Render Snippet Views
var that = this;
if (that.collection !== undefined) {
_.each(this.collection.renderAll(), function(snippet){
that.$el.append(snippet);
});
} else if (that.options.content){
that.$el.append(that.options.content);
}
// Render & append nav for tab
$("#formtabs").append(this.tabNavTemplate({title: this.options.title, id: this.id}))
// Render tab
this.$el.attr("id", this.id);
this.$el.appendTo(".tab-content");
this.delegateEvents();
}
});
});