Permalink
Browse files

feat(field): hidden property can also take a function

  • Loading branch information...
bas080
bas080 committed Jul 25, 2016
1 parent 7fca342 commit 9e42d72ff6a9951f60451f3963dafb7324a7a4b4
@@ -1,12 +1,12 @@
<template>
<!-- does not have a view model, meaning that it is a html only component -->
<compose
if.bind="!hasViewModel && !element.hidden"
if.bind="!hasViewModel && visible"
view.bind="view"></compose>

<!-- has a view model this is a component with view model -->
<compose
if.bind="hasViewModel && !element.hidden"
if.bind="hasViewModel && visible"
model.bind="{element: element, value: value, message: message}"
view-model.bind="view"></compose>
</template>
@@ -26,6 +26,19 @@ export class FormField {
}
}

@computedFrom('value', 'element')
get visible() {
if (this.element.hidden === 'function') {
return !this.element.hidden(this.value);
}

if (this.element.hidden === 'boolean') {
return !this.element.hidden;
}

return true;
}

/**
* Used to determine the what to display
*
@@ -1,7 +1,7 @@
export class Actions {

activate(model) {
this.value = model.value
this.value = model.value;
}

}
@@ -1,4 +1,3 @@
import {computedFrom} from 'aurelia-framework';
export class Collection {

activate(model) {
@@ -15,7 +15,7 @@ export function entitySchema(entity) {
let associations = metadata.fetch('associations');
let data = metadata.fetch('data') || {};
let schema = [];
let entityManager = entity.getRepository().entityManager
let entityManager = entity.getRepository().entityManager;

for (let key of Object.keys(entity)) {
/* should be fixed in orm */

0 comments on commit 9e42d72

Please sign in to comment.