Permalink
Browse files

fix(bootstrap): removed mixup between message and label

  • Loading branch information...
bas080
bas080 committed Jun 10, 2016
1 parent fce81a2 commit 4d09ec96d8555ccb9aeeb549b5a478cb644e6d51
Showing with 20 additions and 9 deletions.
  1. +6 −3 src/frameworks/bootstrap/form-group.html
  2. +14 −6 src/frameworks/form-group.js
@@ -1,12 +1,15 @@
<template bindable="attribute, message">
<require from="./../../attributes"></require>
<div
attributes.bind="attribute.attributes"
class="form-group">
class="form-group${!!message && ' has-error'}"
attributes.bind="attribute.attributes">
<label
t.bind="labelText"
if.bind="showsLabel">${labelText}</label>
<content></content>
<span class="help-block">${message}</span>
<span
show.bind="showsMessage"
class="help-block">
${message}</span>
</div>
</template>
@@ -1,19 +1,27 @@
import {bindable, inject, computedFrom} from 'aurelia-framework';
import {bindable, computedFrom} from 'aurelia-framework';

@inject(Element)
export class FormGroup {

@bindable attribute

@bindable message

constructor(element) {
this.element = element;
/**
* users can set label to false if they do not want to show the label
*
* @returns {boolean} true label is not false
*/
@computedFrom('label')
get showsLabel() {
return (this.label !== false);
}

/**
* @returns {boolean} true if message is empty or null
*/
@computedFrom('message')
get showsLabel() {
return (this.message !== false);
get showsMessage() {
return (!!this.message);
}

/**

0 comments on commit 4d09ec9

Please sign in to comment.