diff --git a/app/src/components/globals/FormField.vue b/app/src/components/globals/FormField.vue index 98f11fdb..ccca36a7 100644 --- a/app/src/components/globals/FormField.vue +++ b/app/src/components/globals/FormField.vue @@ -3,7 +3,7 @@ @@ -24,16 +24,21 @@ - @@ -60,7 +65,8 @@ export default { computed: { _id () { if (this.id) return this.id - return this.props.id ? this.props.id + '_group' : null + const childId = this.props.id || this.$attrs['label-for'] + return childId ? childId + '_group' : null }, attrs () { @@ -71,12 +77,12 @@ export default { 'label-cols-lg': 2, 'label-class': 'font-weight-bold' } - if ('label-cols' in attrs) { - attrs['label-class'] = defaultAttrs['label-class'] - } else { + if (!('label-cols' in attrs)) { for (const attr in defaultAttrs) { if (!(attr in attrs)) attrs[attr] = defaultAttrs[attr] } + } else if (!('label-class' in attrs)) { + attrs['label-class'] = defaultAttrs['label-class'] } } return attrs diff --git a/app/src/components/globals/formItems/CheckboxItem.vue b/app/src/components/globals/formItems/CheckboxItem.vue index 8df47c68..d92600af 100644 --- a/app/src/components/globals/formItems/CheckboxItem.vue +++ b/app/src/components/globals/formItems/CheckboxItem.vue @@ -6,7 +6,7 @@ :aria-describedby="$parent.id + '__BV_description_'" switch > - {{ $t(labels[checked]) }} + {{ label || $t(labels[checked]) }} @@ -17,6 +17,7 @@ export default { props: { value: { type: Boolean, required: true }, id: { type: String, default: null }, + label: { type: String, default: null }, labels: { type: Object, default: () => ({ true: 'yes', false: 'no' }) } },