-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(model-form): Glimmer RadioGroup and RadioButton
- Loading branch information
Showing
7 changed files
with
37 additions
and
54 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 @@ | ||
<input type='radio' ...attributes /> |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,23 +1,31 @@ | ||
<legend class={{if (not-eq inputLayout 'vertical') 'col-form-legend col-sm-2'}}> | ||
{{label}}{{if required ' *'}} | ||
</legend> | ||
<div class={{if (not-eq inputLayout 'vertical') 'col-sm-10'}}> | ||
{{#each options as |opt|}} | ||
<div class='form-check mb-2'> | ||
<ModelForm::RadioButton | ||
@class={{concat 'form-check-input ' inputValidityClass}} | ||
@name={{inputIdentifier}} | ||
@id={{concat inputIdentifier '-' opt.value}} | ||
@value={{opt.value}} | ||
@groupValue={{mut (get model property)}} | ||
@required={{required}} | ||
@disabled={{disabled}} | ||
/> | ||
<label class='form-check-label' for='{{inputIdentifier}}-{{opt.value}}'> | ||
{{opt.label}} | ||
</label> | ||
</div> | ||
{{/each}} | ||
<fieldset class='mb-3 {{if this.usesGrid "row"}}'> | ||
<legend | ||
class={{if (not-eq this.inputLayout 'vertical') 'col-form-legend col-sm-2'}} | ||
> | ||
{{@label}}{{if @required ' *'}} | ||
</legend> | ||
<div class={{if (not-eq this.inputLayout 'vertical') 'col-sm-10'}}> | ||
{{#each @options as |opt|}} | ||
<div class='form-check mb-2'> | ||
<ModelForm::RadioButton | ||
class={{concat 'form-check-input ' this.inputValidityClass}} | ||
name={{this.inputIdentifier}} | ||
id={{concat this.inputIdentifier '-' this.opt.value}} | ||
value={{opt.value}} | ||
required={{@required}} | ||
disabled={{@disabled}} | ||
checked={{eq (get @model @property) opt.value}} | ||
{{on 'change' (action (mut (get @model @property)) opt.value)}} | ||
/> | ||
<label | ||
class='form-check-label' | ||
for='{{this.inputIdentifier}}-{{opt.value}}' | ||
> | ||
{{opt.label}} | ||
</label> | ||
</div> | ||
{{/each}} | ||
|
||
{{form-control-feedback (get @model.errors property)}} | ||
</div> | ||
{{form-control-feedback (get @model.errors @property)}} | ||
</div> | ||
</fieldset> |
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
import TextInput from './text-input'; | ||
|
||
export default class RadioGroup extends TextInput {} |
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