Skip to content

Commit

Permalink
implemented support for checkbox, radios and selects
Browse files Browse the repository at this point in the history
  • Loading branch information
splendido committed Oct 28, 2014
1 parent 830b66f commit e1e02e7
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
34 changes: 34 additions & 0 deletions lib/at_input.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<template name="atInput">
{{> Template.dynamic template=templateName}}
</template>

<template name="atTextInput">
<div class="at-input {{#if hasError}}has-error{{/if}} {{#if hasSuccess}}has-success{{/if}} {{#if feedback}}has-feedback{{/if}}">
{{#if showLabels}}
<label for="at-field-{{_id}}">
Expand All @@ -20,4 +24,34 @@
<span>{{errorText}}</span>
{{/if}}
</div>
</template>

<template name="atCheckboxInput">
<div class="at-input">
<input type="{{type}}" id="at-field-{{_id}}" name="at-field-{{_id}}" {{disabled}}>
<label for="at-field-{{_id}}">{{displayName}}</label>
</div>
</template>

<template name="atSelectInput">
<div class="at-input">
<label for="at-field-{{_id}}">{{displayName}}</label>
<select id="at-field-{{_id}}" name="at-field-{{_id}}">
{{#each values}}
<option value="{{value}}">{{text}}</option>
{{/each}}
</select>
</div>
</template>

<template name="atRadioInput">
<div class="at-input">
<label>{{displayName}}</label>
</div>
{{#each values}}
<div class="at-input">
<input id="at-field-{{id}}-choice-{{value}}" type="radio" name="at-field-{{id}}" value={{value}}>
<label>{{text}}</label>
</div>
{{/each}}
</template>
14 changes: 13 additions & 1 deletion lib/at_input.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,16 @@
Template.atInput.helpers(AccountsTemplates.atInputHelpers);

// Simply 'inherites' events from AccountsTemplates
Template.atInput.events(AccountsTemplates.atInputEvents);
Template.atInput.events(AccountsTemplates.atInputEvents);

// Simply 'inherites' helpers from AccountsTemplates
Template.atTextInput.helpers(AccountsTemplates.atInputHelpers);

// Simply 'inherites' helpers from AccountsTemplates
Template.atCheckboxInput.helpers(AccountsTemplates.atInputHelpers);

// Simply 'inherites' helpers from AccountsTemplates
Template.atSelectInput.helpers(AccountsTemplates.atInputHelpers);

// Simply 'inherites' helpers from AccountsTemplates
Template.atRadioInput.helpers(AccountsTemplates.atInputHelpers);

0 comments on commit e1e02e7

Please sign in to comment.