Skip to content

Commit 186f23c

Browse files
committed
Merge branch 'release/0.7.5'
2 parents 9a1b936 + d1c0a95 commit 186f23c

File tree

9 files changed

+78
-52
lines changed

9 files changed

+78
-52
lines changed

CHANGELOG

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
v0.7.5
2+
------
3+
* Bracket notation for reserved words to make IE8 happier,thanks @jibwa
4+
* Clarification of module loading in docs, thanks @CoderAjay
5+
16
v0.7.4
27
------
38
* bower.json fixes, thanks @mike-marcacci, @morrislaptop
@@ -9,7 +14,7 @@ v0.7.4
914
* step="any" so a HTML5 input doesn't default to 1 and break float validation
1015
* Allow for a pre-existing layout where fields will be inserted, thanks @ebrehault
1116
Docs are missing but lock at PR #112.
12-
* Better "readonly" support, thanks @mike-marcacci!
17+
* Better "readonly" support, thanks @mike-marcacci!
1318

1419
v0.7.3
1520
------

README.md

+50-31
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,31 @@ Angular Schema Form
77

88
Generate forms from JSON schemas using AngularJS!
99

10-
### [Try out the example page](http://textalk.github.io/angular-schema-form/examples/bootstrap-example.html)
10+
Demo Time!
11+
----------
12+
[Try out the example page](http://textalk.github.io/angular-schema-form/examples/bootstrap-example.html).
1113
Try editing the schema or form definition and see what comes out!
1214

1315
What is it?
1416
----------
1517

16-
Schema Form is a set of AngularJS directives (and a couple of services). It can do two things to make life easier:
18+
Schema Form is a set of AngularJS directives (and a couple of services). It can do two things to
19+
make life easier:
1720

1821
1. Create a form directly from a JSON schema.
1922
2. Validate form fields against that same JSON schema.
2023

21-
Schema Form uses convention over configuration, so it comes packaged with some sensible defaults. But you can always customize it by changing the order and types of form fields.
24+
Schema Form uses convention over configuration, so it comes packaged with some sensible defaults.
25+
But you can always customize it by changing the order and types of form fields.
2226

23-
JSON Form
24-
---------
25-
Schema Form is inspired by the nice [JSON Form](https://github.com/joshfire/jsonform) library and aims to be roughly compatible with it, especially its form definition. So what sets Schema Form apart from JSON Form?
27+
#### JSON Form
28+
Schema Form is inspired by the nice [JSON Form](https://github.com/joshfire/jsonform) library and
29+
aims to be roughly compatible with it, especially its form definition. So what sets Schema Form
30+
apart from JSON Form?
2631

2732
1. Schema Form integrates deeply with AngularJS and uses AngularJS conventions to handle forms.
28-
2. Schema Form uses [tv4](https://github.com/geraintluff/tv4) for validation, making it compatible with version 4 of the JSON schema standard.
33+
2. Schema Form uses [tv4](https://github.com/geraintluff/tv4) for validation, making it compatible
34+
with version 4 of the JSON schema standard.
2935
3. By default, Schema Form generates Bootstrap 3-friendly HTML.
3036

3137

@@ -35,7 +41,8 @@ Basic Usage
3541
First, expose your schema, form, and model to the $scope.
3642

3743
```javascript
38-
function FormController($scope) {
44+
angular.module('myModule', ['schemaForm'])
45+
.controller('FormController', function($scope) {
3946
$scope.schema = {
4047
type: "object",
4148
properties: {
@@ -56,7 +63,7 @@ function FormController($scope) {
5663
];
5764

5865
$scope.model = {};
59-
}
66+
});
6067
```
6168

6269
Then load them into Schema Form using the `sfSchema`, `sfForm`, and `sfModel` directives.
@@ -68,7 +75,6 @@ Then load them into Schema Form using the `sfSchema`, `sfForm`, and `sfModel` di
6875
```
6976

7077

71-
7278
Documentation
7379
-------------
7480
Documentation covering defaults and form types [can be found here.](docs/index.md)
@@ -133,22 +139,45 @@ also needs to be loaded *before* Schema Form.
133139
<script type="text/javascript" src="bower_components/angular-schema-form/dist/bootstrap-decorator.min.js"></script>
134140
```
135141

142+
### Module loading
143+
Don't forget to load the `schemaForm` module or nothing will happen.
144+
145+
```javascript
146+
angular.module('myModule', ['schemaForm']);
147+
```
136148

137149
Add-ons
138150
------
139-
There is currently two add-ons, a date picker and a colorpicker. They have their own repos and you
140-
can find them here with usage instructions:
151+
There is currently three add-ons, a date picker, a colorpicker and the wysiwyg html editor tinymce.
152+
They have their own repos and you can find them here with usage instructions:
141153

142154
* [https://github.com/Textalk/angular-schema-form-datepicker](https://github.com/Textalk/angular-schema-form-datepicker)
143155
* [https://github.com/Textalk/angular-schema-form-colorpicker](https://github.com/Textalk/angular-schema-form-colorpicker)
156+
* [https://github.com/Textalk/angular-schema-form-tinymce](https://github.com/Textalk/angular-schema-form-tinymce)
157+
158+
Your can also [create your own add-ons!](docs/extending.md)
159+
160+
Contributing
161+
------------
162+
163+
All contributions are welcome! If its a new field type consider making it an add-on instead,
164+
especially if it has dependecies. See [extending Schema Form documentation.](docs/extending.md)
165+
166+
We're trying to use
167+
[git flow](http://danielkummer.github.io/git-flow-cheatsheet/), *so please base any merge request on the **development** branch instead of **master**.*
168+
169+
Also run any code through the code style checker [jscs](https://github.com/mdevils/node-jscs)
170+
(or even better use it in your editor) with preset set to `google`. You can also us `gulp jscs` to
171+
check your code.
144172

145-
Your can also [create your own add-ons.](docs/extending.md)
146173

147174
Building
148175
--------
149-
The files in the `dist/` folder, plus dependencies, are all you need to use Schema Form. But if you'd like to build it yourself, we use [gulp](http://gulpjs.com/).
176+
The files in the `dist/` folder, plus dependencies, are all you need to use Schema Form. But if
177+
you'd like to build it yourself, we use [gulp](http://gulpjs.com/).
150178

151-
First off, you need to have nodejs installed. Then install all dev dependencies of the project with npm, install gulp and run the default task.
179+
First off, you need to have nodejs installed. Then install all dev dependencies of the
180+
project with npm, install gulp and run the default task.
152181

153182
```bash
154183
$ npm install
@@ -157,13 +186,17 @@ $ bower install
157186
$ gulp
158187
```
159188

160-
The default task uses [gulp-angular-templatecache](https://github.com/miickel/gulp-angular-templatecache) to compile all html templates to js and then concatenates and minifies them with the rest of the sources.
189+
The default task uses
190+
[gulp-angular-templatecache](https://github.com/miickel/gulp-angular-templatecache) to compile all
191+
html templates to js and then concatenates and minifies them with the rest of the sources.
161192

162193
You can also run `gulp watch` to have it rebuild on change.
163194

164195
Tests
165196
-----
166-
Unit tests are run with [karma](http://karma-runner.github.io) and written using [mocha](http://visionmedia.github.io/mocha/), [chai](http://chaijs.com/) and [sinon](http://sinonjs.org/)
197+
Unit tests are run with [karma](http://karma-runner.github.io) and written using
198+
[mocha](http://visionmedia.github.io/mocha/), [chai](http://chaijs.com/) and
199+
[sinon](http://sinonjs.org/)
167200

168201
To run the tests:
169202

@@ -178,17 +211,3 @@ $ bower install
178211
$ sudo npm install -g karma-cli
179212
$ karma start karma.conf.js
180213
```
181-
182-
Contributing
183-
------------
184-
185-
All contributions are welcome! If its a new field type consider making it an add-on instead,
186-
especially if it has dependecies. See [extending Schema Form documentation.](docs/extending.md)
187-
188-
We're trying to use
189-
[git flow](http://danielkummer.github.io/git-flow-cheatsheet/), so please base any merge request
190-
on the **development** branch instead of **master**.
191-
192-
Also run any code through the code style checker [jscs](https://github.com/mdevils/node-jscs)
193-
(or even better use it in your editor) with preset set to `google`. You can also us `gulp jscs` to
194-
check your code.

bower.json

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

dist/schema-form.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ angular.module('schemaForm').provider('schemaForm',
508508

509509
//Non standard attributes
510510
if (schema.validationMessage) { f.validationMessage = schema.validationMessage; }
511-
if (schema.enumNames) { f.titleMap = canonicalTitleMap(schema.enumNames, schema.enum); }
511+
if (schema.enumNames) { f.titleMap = canonicalTitleMap(schema.enumNames, schema['enum']); }
512512
f.schema = schema;
513513

514514
// Ng model options doesn't play nice with undefined, might be defined
@@ -518,7 +518,7 @@ angular.module('schemaForm').provider('schemaForm',
518518
};
519519

520520
var text = function(name, schema, options) {
521-
if (schema.type === 'string' && !schema.enum) {
521+
if (schema.type === 'string' && !schema['enum']) {
522522
var f = stdFormObj(name, schema, options);
523523
f.key = options.path;
524524
f.type = 'text';
@@ -560,25 +560,25 @@ angular.module('schemaForm').provider('schemaForm',
560560
};
561561

562562
var select = function(name, schema, options) {
563-
if (schema.type === 'string' && schema.enum) {
563+
if (schema.type === 'string' && schema['enum']) {
564564
var f = stdFormObj(name, schema, options);
565565
f.key = options.path;
566566
f.type = 'select';
567567
if (!f.titleMap) {
568-
f.titleMap = enumToTitleMap(schema.enum);
568+
f.titleMap = enumToTitleMap(schema['enum']);
569569
}
570570
options.lookup[sfPathProvider.stringify(options.path)] = f;
571571
return f;
572572
}
573573
};
574574

575575
var checkboxes = function(name, schema, options) {
576-
if (schema.type === 'array' && schema.items && schema.items.enum) {
576+
if (schema.type === 'array' && schema.items && schema.items['enum']) {
577577
var f = stdFormObj(name, schema, options);
578578
f.key = options.path;
579579
f.type = 'checkboxes';
580580
if (!f.titleMap) {
581-
f.titleMap = enumToTitleMap(schema.items.enum);
581+
f.titleMap = enumToTitleMap(schema.items['enum']);
582582
}
583583
options.lookup[sfPathProvider.stringify(options.path)] = f;
584584
return f;
@@ -1024,8 +1024,8 @@ angular.module('schemaForm').directive('sfArray', ['sfSelect', 'schemaForm', 'sf
10241024
var len = list.length;
10251025
var copy = scope.copyWithIndex(len);
10261026
schemaForm.traverseForm(copy, function(part) {
1027-
if (part.key && angular.isDefined(part.default)) {
1028-
sfSelect(part.key, scope.model, part.default);
1027+
if (part.key && angular.isDefined(part['default'])) {
1028+
sfSelect(part.key, scope.model, part['default']);
10291029
}
10301030
});
10311031

0 commit comments

Comments
 (0)