forked from minikomi/Bootstrap-Form-Builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
63 lines (61 loc) · 1.81 KB
/
app.js
File metadata and controls
63 lines (61 loc) · 1.81 KB
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
define([
"jquery" , "underscore" , "backbone"
, "collections/snippets" , "collections/my-form-snippets"
, "views/tab" , "views/my-form"
, "text!data/input.json", "text!data/radio.json", "text!data/select.json", "text!data/buttons.json"
, "text!templates/app/render.html", "text!templates/app/about.html",
], function(
$, _, Backbone
, SnippetsCollection, MyFormSnippetsCollection
, TabView, MyFormView
, inputJSON, radioJSON, selectJSON, buttonsJSON
, renderTab, aboutTab
){
return {
initialize: function(){
//Bootstrap tabs from json.
new TabView({
title: "Input"
, collection: new SnippetsCollection(JSON.parse(inputJSON))
});
new TabView({
title: "Radios / Checkboxes"
, collection: new SnippetsCollection(JSON.parse(radioJSON))
});
new TabView({
title: "Select"
, collection: new SnippetsCollection(JSON.parse(selectJSON))
});
new TabView({
title: "Buttons"
, collection: new SnippetsCollection(JSON.parse(buttonsJSON))
});
new TabView({
title: "Rendered"
, content: renderTab
});
new TabView({
title: "About"
, content: aboutTab
});
//Make the first tab active!
$("#components .tab-pane").first().addClass("active");
$("#formtabs li").first().addClass("active");
// Bootstrap "My Form" with 'Form Name' snippet.
new MyFormView({
title: "Original"
, collection: new MyFormSnippetsCollection([
{ "title" : "Form Name"
, "fields": {
"name" : {
"label" : "Form Name"
, "type" : "input"
, "value" : "Form Name"
}
}
}
])
});
}
}
});