Skip to content

Commit e61c8e0

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master' into directive
# Conflicts: # README.md
2 parents db99b7c + acf996e commit e61c8e0

25 files changed

+485
-722
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,47 @@ Quickly generate your your schema form using this GUI builder.
77
# Roadmap
88

99
- Complete support of all elements based on schema-form
10+
- Support for editing existing Schemas & Forms
1011
- Provide source definition for different platforms
1112
- 100% test coverage
1213

14+
<<<<<<< HEAD
1315
# Demo
1416
There is a live demo at http://ralphowino.github.io/schema-form-builder
17+
=======
18+
19+
20+
#Basic Usage
21+
22+
**This is what using the Schema Form Builder should look like:**
23+
First, expose your (exinsting) schema and form to the $scope.
24+
25+
```javascript
26+
angular.module('myModule', ['schemaFormBuilder'])
27+
.controller('FormBuilderController', function($scope) {
28+
// JSON Schema
29+
// add an existing schema to edit it
30+
// or leave blank to create a new form
31+
$scope.schema = {};
32+
33+
// Schema Form Defintion
34+
// add an existing form definition for editing
35+
// or leave blank to create a new form
36+
$scope.form = [];
37+
38+
39+
});
40+
```
41+
42+
Then load them into the Schema Form Builder using the `sfbSchema` and `sfbForm` directives.
43+
44+
```html
45+
<div ng-controller="FormBuilderController">
46+
<div sfb-schema="schema" sfb-form="form"></form>
47+
</div>
48+
```
49+
50+
>>>>>>> refs/remotes/origin/master
1551
1652
# Simply need a html form?
1753
To generate vanilla/bootstrap/material forms check out ralphowino.github.com/form-builder

app/app-controller.es6

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
angular.module('schemaFormBuilderApp').controller('FormBuilderController',function ($scope) {
2+
// JSON Schema
3+
// add an existing schema to edit it
4+
// or leave blank to create a new form
5+
$scope.schema = {};
6+
7+
// Schema Form Defintion
8+
// add an existing form definition for editing
9+
// or leave blank to create a new form
10+
$scope.form = [];
11+
12+
13+
$scope.$watch(function () {
14+
return $scope.schema;
15+
}, function (update) {
16+
window.console.log("schema udpated");
17+
//window.console.log("Schema Update: " + JSON.stringify(update));
18+
//window.console.log("Form Update: " + JSON.stringify($scope.form));
19+
}, true);
20+
21+
$scope.newForm = function () {
22+
$scope.model = {
23+
fields: []
24+
};
25+
}
26+
27+
$scope.model = {
28+
type: 'schema-form',
29+
fields: [
30+
{
31+
type: 'text',
32+
key: 'first_name',
33+
title: 'First name',
34+
open: false
35+
},
36+
{
37+
type: 'text',
38+
key: 'last_name',
39+
title: 'Last name',
40+
open: false
41+
},
42+
{
43+
type: 'email',
44+
key: 'email',
45+
title: 'Email',
46+
open: false,
47+
showAdvance: true,
48+
fieldAddonRight:'<i class="glyphicon glyphicon-envelope"></i>'
49+
},
50+
{
51+
type: 'date',
52+
key: 'dob',
53+
title: 'Date of Birth',
54+
open: false
55+
},
56+
{
57+
type: 'dropdown',
58+
key: 'marital-status',
59+
title: 'Marital Status',
60+
open: false
61+
},
62+
{
63+
type: 'date-time',
64+
key: 'check-in',
65+
title: 'Check In',
66+
open: false
67+
},
68+
{
69+
type: 'date-time',
70+
key: 'check-out',
71+
title: 'Check Out',
72+
open: false
73+
},
74+
{
75+
type: 'textarea',
76+
key: 'bio',
77+
title: 'Biography',
78+
open: false
79+
}
80+
]
81+
};
82+
});

app/app-module.es6

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
'use strict';
33

44
/* @ngdoc object
5-
* @name schemaFormBuilder
5+
* @name schemaFormBuilderApp
66
* @description
77
*
88
*/
99
angular
10-
.module('schemaFormBuilder', [
11-
'builder',
10+
.module('schemaFormBuilderApp', [
11+
'schemaFormBuilder',
1212
'ui.bootstrap'
1313
]);
1414
}());

app/app-routes.es6

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)