Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new form control type "radio" for a group of radio buttons
- Loading branch information
1 parent
5af3a5c
commit 508ae1f
Showing
11 changed files
with
402 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Control from '../control'; | ||
import layout from 'ember-bootstrap/templates/components/bs-form/element/control/radio'; | ||
|
||
/** | ||
@class FormElementControlRadio | ||
@namespace Components | ||
@extends Components.FormElementControl | ||
@private | ||
*/ | ||
export default Control.extend({ | ||
layout, | ||
tagName: '', | ||
|
||
/** | ||
* @property inline | ||
* @type {Boolean} | ||
* @default false | ||
* @public | ||
*/ | ||
inline: false | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from 'ember-bootstrap/components/base/bs-form/element/control/radio'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from 'ember-bootstrap/components/base/bs-form/element/control/radio'; |
47 changes: 47 additions & 0 deletions
47
addon/templates/components/bs3/bs-form/element/control/radio.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{{#each options as |option index|}} | ||
{{#with (concat this.elementId "-" index) as |id|}} | ||
{{#if inline}} | ||
<label | ||
for={{id}} | ||
class="radio-inline" | ||
> | ||
<input | ||
type="radio" | ||
id={{id}} | ||
checked={{bs-eq option value}} | ||
onclick={{action onChange option}} | ||
> | ||
{{#if hasblock}} | ||
{{yield}} | ||
{{else}} | ||
{{#if optionLabelPath}} | ||
{{get option op tionLabelPath}} | ||
{{else}} | ||
{{option}} | ||
{{/if}} | ||
{{/if}} | ||
</label> | ||
{{else}} | ||
<div class="radio"> | ||
|
||
<label | ||
for={{id}} | ||
> | ||
<input | ||
type="radio" | ||
id={{id}} | ||
> | ||
{{#if hasblock}} | ||
{{yield}} | ||
{{else}} | ||
{{#if optionLabelPath}} | ||
{{get option optionLabelPath}} | ||
{{else}} | ||
{{option}} | ||
{{/if}} | ||
{{/if}} | ||
</label> | ||
</div> | ||
{{/if}} | ||
{{/with}} | ||
{{/each}} |
34 changes: 34 additions & 0 deletions
34
addon/templates/components/bs4/bs-form/element/control/radio.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{{#each options as |option index|}} | ||
<div class="form-check{{if inline " form-check-inline"}}"> | ||
{{#with (concat this.elementId "-" index) as |id|}} | ||
<input | ||
type="radio" | ||
class="form-check-input" | ||
id={{id}} | ||
checked={{bs-eq option value}} | ||
onclick={{action onChange option}} | ||
name={{name}} | ||
required={{required}} | ||
disabled={{disabled}} | ||
autofocus={{autofocus}} | ||
tabindex={{tabindex}} | ||
form={{form}} | ||
title={{title}} | ||
> | ||
<label | ||
for={{id}} | ||
class="form-check-label" | ||
> | ||
{{#if hasblock}} | ||
{{yield}} | ||
{{else}} | ||
{{#if optionLabelPath}} | ||
{{get option optionLabelPath}} | ||
{{else}} | ||
{{option}} | ||
{{/if}} | ||
{{/if}} | ||
</label> | ||
{{/with}} | ||
</div> | ||
{{/each}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from 'ember-bootstrap/components/bs-form/element/control/radio'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.