Skip to content

Instantly share code, notes, and snippets.

@bas080
Created May 9, 2016 23:11
Show Gist options
  • Save bas080/bd782be6658e43fe74a25a2866089ef7 to your computer and use it in GitHub Desktop.
Save bas080/bd782be6658e43fe74a25a2866089ef7 to your computer and use it in GitHub Desktop.
<form>
<!-- does nothin more then create a fieldset, add legend and nest elements
within it -->
<form-fieldset title="Hello World">
<!-- already got this working still needs a config -->
<form-entity-generated entity="someEntity"></form-entity-generated>
<!-- only show a specific set of properties -->>
<form-entity entity="someEntity">
<!-- check if the entity that is bound to form-entity is accesible in the
form-entity-property vm -->
<form-entity-property property="name"></form-entity-property>
<form-entity-property property="age"></form-entity-property>
<form-entity-property property="eye-color"></form-entity-property>
</form-entity>
</form-fieldset>
</form>
<!-- form-entity.html -->
<template bindable="entity">
<content></content>
</template>
<!-- form-entity-element -->
<!-- http://www.sitepoint.com/composition-aurelia-report-builder/ -->
<template>
<compose containerless view-model="viewModel(entity)"></compose>
</template>
<script type="text/javascript" charset="utf-8">
export formEntityElementCustomElement {
@bindable property
@computable('property')
viewModel(entity) {
// consider using the config's method so this can be overwritten;
return 'elements/' + this.parent.entity[property].type;
}
activate(parent) {
this.parent = parent;
}
}
</script>
<!-- form-fieldset.html -->
<template>
<fieldset>
<legend>${title}</legend>
<content></content>
</fieldset>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment