LT-253: Creating radio component

This commit is contained in:
Bruno Alves de Faria 2016-07-06 15:29:48 -03:00 committed by Erik Ziegler
parent 529ef28042
commit 88f737644f
6 changed files with 80 additions and 46 deletions

View File

@ -0,0 +1,10 @@
<template name="radioOption">
<label class="radio-option">
<input type="radio"
name="{{this.name}}"
value="{{this.value}}"
class="{{this.class}}"
checked="{{#if this.checked}}checked{{/if}}"/>
<span>{{this.label}}</span>
</label>
</template>

View File

@ -0,0 +1,35 @@
@import "{design}/app"
label.radio-option
cursor: pointer
input
height: 0
width: 0
span
padding-left: 20px
position: relative
&:before
background: white
border-radius: 8px
content: ''
display: block
height: 16px
left: 0
position: absolute
top: 50%
transform(translateY(-50%))
width: 16px
input:focus + span:before
// TODO: [design] define a outline for the design
outline: none
box-shadow: 0 0 2px 2px $textSecondaryColor
input:checked + span:after
background: $uiBorderColorDark
border-radius: 5px
content: ''
height: 10px
left: 3px
position: absolute
top: 50%
transform(translateY(-50%))
width: 10px

View File

@ -36,4 +36,10 @@ Package.onUse(function(api) {
'components/roundedButtonGroup/roundedButtonGroup.js' 'components/roundedButtonGroup/roundedButtonGroup.js'
], 'client'); ], 'client');
// Radio Option
api.addFiles([
'components/radioOption/radioOption.html',
'components/radioOption/radioOption.styl'
], 'client');
}); });

View File

@ -5,28 +5,28 @@
<div class="header"> <div class="header">
Additional Findings: Baseline Additional Findings: Baseline
</div> </div>
{{> radioOptionGroup (stateDataWithKey "measurableDisease")}} {{>radioOptionGroup (stateDataWithKey "measurableDisease")}}
</div> </div>
<div class="row"> <div class="row">
<div class="header"> <div class="header">
Supplementary Measurements Supplementary Measurements
</div> </div>
{{> selectInput (stateDataWithKey "numberOfBoneLesions")}} {{>selectInput (stateDataWithKey "numberOfBoneLesions")}}
{{> select2Input {{>select2Input
key="regionsOfMetastaticDisease" key="regionsOfMetastaticDisease"
select2Options=regionsOfMetastaticDiseaseSelect2Options select2Options=regionsOfMetastaticDiseaseSelect2Options
state=state state=state
currentSchema=currentSchema currentSchema=currentSchema
}} }}
{{> radioOptionGroup (stateDataWithKey "tracerRelatedToMetastaticDisease")}} {{>radioOptionGroup (stateDataWithKey "tracerRelatedToMetastaticDisease")}}
</div> </div>
<div class="row"> <div class="row">
<div class="header"> <div class="header">
Image Quality Image Quality
</div> </div>
{{> radioOptionGroup (stateDataWithKey "acceptableImageQuality")}} {{>radioOptionGroup (stateDataWithKey "acceptableImageQuality")}}
{{> radioOptionGroup (stateDataWithKey "adequateAnatomicalCoverage")}} {{>radioOptionGroup (stateDataWithKey "adequateAnatomicalCoverage")}}
{{> radioOptionGroup (stateDataWithKey "presenceOfContrast")}} {{>radioOptionGroup (stateDataWithKey "presenceOfContrast")}}
</div> </div>
<div class="row"> <div class="row">
<div class="header"> <div class="header">

View File

@ -41,7 +41,7 @@
h5 h5
font-weight: 300 font-weight: 300
label .control-label
font-size: 14px font-size: 14px
font-weight: 100 font-weight: 100
display: inline-block display: inline-block
@ -51,26 +51,13 @@
height: 30px height: 30px
.radio-option .radio-option
width: 50%
text-align: center
float: left
display: inline-block display: inline-block
padding: 5px float: left
font-size: 14px
font-weight: 100
height: 30px height: 30px
line-height: 30px
input width: 50%
float: left
height: 30px
width: 30px
display: inline-block
label
float: left
height: 30px
line-height: 30px
font-size: 14px
font-weight: 100
display: inline-block
#regionsOfMetastaticDisease #regionsOfMetastaticDisease
width: 285px width: 285px

View File

@ -1,22 +1,18 @@
<template name="radioOptionGroup"> <template name="radioOptionGroup">
<div class="{{class}} form-group"> <div class="{{class}} form-group">
{{ #with getSchema key }} {{#let schema=(getSchema key)}}
<h5>{{label}}</h5> <h5>{{schema.label}}</h5>
<div class="radio-group"> <div class="radio-group">
{{#each option in allowedValues}} {{#each option in schema.allowedValues}}
<div class="radio-option"> {{>radioOption
<input type="radio" name=key
id="{{../key}}_{{option}}" value=option
name="{{../key}}" checked=(eq value option)
value="{{option}}" label=option
class="form-control js-form-update" class="js-form-update"
{{inlineIf value option 'checked'}}/> }}
<label for="{{../key}}_{{option}}"> {{/each}}
{{option}} </div>
</label> {{/let}}
</div>
{{/each}}
</div>
{{ /with }}
</div> </div>
</template> </template>