Permalink
Browse files

feat(entity-form): component for creating a form using an entity

  • Loading branch information...
bas080
bas080 committed Jun 21, 2016
1 parent 62fb323 commit b50abb458ea42c32f6db221f826bcac474af560c
Showing with 23 additions and 3 deletions.
  1. +2 −0 src/aurelia-form.js
  2. +0 −1 src/component/entity-form.html
  3. +20 −1 src/component/entity-form.js
  4. +1 −1 src/form.js
@@ -17,6 +17,7 @@ export function configure(aurelia, configCallback) {
'form-field' : './form-field.html',
'form-fields' : './form-fields.html',
'schema-form' : './schema-form.html',
'entity-form' : './schema-form.html',

/* custom elements with a view model do not end with .html */
actions : '{{framepath}}/actions',
@@ -68,6 +69,7 @@ export function configure(aurelia, configCallback) {
}

aurelia.globalResources(
'./component/entity-form',
'./component/schema-form',
'./component/form-fields',
'./component/form-field'

This file was deleted.

Oops, something went wrong.
@@ -1 +1,20 @@
/* wip */
import {entitySchema} from '../entity-schema';
import {bindable, bindingMode, customElement} from 'aurelia-framework';
import {resolvedView} from 'aurelia-view-manager';

@customElement('entity-form')
@resolvedView('spoonx/form', 'entity-form')
export class EntityForm {

@bindable({defaultBindingMode: bindingMode.oneTime})
entity

@bindable({defaultBindingMode: bindingMode.twoWay})
model

bind() {
this.schema = entitySchema(this.entity);
this.model = this.entity; /* enables the reuse of the schema-form.html */
}

}
@@ -7,7 +7,7 @@ import {Validator, ValidationEngine} from 'aurelia-validatejs';
* This class is optional and serves as a convenience class.
*
* - creates a messages property for storing error strings
* - allows you to set the model which automaticall
* - allows you to set the model which
* - automatically triggers validation
* - convenient methods that can be overwritten to perform action on submit and
* change

0 comments on commit b50abb4

Please sign in to comment.