Skip to content

Commit

Permalink
Merge branch 'hotfix/builder-fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlgj committed Sep 30, 2015
2 parents e29b688 + 325e48a commit 7f29822
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -5,3 +5,5 @@ node_js:
before_script:
- npm install -g bower
- bower install

sudo: false
6 changes: 6 additions & 0 deletions CHANGELOG
@@ -1,3 +1,9 @@
v0.8.12
-------
* Bugfix for `condition` builder. It had a typo that broke it.
* Bugfix for `transclusion` builder.


v0.8.11
-------
* Bugfix for checkboxes validation in the new builder.
Expand Down
16 changes: 9 additions & 7 deletions dist/schema-form.js
Expand Up @@ -232,12 +232,14 @@ angular.module('schemaForm').provider('sfBuilder', ['sfPathProvider', function(s
for (var i = 0; i < transclusions.length; i++) {
var n = transclusions[i];

// The sf-transclude attribute is not a directive, but has the name of what we're supposed to
// traverse.
var sub = args.form[n.getAttribute('sf-field-transclude')];
if (sub) {
sub = Array.isArray(sub) ? sub : [sub];
var childFrag = args.build(sub, args.path + '.' + sub, args.state);
// The sf-transclude attribute is not a directive,
// but has the name of what we're supposed to
// traverse. Default to `items`
var sub = n.getAttribute('sf-field-transclude') || 'items';
var items = args.form[sub];

if (items) {
var childFrag = args.build(items, args.path + '.' + sub, args.state);
n.appendChild(childFrag);
}
}
Expand All @@ -248,7 +250,7 @@ angular.module('schemaForm').provider('sfBuilder', ['sfPathProvider', function(s
// but be nice to existing ng-if.
if (args.form.condition) {
var evalExpr = 'evalExpr(' + args.path +
'.contidion, { model: model, "arrayIndex": $index})';
'.condition, { model: model, "arrayIndex": $index})';
if (args.form.key) {
var strKey = sfPathProvider.stringify(args.form.key);
evalExpr = 'evalExpr(' + args.path + '.condition,{ model: model, "arrayIndex": $index, ' +
Expand Down
2 changes: 1 addition & 1 deletion dist/schema-form.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "angular-schema-form",
"version": "0.8.11",
"version": "0.8.12",
"description": "Create complex forms from a JSON schema with angular.",
"repository": "Textalk/angular-schema-form",
"main": "dist/schema-form.min.js",
Expand Down
16 changes: 9 additions & 7 deletions src/services/builder.js
Expand Up @@ -90,12 +90,14 @@ angular.module('schemaForm').provider('sfBuilder', ['sfPathProvider', function(s
for (var i = 0; i < transclusions.length; i++) {
var n = transclusions[i];

// The sf-transclude attribute is not a directive, but has the name of what we're supposed to
// traverse.
var sub = args.form[n.getAttribute('sf-field-transclude')];
if (sub) {
sub = Array.isArray(sub) ? sub : [sub];
var childFrag = args.build(sub, args.path + '.' + sub, args.state);
// The sf-transclude attribute is not a directive,
// but has the name of what we're supposed to
// traverse. Default to `items`
var sub = n.getAttribute('sf-field-transclude') || 'items';
var items = args.form[sub];

if (items) {
var childFrag = args.build(items, args.path + '.' + sub, args.state);
n.appendChild(childFrag);
}
}
Expand All @@ -106,7 +108,7 @@ angular.module('schemaForm').provider('sfBuilder', ['sfPathProvider', function(s
// but be nice to existing ng-if.
if (args.form.condition) {
var evalExpr = 'evalExpr(' + args.path +
'.contidion, { model: model, "arrayIndex": $index})';
'.condition, { model: model, "arrayIndex": $index})';
if (args.form.key) {
var strKey = sfPathProvider.stringify(args.form.key);
evalExpr = 'evalExpr(' + args.path + '.condition,{ model: model, "arrayIndex": $index, ' +
Expand Down

0 comments on commit 7f29822

Please sign in to comment.