Skip to content

Commit 7f29822

Browse files
committed
Merge branch 'hotfix/builder-fixes'
2 parents e29b688 + 325e48a commit 7f29822

File tree

6 files changed

+28
-16
lines changed

6 files changed

+28
-16
lines changed

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ node_js:
55
before_script:
66
- npm install -g bower
77
- bower install
8+
9+
sudo: false

CHANGELOG

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
v0.8.12
2+
-------
3+
* Bugfix for `condition` builder. It had a typo that broke it.
4+
* Bugfix for `transclusion` builder.
5+
6+
17
v0.8.11
28
-------
39
* Bugfix for checkboxes validation in the new builder.

dist/schema-form.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,14 @@ angular.module('schemaForm').provider('sfBuilder', ['sfPathProvider', function(s
232232
for (var i = 0; i < transclusions.length; i++) {
233233
var n = transclusions[i];
234234

235-
// The sf-transclude attribute is not a directive, but has the name of what we're supposed to
236-
// traverse.
237-
var sub = args.form[n.getAttribute('sf-field-transclude')];
238-
if (sub) {
239-
sub = Array.isArray(sub) ? sub : [sub];
240-
var childFrag = args.build(sub, args.path + '.' + sub, args.state);
235+
// The sf-transclude attribute is not a directive,
236+
// but has the name of what we're supposed to
237+
// traverse. Default to `items`
238+
var sub = n.getAttribute('sf-field-transclude') || 'items';
239+
var items = args.form[sub];
240+
241+
if (items) {
242+
var childFrag = args.build(items, args.path + '.' + sub, args.state);
241243
n.appendChild(childFrag);
242244
}
243245
}
@@ -248,7 +250,7 @@ angular.module('schemaForm').provider('sfBuilder', ['sfPathProvider', function(s
248250
// but be nice to existing ng-if.
249251
if (args.form.condition) {
250252
var evalExpr = 'evalExpr(' + args.path +
251-
'.contidion, { model: model, "arrayIndex": $index})';
253+
'.condition, { model: model, "arrayIndex": $index})';
252254
if (args.form.key) {
253255
var strKey = sfPathProvider.stringify(args.form.key);
254256
evalExpr = 'evalExpr(' + args.path + '.condition,{ model: model, "arrayIndex": $index, ' +

dist/schema-form.min.js

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

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-schema-form",
3-
"version": "0.8.11",
3+
"version": "0.8.12",
44
"description": "Create complex forms from a JSON schema with angular.",
55
"repository": "Textalk/angular-schema-form",
66
"main": "dist/schema-form.min.js",

src/services/builder.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ angular.module('schemaForm').provider('sfBuilder', ['sfPathProvider', function(s
9090
for (var i = 0; i < transclusions.length; i++) {
9191
var n = transclusions[i];
9292

93-
// The sf-transclude attribute is not a directive, but has the name of what we're supposed to
94-
// traverse.
95-
var sub = args.form[n.getAttribute('sf-field-transclude')];
96-
if (sub) {
97-
sub = Array.isArray(sub) ? sub : [sub];
98-
var childFrag = args.build(sub, args.path + '.' + sub, args.state);
93+
// The sf-transclude attribute is not a directive,
94+
// but has the name of what we're supposed to
95+
// traverse. Default to `items`
96+
var sub = n.getAttribute('sf-field-transclude') || 'items';
97+
var items = args.form[sub];
98+
99+
if (items) {
100+
var childFrag = args.build(items, args.path + '.' + sub, args.state);
99101
n.appendChild(childFrag);
100102
}
101103
}
@@ -106,7 +108,7 @@ angular.module('schemaForm').provider('sfBuilder', ['sfPathProvider', function(s
106108
// but be nice to existing ng-if.
107109
if (args.form.condition) {
108110
var evalExpr = 'evalExpr(' + args.path +
109-
'.contidion, { model: model, "arrayIndex": $index})';
111+
'.condition, { model: model, "arrayIndex": $index})';
110112
if (args.form.key) {
111113
var strKey = sfPathProvider.stringify(args.form.key);
112114
evalExpr = 'evalExpr(' + args.path + '.condition,{ model: model, "arrayIndex": $index, ' +

0 commit comments

Comments
 (0)