Skip to content

Commit 61facc8

Browse files
committed
Improved explanation on Decorators section
I've copied the explanation of @mike-marcacci from ticket json-schema-form#57 and add as an example in the Decorators section.
1 parent b4d01af commit 61facc8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/extending.md

+23
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,26 @@ schemaFormDecoratorsProvider.createDecorator('bootstrapDecorator', {
212212

213213
When the decorator is trying to match a form type against a tempate it first executes all the rules
214214
in order. If one returns that is used as template, otherwise it checks the mappings.
215+
216+
For example to add a new template (in a similar manner you can map an existing type to a new template):
217+
218+
- Create your template
219+
```html
220+
<div class="form-group has-feedback" ng-class="{'has-error': hasError(), 'has-success': hasSuccess()}">
221+
<label ng-show="showTitle()">{{form.title}}</label>
222+
<span class="help-block">{{ (hasError() && errorMessage(schemaError())) || form.description}}</span>
223+
<textarea class="form-control"
224+
ckeditor
225+
sf-changed="form"
226+
ng-required="form.required"
227+
ng-model="$$value$$"
228+
schema-validate="form.schema"></textarea>
229+
</div>
230+
```
231+
- Use the addMapping provider method in your app boostraping section:
232+
233+
```javascript
234+
.config(['schemaFormDecoratorsProvider', function(decoratorsProvider){
235+
decoratorsProvider.addMapping('bootstrapDecorator', 'ckeditor', 'path/to/ckeditor.html');
236+
}])
237+
```

0 commit comments

Comments
 (0)