Skip to content

Commit c63c687

Browse files
committed
Module docs clarification
1 parent 982e031 commit c63c687

File tree

2 files changed

+53
-36
lines changed

2 files changed

+53
-36
lines changed

README.md

Lines changed: 50 additions & 35 deletions
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.
@@ -67,11 +74,6 @@ Then load them into Schema Form using the `sfSchema`, `sfForm`, and `sfModel` di
6774
</div>
6875
```
6976

70-
When you are done downloading all the [dependecies](#dependencies) and project files the only remaining part is to add dependencies on the `'schemaForm'` AngularJS module:
71-
72-
```javascript
73-
angular.module('myModule', ['schemaForm']);
74-
```
7577

7678
Documentation
7779
-------------
@@ -137,22 +139,45 @@ also needs to be loaded *before* Schema Form.
137139
<script type="text/javascript" src="bower_components/angular-schema-form/dist/bootstrap-decorator.min.js"></script>
138140
```
139141

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+
```
140148

141149
Add-ons
142150
------
143-
There is currently two add-ons, a date picker and a colorpicker. They have their own repos and you
144-
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:
145153

146154
* [https://github.com/Textalk/angular-schema-form-datepicker](https://github.com/Textalk/angular-schema-form-datepicker)
147155
* [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.
148172

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

151174
Building
152175
--------
153-
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/).
154178

155-
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.
156181

157182
```bash
158183
$ npm install
@@ -161,13 +186,17 @@ $ bower install
161186
$ gulp
162187
```
163188

164-
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.
165192

166193
You can also run `gulp watch` to have it rebuild on change.
167194

168195
Tests
169196
-----
170-
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/)
171200

172201
To run the tests:
173202

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

docs/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ Basic Usage
3131
-----------
3232

3333
First, expose your schema, form, and model to the $scope.
34+
Don't forget to load the ``schemaForm` module.
3435

3536
```javascript
36-
function FormController($scope) {
37+
angular.module('myModule', ['schemaForm'])
38+
.controller('FormController', function($scope) {
3739
$scope.schema = {
3840
type: "object",
3941
properties: {

0 commit comments

Comments
 (0)