Skip to content

Commit e808f6f

Browse files
committed
Readme: How it should be used
Package update, added Comments, missing ;
1 parent 81af0ee commit e808f6f

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,42 @@ Quickly generate your your schema form using this GUI builder.
55
# Roadmap
66

77
- Complete support of all elements based on schema-form
8+
- Support for editing existing Schemas & Forms
89
- Provide source definition for different platforms
910
- 100% test coverage
1011

12+
13+
14+
#Basic Usage
15+
16+
**This is what using the Schema Form Builder should look like:**
17+
First, expose your (exinsting) schema and form to the $scope.
18+
19+
```javascript
20+
angular.module('myModule', ['schemaFormBuilder'])
21+
.controller('FormBuilderController', function($scope) {
22+
// JSON Schema
23+
// add an existing schema to edit it
24+
// or leave blank to create a new form
25+
$scope.schema = {};
26+
27+
// Schema Form Defintion
28+
// add an existing form definition for editing
29+
// or leave blank to create a new form
30+
$scope.form = [];
31+
32+
33+
});
34+
```
35+
36+
Then load them into the Schema Form Builder using the `sfbSchema` and `sfbForm` directives.
37+
38+
```html
39+
<div ng-controller="FormBuilderController">
40+
<div sfb-schema="schema" sfb-form="form"></form>
41+
</div>
42+
```
43+
44+
1145
# Simply need a html form?
1246
To generate vanilla/bootstrap/material forms checkout ralphowino.github.com/form-builder

app/builder/controllers/builder-controller.es6

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
constructor(Converter, growl, locker, $scope, $uibModal) {
66
let vm = this;
77

8+
// all available / saved forms
89
vm.forms = locker.get('schema_forms', {
910
'sample_form': {
1011
name: 'Sample Form',
@@ -64,6 +65,7 @@
6465
}
6566
});
6667

68+
// describing properties of each form field
6769
vm.schema = {
6870
type: 'object',
6971
title: 'Comment',
@@ -223,7 +225,11 @@
223225
},
224226
required: ['name']
225227
};
228+
229+
// holding properties of each form field
226230
vm.model = {};
231+
232+
// describing the layout of the builder fields
227233
vm.form = [
228234
{
229235
type: 'section',
@@ -436,6 +442,8 @@
436442
]
437443
}
438444
];
445+
446+
// the resulting schema and form definitions
439447
vm.output = {schema: {}, form: []};
440448

441449
vm.saveForm = (form) => {

app/builder/factories/converter-factory.es6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
let index = _.findKey(output.form, 'key', key);
5858
output.form[index][attr] = value;
5959
return output;
60-
}
60+
};
6161

6262
ConverterBase.generateTextField = (field, output) => {
6363
output.schema.properties[field.key]['type'] = 'string';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"eslint-plugin-angular": "^0.2.0",
1717
"find-up": "^1.0.0",
1818
"glob": "^5.0.1",
19-
"gulp": "^3.8.7",
19+
"gulp": "^3.9.1",
2020
"gulp-angular-filesort": "^1.0.4",
2121
"gulp-autoprefixer": "^2.0.0",
2222
"gulp-babel": "^5.0.0",

0 commit comments

Comments
 (0)