diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-03-06 09:32:20 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-03-06 09:32:20 +0100 |
commit | 55a30db2e75c416c1139ee938eaea18c70bb0807 (patch) | |
tree | 0563d8d2a08629535c5eb1c007f447827ab58aa4 /src | |
parent | b2f7cf1606b8b8f87dbf430f694e559de5a12ef8 (diff) |
Fix gender select
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/Properties/PropertySelect.vue | 16 | ||||
-rw-r--r-- | src/models/rfcProps.js | 7 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/components/Properties/PropertySelect.vue b/src/components/Properties/PropertySelect.vue index 69593f8c..7ea41da1 100644 --- a/src/components/Properties/PropertySelect.vue +++ b/src/components/Properties/PropertySelect.vue @@ -62,7 +62,7 @@ export default { props: { value: { - type: [Object, String], + type: [Object, String, Array], default: '', required: true } @@ -84,13 +84,25 @@ export default { matchedOptions: { get() { let selected = this.propModel.options.find(option => option.id === this.localValue) + // properly display array as a string + if (Array.isArray(this.localValue)) { + return selected || { + id: this.localValue.join(';'), + name: this.localValue.join(';') + } + } return selected || { id: this.localValue, name: this.localValue } }, set(value) { - this.localValue = value.id + // only keeping the array if the original value was one + if (Array.isArray(this.localValue)) { + this.localValue = value.id.split(';') + } else { + this.localValue = value.id + } } } } diff --git a/src/models/rfcProps.js b/src/models/rfcProps.js index 7daf6f12..0d06d88b 100644 --- a/src/models/rfcProps.js +++ b/src/models/rfcProps.js @@ -278,12 +278,15 @@ const properties = component => ({ readableName: t('contacts', 'Gender'), defaultValue: { // default to Female 🙋 - value: ['F'] + value: 'F' }, + force: 'select', options: [ { id: 'F', name: t('contacts', 'Female') }, { id: 'M', name: t('contacts', 'Male') }, - { id: 'O', name: t('contacts', 'Other') } + { id: 'O', name: t('contacts', 'Other') }, + { id: 'N', name: t('contacts', 'None') }, + { id: 'U', name: t('contacts', 'Unknown') } ] } }) |