Skip to content

Commit a24eebc

Browse files
committed
Example and tests include hiding Add and Remove
The example has been extended to include 4 tab array demos: standard, add link disabled, remove button disabled and drag and drop sortable. The protractor tests have been extended to test add link disabled and remove button disabled.
1 parent 857b5f8 commit a24eebc

File tree

5 files changed

+312
-132
lines changed

5 files changed

+312
-132
lines changed

examples/sortable-tabarray.html

-68
This file was deleted.

examples/tabarray.html

+202
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
<!doctype html>
2+
<head>
3+
<meta charset="utf-8">
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
5+
<title>Tab Array Demo</title>
6+
<meta name="description" content="">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<link rel="apple-touch-icon" href="apple-touch-icon.png">
9+
10+
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">
11+
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap-theme.min.css">
12+
<link rel="stylesheet" href="../bower_components/bootstrap-vertical-tabs/bootstrap.vertical-tabs.min.css">
13+
14+
<script type="text/javascript" src="../bower_components/jquery/dist/jquery.min.js"></script>
15+
<script type="text/javascript" src="../bower_components/angular/angular.min.js"></script>
16+
<script type="text/javascript" src="../bower_components/angular-sanitize/angular-sanitize.min.js"></script>
17+
<script type="text/javascript" src="../bower_components/tv4/tv4.js"></script>
18+
<script type="text/javascript" src="../bower_components/objectpath/lib/ObjectPath.js"></script>
19+
<script type="text/javascript" src="../bower_components/angular-schema-form/dist/schema-form.js"></script>
20+
<script type="text/javascript" src="../bootstrap-decorator.js"></script>
21+
<script type="text/javascript" src="../bower_components/angular-ui-sortable/sortable.min.js"></script>
22+
<script type="text/javascript" src="../bower_components/jquery-ui/jquery-ui.min.js"></script>
23+
24+
<script type="text/javascript">
25+
var exampleApp = angular.module('exampleApp',['schemaForm', 'ui.sortable']);
26+
27+
exampleApp.controller('exampleCtrl', ['$scope', function($scope) {
28+
29+
$scope.model = {
30+
"exampleSelector": "standard"
31+
};
32+
33+
$scope.schema = {
34+
"type": "object",
35+
"properties": {
36+
"exampleSelector": {
37+
"type": "string",
38+
"title": "Tab Array Example Selector",
39+
"enum": [
40+
"standard",
41+
"addDisabled",
42+
"removeDisabled",
43+
"sortable"
44+
]
45+
},
46+
"standardTabArray": {
47+
"type": "array",
48+
"items": {
49+
"type": "object",
50+
"properties": {
51+
"name": { "type": "string" },
52+
"nick": { "type": "string" }
53+
}
54+
}
55+
},
56+
"addDisabledTabArray": {
57+
"type": "array",
58+
"items": {
59+
"type": "object",
60+
"properties": {
61+
"name": { "type": "string" },
62+
"nick": { "type": "string" }
63+
}
64+
}
65+
},
66+
"removeDisabledTabArray": {
67+
"type": "array",
68+
"items": {
69+
"type": "object",
70+
"properties": {
71+
"name": { "type": "string" },
72+
"nick": { "type": "string" }
73+
}
74+
}
75+
},
76+
"sortableTabArray": {
77+
"type": "array",
78+
"items": {
79+
"type": "object",
80+
"properties": {
81+
"name": { "type": "string" },
82+
"nick": { "type": "string" }
83+
}
84+
}
85+
}
86+
}
87+
};
88+
89+
$scope.form = [
90+
{
91+
"key": "exampleSelector",
92+
"titleMap": [
93+
{"value": "standard", "name": "Standard"},
94+
{"value": "addDisabled", "name": "Add Disabled"},
95+
{"value": "removeDisabled", "name": "Remove Disabled"},
96+
{"value": "sortable", "name": "Sortable"}
97+
]
98+
},
99+
{
100+
"type": "section",
101+
"condition": "model.exampleSelector == 'standard'",
102+
"title": "",
103+
"htmlCss": "row",
104+
"items": [
105+
{
106+
"type": "help",
107+
"helpvalue": "<h4>Standard tab array</h4>"
108+
},
109+
{
110+
"key": "standardTabArray",
111+
"type": "tabarray",
112+
"title": "My name is: {{ value.name }}",
113+
"sortOptions": {
114+
"disabled": true
115+
},
116+
"items" : [
117+
{"key": "standardTabArray[].name", "htmlClass": "nameField"},
118+
{"key": "standardTabArray[].nick", "htmlClass": "nickField"}
119+
]
120+
},
121+
]
122+
},
123+
{
124+
"type": "section",
125+
"condition": "model.exampleSelector == 'addDisabled'",
126+
"htmlCss": "row",
127+
"items": [
128+
{
129+
"type": "help",
130+
"helpvalue": "<h4>Tab array with add link hidden</h4>"
131+
},
132+
{
133+
"key": "addDisabledTabArray",
134+
"type": "tabarray",
135+
"add": null,
136+
"title": "My name is: {{ value.name }}",
137+
"sortOptions": {
138+
"disabled": true
139+
},
140+
"items" : [
141+
{"key": "addDisabledTabArray[].name", "htmlClass": "nameField"},
142+
{"key": "addDisabledTabArray[].nick", "htmlClass": "nickField"}
143+
]
144+
}
145+
]
146+
},
147+
{
148+
"type": "section",
149+
"condition": "model.exampleSelector == 'removeDisabled'",
150+
"htmlCss": "row",
151+
"items": [
152+
{
153+
"type": "help",
154+
"helpvalue": "<h4>Tab array with remove button hidden</h4>"
155+
},
156+
{
157+
"key": "removeDisabledTabArray",
158+
"type": "tabarray",
159+
"remove": null,
160+
"title": "My name is: {{ value.name }}",
161+
"sortOptions": {
162+
"disabled": true
163+
},
164+
"items" : [
165+
{"key": "removeDisabledTabArray[].name", "htmlClass": "nameField"},
166+
{"key": "removeDisabledTabArray[].nick", "htmlClass": "nickField"}
167+
]
168+
}
169+
]
170+
},
171+
{
172+
"type": "section",
173+
"condition": "model.exampleSelector == 'sortable'",
174+
"htmlCss": "row",
175+
"items": [
176+
{
177+
"type": "help",
178+
"helpvalue": "<h4>Drag and drop sortable tab array</h4>"
179+
},
180+
{
181+
"key": "sortableTabArray",
182+
"type": "tabarray",
183+
"title": "My name is: {{ value.name }}",
184+
"items" : [
185+
{"key": "sortableTabArray[].name", "htmlClass": "nameField"},
186+
{"key": "sortableTabArray[].nick", "htmlClass": "nickField"}
187+
]
188+
}
189+
]
190+
}
191+
];
192+
}]);
193+
</script>
194+
</head>
195+
<body ng-app="exampleApp" class="container">
196+
<h3>Tab Array Demo</h3>
197+
<p>Drag and drop tabs to order the elements in the array</p>
198+
<div class="container" ng-controller="exampleCtrl" style="margin: 0 auto;width: 100%;">
199+
<form sf-schema="schema" sf-form="form" sf-model="model"></form>
200+
</div>
201+
</body>
202+
</html>

gulp/tasks/protractor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ gulp.task('protractor', ['webdriver-update'], function(cb) {
2727
}).on('end', cb);
2828
});
2929

30-
['validation-messages', 'custom-validation', 'sortable-tabarray'].forEach(function(name) {
30+
['validation-messages', 'custom-validation', 'tabarray'].forEach(function(name) {
3131
gulp.task('protractor:' + name, ['webdriver-update'], function(cb) {
3232
gulp.src(['test/protractor/specs/' + name + '.js']).pipe(protractor.protractor({
3333
configFile: 'test/protractor/conf.js',

test/protractor/specs/sortable-tabarray.js

-63
This file was deleted.

0 commit comments

Comments
 (0)