-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
227 lines (223 loc) · 9.75 KB
/
index.html
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<!DOCTYPE html>
<html>
<head>
<script src="react.js"></script>
<script src="underscore-min.js"></script>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
function formjsCurrent(data){
console.log('current state');
console.log(data);
}
function formjsSubmit(data){
console.log('form submit');
console.log(data);
}
function formjsFilesOnSubmit(data){
console.log('files array on submit');
console.log(data);
}
function formjsFilesOnSelect(data){
console.log('files array on selecte');
console.log(data);
}
var values = [{
"title": "Hello world",
"bullets": [
{
"text": "hello",
"score": 5.5
},
{
"text": "world",
"score": 9.5
}
],
"are_you_awesome": true,
"chromosome_configuration": "male",
"age": 21,
"birthday": "1970-01-01",
"email": "thedude@gmail.com"
}];
var schema = [
{
"description": "Create A doo hicky",
"schema": {
"type": "object",
"properties": {
"title": {
"type": "string",
"title": "title"
},
"bullets": {
"items": {
"type": "object",
"properties": {
"text": {
"type": "string",
"description": null,
"title": "text"
},
"score": {
"type": "number",
"title": "score",
"enum": [1.5, 5.5, 9.5]
}
}
},
"type": "array",
"description": "",
"title": "Bullets"
},
"are_you_awesome": {
"type": "boolean"
},
"chromosome_configuration": {
"type": "string",
"enum": ["male", "female"]
},
"age": {
"type": "integer",
"minimum": 0,
"maximum": 150
},
"birthday": {
"type": "string",
"format": "date"
},
"email": {
"type": "string",
"format": "email",
}
}
}
},
{
"description": null,
"title": "Site Detail",
"ux-submit-text" : "submit form",
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "\n Your Site Name will appear in the title bar of the browser. It tells\n users and search engines what your site is about.\n ",
"title": "Site name"
},
"domain": {
"type": "string",
"description": "\n <p><b>Use Your Own Address!</b></p>\n\n <p>Point a domain name that you own to your Montagable site. Simply\n create the appropriate CNAME with your domain registrar, and then\n enter your custom domain in the box above. In 72-hours or less,\n your visitors will be able to find you at www.yourcustomdomain.com.</p>\n\n <p>Don't know what a CNAME is? Don't want to mess with this stuff?\n Check out <a href=\"http://montagable.com/help/using-domain/\" target=\"_blank\">\n this page of our help documentation</a>, OR email our super responsive\n support team at <a href=\"mailto:support@montagable.com\">support@montagable.com</a>.</p>\n ",
"title": "Domain"
},
"google_analytics_id": {
"type": "number",
"title": "google analytics",
"ux-placeholder": "ex. 2342342"
},
"admin_email": {
"type": "string",
"format": "email",
"ux-placeholder": "Email"
},
"slug": {
"type": "string",
"description": "",
"title": "Subdomain"
},
"favicon": {
"ux-widget": "file-select",
"format": "uri",
"type": "string",
"description": "\n A Favicon is the small icon that shows up in the corner of your browser tab.\n ",
"title": "favicon"
},
"bullets": {
"items": {
"type": "object",
"properties": {
"text": {
"type": "string",
"description": null,
"title": "text"
},
"username": {
"type": "string",
"description": null,
"title": "username"
}
}
},
"type": "array",
"description": "",
"title": "Bullets"
}
}
}
},
{
"description": null,
"title": "Site Detail",
"schema": {
"type": "object",
"properties": {
"redirect_domains": {
"items": {
"type": "string"
},
"type": "array",
"description": "",
"title": "Redirect Domains"
},
"name": {
"type": "string",
"description": "\n Your Site Name will appear in the title bar of the browser. It tells\n users and search engines what your site is about.\n ",
"title": "Site name"
},
"domain": {
"type": "string",
"description": "\n <p><b>Use Your Own Address!</b></p>\n\n <p>Point a domain name that you own to your Montagable site. Simply\n create the appropriate CNAME with your domain registrar, and then\n enter your custom domain in the box above. In 72-hours or less,\n your visitors will be able to find you at www.yourcustomdomain.com.</p>\n\n <p>Don't know what a CNAME is? Don't want to mess with this stuff?\n Check out <a href=\"http://montagable.com/help/using-domain/\" target=\"_blank\">\n this page of our help documentation</a>, OR email our super responsive\n support team at <a href=\"mailto:support@montagable.com\">support@montagable.com</a>.</p>\n ",
"title": "Domain"
},
"favicon": {
"ux-widget": "file-select",
"format": "uri",
"type": "string",
"description": "\n A Favicon is the small icon that shows up in the corner of your browser tab.\n ",
"title": "favicon"
},
"google_analytics": {
"type": "string",
"description": "\n <p><b>Know Your Audience</b></p>\n\n <p><a href=\"http://google.com/analytics/\" target=\"_blank\">Google Analytics</a>\n is a free service offered by Google that generates reports and\n statistics about the visitors to your website.</p>\n\n <p>To take advantage of this, all you need to do is signup for a Google\n Analytics account and then enter your \"Tracking ID\" (UA-XXXXXXX-Y)\n into the box above.</p>\n\n <p>Need more help? Check out our\n <a href=\"http://montagable.com/help/connecting-google-analytics-account/\" target=\"_blank\">detailed\n instructions here</a> OR contact our super-responsive support team at\n <a href=\"mailto:support@montagable.com\">support@montagable.com</a>.</p>\n ",
"title": "google analytics"
},
"logo": {
"ux-widget": "file-select",
"format": "uri",
"type": "string",
"description": "",
"title": "logo"
},
"slug": {
"type": "string",
"description": "",
"title": "Subdomain"
}
}
}
}];
var forms = [];
for (var i = 0; i < schema.length; i++) {
forms.push(formjs( {data:schema[i], values: values[i], iteration:i, submitState:formjsSubmit, filesOnSubmit:formjsFilesOnSubmit, filesOnSelect:formjsFilesOnSelect, currentState:formjsCurrent} ));
}
React.renderComponent(
React.DOM.div(null, forms),
document.body
);
console.log(forms[0].getValues());
});
</script>
</head>
<body>
<script src="build/forms.js"></script>
</body>
</html>