Skip to content

Commit 7d5769f

Browse files
committed
Merge branch 'release/0.7.11'
2 parents a9d66c7 + 8062cf0 commit 7d5769f

File tree

10 files changed

+69
-18
lines changed

10 files changed

+69
-18
lines changed

Diff for: CHANGELOG

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
v0.7.11
2+
-------
3+
* New front page with a list of add-on:s based on a bower search! Thanks @unicornforce @Dervisevic @davidlgj
4+
* Twitter account, @ngSchemaForm, new releases will be announced here. Thanks @Dervisevic
5+
* copyValueTo form option. Thanks @Dervisevic
6+
17
v0.7.10
28
------
39
* Accessability additions, thanks @stramel

Diff for: README.md

+5-9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Angular Schema Form [![alt text][1.1]][1]
88

99
Generate forms from JSON schemas using AngularJS!
1010

11+
Web Page
12+
--------
13+
[http://textalk.github.io/angular-schema-form/](http://textalk.github.io/angular-schema-form/)
14+
1115
Demo Time!
1216
----------
1317
[Try out the example page](http://textalk.github.io/angular-schema-form/examples/bootstrap-example.html).
@@ -146,15 +150,7 @@ angular.module('myModule', ['schemaForm']);
146150

147151
Add-ons
148152
------
149-
There are a couple of add-ons, a date picker, a colorpicker and two wysiwyg editors.
150-
They have their own repos and you can find them here with usage instructions:
151-
152-
* [https://github.com/Textalk/angular-schema-form-datepicker](https://github.com/Textalk/angular-schema-form-datepicker)
153-
* [https://github.com/Textalk/angular-schema-form-colorpicker](https://github.com/Textalk/angular-schema-form-colorpicker)
154-
* [https://github.com/Textalk/angular-schema-form-tinymce](https://github.com/Textalk/angular-schema-form-tinymce)
155-
* [https://github.com/webcanvas/angular-schema-form-ckeditor](https://github.com/webcanvas/angular-schema-form-ckeditor)
156-
* [https://github.com/Textalk/angular-schema-form-fontpicker](https://github.com/Textalk/angular-schema-form-fontpicker)
157-
153+
There are several add-ons available, for a full list see the [web page](http://textalk.github.io/angular-schema-form/#third-party-addons).
158154
Your can also [create your own add-ons!](docs/extending.md)
159155

160156
Contributing

Diff for: bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dist/schema-form.js",
55
"dist/bootstrap-decorator.js"
66
],
7-
"version": "0.7.10",
7+
"version": "0.7.11",
88
"authors": [
99
"Textalk",
1010
"David Jensen <[email protected]>",

Diff for: dist/schema-form.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,7 @@ angular.module('schemaForm')
13791379
}
13801380
]);
13811381

1382-
angular.module('schemaForm').directive('schemaValidate', ['sfValidator', function(sfValidator) {
1382+
angular.module('schemaForm').directive('schemaValidate', ['sfValidator', 'sfSelect', function(sfValidator, sfSelect) {
13831383
return {
13841384
restrict: 'A',
13851385
scope: false,
@@ -1402,6 +1402,15 @@ angular.module('schemaForm').directive('schemaValidate', ['sfValidator', functio
14021402
};
14031403
var form = getForm();
14041404

1405+
if (form.copyValueTo) {
1406+
ngModel.$viewChangeListeners.push(function() {
1407+
var paths = form.copyValueTo;
1408+
angular.forEach(paths, function(path) {
1409+
sfSelect(path, scope.model, ngModel.$viewValue);
1410+
});
1411+
});
1412+
}
1413+
14051414
// Validate against the schema.
14061415

14071416
// Get in last of the parses so the parsed value has the correct type.
@@ -1436,7 +1445,6 @@ angular.module('schemaForm').directive('schemaValidate', ['sfValidator', functio
14361445
});
14371446
}
14381447

1439-
14401448
// Listen to an event so we can validate the input on request
14411449
scope.$on('schemaFormValidate', function() {
14421450

Diff for: 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.

Diff for: docs/extending.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ It takes the form definition as an argument.
109109
| schemaError() | The current error object from tv4js |
110110

111111

112-
### Setting up schema defualts
112+
### Setting up schema defaults
113113
So you got this shiny new add-on that adds a fancy field type, but feel a bit bummed out that you
114114
need to specify it in the form definition all the time? Fear not because you can also add a "rule"
115115
to map certain types and conditions in the schema to default to your type.
@@ -149,6 +149,19 @@ var datepicker = function(name, schema, options) {
149149
schemaFormProvider.defaults.string.unshift(datepicker);
150150
```
151151

152+
### Sharing your add-on with the world
153+
So you made an add-on, why not share it with us? On the front page,
154+
[http://textalk.github.io/angular-schema-form/](http://textalk.github.io/angular-schema-form/#third-party-addons), we
155+
maintain a list of add ons based on a query of the bower register, and we love to see your add-on
156+
there.
157+
158+
Any [bower](http://bower.io) package with a name starting with `angular-schema-form-` or that has
159+
the `keyword` `angular-schema-form-add-on` in its `bower.json` will be picked up. It's cached so
160+
there can be a delay of a day or so.
161+
162+
So [make a bower package](http://bower.io/docs/creating-packages/), add the keyword
163+
`angular-schema-form-add-on` and [register it](http://bower.io/docs/creating-packages/#register)!
164+
152165
Decorators
153166
----------
154167
Decorators are a second way to extend Schema Form, the thought being that you should easily be able

Diff for: docs/index.md

+12
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Documentation
1414
1. [Validation Messages](#validation-messages)
1515
1. [Inline feedback icons](#inline-feedback-icons)
1616
1. [ngModelOptions](#ngmodeloptions)
17+
1. [copyValueTo](#copyvalueto)
1718
1. [Specific options and types](#specific-options-and-types)
1819
1. [fieldset and section](#fieldset-and-section)
1920
1. [conditional](#conditional)
@@ -342,6 +343,7 @@ General options most field types can handle:
342343
// and their items will inherit it.
343344
htmlClass: "street foobar", // CSS Class(es) to be added to the container div
344345
fieldHtmlClass: "street" // CSS Class(es) to be added to field input (or similar)
346+
copyValueTo: ["address.street"] // Copy values to these schema keys.
345347
}
346348
```
347349
@@ -458,6 +460,16 @@ Ex.
458460
See [Global Options](#global-options) for an example how you set entire form
459461
to validate on blur.
460462
463+
### copyValueTo
464+
This option has a very specific use case. Imagine you have the same option in several places, but you want them to be controlled from just one field. You specify what keys the value should be copied to, and the *viewValue* will be copied to these keys on the model. **Note: changing the model directly will not copy the value, it's intended for copying user input**. The recieving fields can be shown, but the intent for them is to be hidden.
465+
466+
Ex.
467+
```javascript
468+
{
469+
key: "email.main",
470+
copyValueTo: ["email.confirm", "other.email"]
471+
}
472+
```
461473
462474
Specific options and types
463475
--------------------------

Diff for: examples/data/sink.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,14 @@
152152
{
153153
"title": "More stuff",
154154
"items": [
155-
"attributes",
155+
"attributes.eyecolor",
156+
"attributes.haircolor",
157+
{
158+
"key": "attributes.shoulders.left",
159+
"title": "Left shoulder",
160+
"description": "This value is copied to attributes.shoulders.right in the model",
161+
"copyValueTo": ["attributes.shoulders.right"]
162+
},
156163
{
157164
"key": "shoesize",
158165
"feedback": false

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "angular-schema-form",
3-
"version": "0.7.10",
3+
"version": "0.7.11",
44
"description": "Create complex forms from a JSON schema with angular.",
55
"repository": "Textalk/angular-schema-form",
66
"main": "dist/schema-form.min.js",
7+
"homepage": "http://textalk.github.io/angular-schema-form/",
78
"scripts": {
89
"test": "rm -fr coverage && ./node_modules/karma/bin/karma start --single-run --browsers PhantomJS karma.conf.js && find coverage/ -name lcov.info -print0 | xargs -0 cat | ./node_modules/coveralls/bin/coveralls.js"
910
},

Diff for: src/directives/schema-validate.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
angular.module('schemaForm').directive('schemaValidate', ['sfValidator', function(sfValidator) {
1+
angular.module('schemaForm').directive('schemaValidate', ['sfValidator', 'sfSelect', function(sfValidator, sfSelect) {
22
return {
33
restrict: 'A',
44
scope: false,
@@ -21,6 +21,15 @@ angular.module('schemaForm').directive('schemaValidate', ['sfValidator', functio
2121
};
2222
var form = getForm();
2323

24+
if (form.copyValueTo) {
25+
ngModel.$viewChangeListeners.push(function() {
26+
var paths = form.copyValueTo;
27+
angular.forEach(paths, function(path) {
28+
sfSelect(path, scope.model, ngModel.$viewValue);
29+
});
30+
});
31+
}
32+
2433
// Validate against the schema.
2534

2635
// Get in last of the parses so the parsed value has the correct type.
@@ -55,7 +64,6 @@ angular.module('schemaForm').directive('schemaValidate', ['sfValidator', functio
5564
});
5665
}
5766

58-
5967
// Listen to an event so we can validate the input on request
6068
scope.$on('schemaFormValidate', function() {
6169

0 commit comments

Comments
 (0)