LT-67: Creating checkbox component
This commit is contained in:
parent
4e70e62b7b
commit
18516b47f0
@ -21,10 +21,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-control">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="">
|
||||
<span>QIDO supports including fields</span>
|
||||
</label>
|
||||
{{>inputCheckbox key='qidoSupportsIncludeField'}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -10,6 +10,7 @@ import './mixins/formItem.js';
|
||||
import './mixins/group.js';
|
||||
import './mixins/groupRadio.js';
|
||||
import './mixins/input.js';
|
||||
import './mixins/checkbox.js';
|
||||
import './mixins/schemaData.js';
|
||||
import './mixins/select.js';
|
||||
import './mixins/select2.js';
|
||||
|
||||
26
Packages/ohif-core/client/components/base/mixins/checkbox.js
Normal file
26
Packages/ohif-core/client/components/base/mixins/checkbox.js
Normal file
@ -0,0 +1,26 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { _ } from 'meteor/underscore';
|
||||
|
||||
/*
|
||||
* inputCheckbox: controls a checkbox input
|
||||
*/
|
||||
OHIF.mixins.checkbox = new OHIF.Mixin({
|
||||
dependencies: 'input',
|
||||
composition: {
|
||||
onCreated() {
|
||||
const instance = Template.instance();
|
||||
const component = instance.component;
|
||||
|
||||
// Get or set the checked state using jQuery's prop method
|
||||
component.value = value => {
|
||||
const isGet = _.isUndefined(value);
|
||||
if (isGet) {
|
||||
return component.$element.is(':checked');
|
||||
}
|
||||
|
||||
component.$element.prop('checked', value);
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -1,6 +1,7 @@
|
||||
import './form/form.html';
|
||||
import './form/group.html';
|
||||
|
||||
import './input/checkbox.html';
|
||||
import './input/hidden.html';
|
||||
import './input/groupRadio.html';
|
||||
import './input/radio.html';
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
<template name="inputCheckbox">
|
||||
{{#baseComponent (extend this
|
||||
base='baseInput'
|
||||
type='checkbox'
|
||||
mixins=(concat 'checkbox ' this.mixins)
|
||||
labelAfter=(valueIf (isUndefined this.labelAfter) true this.labelAfter)
|
||||
labelClass=(concat 'checkboxLabel ' this.labelClass)
|
||||
wrappers=(concat ''
|
||||
(valueIf reactive this.label 'wrapperLabel ' '')
|
||||
this.wrappers
|
||||
)
|
||||
)}}
|
||||
{{>UI.contentBlock}}
|
||||
{{/baseComponent}}
|
||||
</template>
|
||||
@ -4,7 +4,7 @@
|
||||
type='radio'
|
||||
mixins=(concat 'input ' this.mixins)
|
||||
labelAfter=(valueIf (isUndefined this.labelAfter) true this.labelAfter)
|
||||
labelClass=(concat 'checkboxLabel ' this.labelClass)
|
||||
labelClass=(concat 'radioLabel ' this.labelClass)
|
||||
wrappers=(concat ''
|
||||
(valueIf reactive this.label 'wrapperLabel ' '')
|
||||
this.wrappers
|
||||
|
||||
Loading…
Reference in New Issue
Block a user