Skip to content

Commit 182a2ab

Browse files
committed
mdTabs
Very basic support for tabs to get Marvin started
1 parent fbab602 commit 182a2ab

9 files changed

+264
-69
lines changed

examples/data/autocomplete.json

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"schema": {
3+
"type": "object",
4+
"title": "Comment",
5+
"required": ["comments"],
6+
"properties": {
7+
"comments": {
8+
"type": "array",
9+
"maxItems": 2,
10+
"items": {
11+
"type": "object",
12+
"properties": {
13+
"name": {
14+
"title": "Name",
15+
"type": "string"
16+
},
17+
"email": {
18+
"title": "Email",
19+
"type": "string",
20+
"pattern": "^\\S+@\\S+$",
21+
"description": "Email will be used for evil."
22+
},
23+
"spam": {
24+
"title": "Spam",
25+
"type": "boolean",
26+
"default": true
27+
},
28+
"comment": {
29+
"title": "Comment",
30+
"type": "string",
31+
"maxLength": 20,
32+
"validationMessage": "Don't be greedy!"
33+
}
34+
},
35+
"required": ["name","comment"]
36+
}
37+
}
38+
}
39+
},
40+
"form": [
41+
{
42+
"type": "help",
43+
"helpvalue": "<h4>Array Example</h4><p>Try adding a couple of forms, reorder by drag'n'drop.</p>"
44+
},
45+
{
46+
"key": "comments",
47+
"add": "New",
48+
"style": {
49+
"add": "btn-success"
50+
},
51+
"items": [
52+
"comments[].name",
53+
"comments[].email",
54+
{
55+
"key": "comments[].spam",
56+
"type": "checkbox",
57+
"title": "Yes I want spam.",
58+
"condition": "model.comments[arrayIndex].email"
59+
},
60+
{
61+
"key": "comments[].comment",
62+
"type": "textarea"
63+
}
64+
]
65+
},
66+
{
67+
"type": "submit",
68+
"style": "btn-info",
69+
"title": "OK"
70+
}
71+
]
72+
}

examples/data/tabs.json

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"schema": {
3+
"type": "object",
4+
"properties": {
5+
"clan": {
6+
"title": "Ninja Clan",
7+
"description": "Which clan do you wish to complete your task?",
8+
"type": "string",
9+
"enum": [ "Iga", "koga" ]
10+
},
11+
"armySize": {
12+
"type": "number",
13+
"title": "How many Ninja will be required?",
14+
"min": 1,
15+
"max": 7
16+
},
17+
"weaponOfChoice": {
18+
"type": "string",
19+
"title": "Favourite tool",
20+
"enum": ["Nunchuku","Sai","Hanbo","Tonfa"]
21+
},
22+
"colour": {
23+
"type": "string",
24+
"title": "Color preference",
25+
"enum": ["Black"]
26+
},
27+
"date": {
28+
"title": "Date of assault",
29+
"type": "string",
30+
"format": "date"
31+
},
32+
"victim": {
33+
"title": "Target",
34+
"type": "string"
35+
},
36+
"assassinationStyle": {
37+
"title": "How would you like to dispatch your target?",
38+
"type": "string",
39+
"enum": [ "With honour", "With much blood", "With much suffering" ]
40+
},
41+
"fee": {
42+
"title": "I accept late fee payment will result in a most dishonourable and painfully slow death",
43+
"type": "boolean"
44+
},
45+
"suggestions": {
46+
"title": "Any suggestions based on local knowledge?",
47+
"type": "string"
48+
}
49+
}
50+
},
51+
"form": [
52+
{
53+
"type": "tabs",
54+
"tabs": [
55+
{
56+
"title": "Ninja Details",
57+
"items": [
58+
"clan",
59+
"armySize",
60+
"weaponOfChoice",
61+
"colour"
62+
]
63+
},
64+
{
65+
"title": "Job Properties",
66+
"items": [
67+
"date",
68+
"victim",
69+
"assassinationStyle",
70+
"fee"
71+
]
72+
},
73+
{
74+
"title": "Further Information",
75+
"items": [
76+
{
77+
"key":"suggestions",
78+
"type": "textarea"
79+
}
80+
]
81+
}
82+
]
83+
}
84+
]
85+
}

examples/data/titlemaps.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"enum": ["a","b","c"]
4141
},
4242
"radiobuttons": {
43-
"title": "Radio buttons used to switch a boolean",
43+
"title": "Radio buttons used to switch a boolean or multiple values",
4444
"type": "boolean",
4545
"default": false
4646
}

examples/material-example.html

+7-5
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ <h3>Schema</h3>
255255
-->
256256

257257
<script type="text/javascript" src="../bower_components/angular-schema-form/dist/schema-form.js"></script>
258-
<script type="text/javascript" src="../material-decorator.min.js"></script>
258+
<script type="text/javascript" src="../material-decorator.js"></script>
259259

260260
<!--
261261
<script type="text/javascript" src="../bower_components/angular-schema-form-datepicker/bootstrap-datepicker.min.js"></script>
@@ -287,13 +287,15 @@ <h3>Schema</h3>
287287
app.controller('TestCtrl', function($scope, $http, $location) {
288288

289289
$scope.tests = [
290+
/*{ name: "Autocomplete", data: 'data/autocomplete.json' },*/
290291
{ name: "Simple", data: 'data/simple.json' },
291292
{ name: "Basic JSON Schema Type", data: 'data/types.json' },
292293
{ name: "TitleMap Examples", data: 'data/titlemaps.json' },
293-
{ name: "Bootstrap Grid", data: 'data/grid.json' },
294-
{ name: "Complex Key Support", data: 'data/complex-keys.json' },
295-
{ name: "Array", data: 'data/array.json' },
296-
{ name: "Tab Array", data: 'data/tabarray.json' },
294+
/*{ name: "Material FLex Grid", data: 'data/grid.json' },*/
295+
/*{ name: "Complex Key Support", data: 'data/complex-keys.json' },*/
296+
/*{ name: "Array", data: 'data/array.json' },*/
297+
/*{ name: "Tab Array", data: 'data/tabarray.json' },*/
298+
{ name: "Tabs", data: 'data/tabs.json' },
297299
{ name: "Kitchen Sink", data: 'data/sink.json' },
298300
{ name: "Hack: Conditional required", data: 'data/conditional-required.json' },
299301
];

material-decorator.js

+46-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)