Merge pull request #846 from nextcloud/revert-825-gender

Revert "fix gender field select"
This commit is contained in:
John Molakvoæ 2019-01-11 12:04:51 +01:00 committed by GitHub
commit 131667f5fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 23 deletions

View File

@ -103,8 +103,7 @@
empty property because this is a required prop on regular property-select. But since
we are hijacking this... (this is supposed to be used with a ICAL.property, but to avoid code
duplication, we created a fake propModel and property with our own options here) -->
<property-select :prop-model="addressbookModel" :select-type.sync="addressbook" value=""
:is-first-property="true"
<property-select :prop-model="addressbookModel" :value.sync="addressbook" :is-first-property="true"
:is-last-property="true" :property="{}" class="property--addressbooks property--last" />
<!-- Groups always visible -->
@ -273,16 +272,15 @@ export default {
/**
* Usable addressbook object linked to the local contact
*
* @param {string} [addressbook] set the addressbook object
* @param {string} [addressbookId] set the addressbook id
* @returns {string}
*/
addressbook: {
get: function() {
return this.addressbooksOptions
.find(addressbook => addressbook.id === this.contact.addressbook.id)
return this.contact.addressbook.id
},
set: function(addressbook) {
this.moveContactToAddressbook(addressbook.id)
set: function(addressbookId) {
this.moveContactToAddressbook(addressbookId)
}
},

View File

@ -93,7 +93,7 @@ export default {
*/
addProp({ id }) {
let defaultData = rfcProps.properties[id].defaultValue
let property = this.contact.vCard.addPropertyWithValue(id, defaultData && defaultData.value ? defaultData.value : '')
let property = this.contact.vCard.addPropertyWithValue(id, defaultData ? defaultData.value : '')
if (defaultData && defaultData.type) {
property.setParameter('type', defaultData.type)
}

View File

@ -27,8 +27,13 @@
:info="propModel.info" />
<div class="property__row">
<!-- if we do not support any type on our model but one is set anyway -->
<div v-if="selectType" class="property__label">
{{ selectType.name }}
</div>
<!-- no options, empty space -->
<div class="property__label">
<div v-else class="property__label">
{{ propModel.readableName }}
</div>
@ -36,10 +41,9 @@
<button v-if="!isReadOnly" :title="t('contacts', 'Delete')" class="property__delete icon-delete"
@click="deleteProperty" />
<multiselect v-model="localType"
:options="propModel.options" :searchable="false" :placeholder="t('contacts', 'Select option')"
<multiselect v-model="matchedOptions" :options="propModel.options" :placeholder="t('contacts', 'Select option')"
:disabled="isSingleOption || isReadOnly" class="property__value" track-by="id"
label="name" @input="updateType" />
label="name" @input="updateValue" />
</div>
</div>
</template>
@ -72,10 +76,23 @@ export default {
// length is one & add one space at the end
return hasTitle + 1 + isLast
},
// is there only one option available
isSingleOption() {
return this.propModel.options.length <= 1
},
// matching value to the options we provide
matchedOptions: {
get() {
let selected = this.propModel.options.find(option => option.id === this.localValue)
return selected || {
id: this.localValue,
name: this.localValue
}
},
set(value) {
this.localValue = value.id
}
}
}
}

View File

@ -25,7 +25,7 @@ export default {
props: {
// Default property type. e.g. "WORK,HOME"
selectType: {
type: Object,
type: [Object],
default: () => {}
},
// Coming fro the rfcProps Model
@ -79,8 +79,7 @@ export default {
watch: {
/**
* Since we're updating a local data based on the value prop,
* we need to make sure to update the local data on prop change
* ! this prevent virtual doms to have outdated local data
* we need to make sure to update the local data on pop change
*/
value: function() {
this.localValue = this.value

View File

@ -56,6 +56,7 @@ const properties = {
readableName: t('contacts', 'Federated Cloud ID'),
force: 'text',
defaultValue: {
value: [''],
type: ['HOME']
},
options: [
@ -117,6 +118,7 @@ const properties = {
icon: 'icon-mail',
default: true,
defaultValue: {
value: '',
type: ['HOME']
},
options: [
@ -130,6 +132,7 @@ const properties = {
readableName: t('contacts', 'Instant messaging'),
icon: 'icon-comment',
defaultValue: {
value: [''],
type: ['SKYPE']
},
options: [
@ -146,6 +149,7 @@ const properties = {
icon: 'icon-phone',
default: true,
defaultValue: {
value: '',
type: ['HOME', 'VOICE']
},
options: [
@ -172,7 +176,8 @@ const properties = {
icon: 'icon-social',
readableName: t('contacts', 'Social network'),
defaultValue: {
type: ['FACEBOOK']
value: '',
type: ['facebook']
},
info: t(
'contacts',
@ -203,9 +208,6 @@ const properties = {
'contacts',
'Specify a relationship between you and the entity represented by this vCard.'
),
defaultValue: {
type: ['COLLEAGUE']
},
options: [
{ id: 'SPOUSE', name: t('contacts', 'Spouse') },
{ id: 'CHILD', name: t('contacts', 'Child') },
@ -230,6 +232,7 @@ const properties = {
'Specify a relationship between another entity and the entity represented by this vCard.'
),
defaultValue: {
value: [''],
type: ['CONTACT']
},
options: [
@ -253,13 +256,11 @@ const properties = {
},
gender: {
readableName: t('contacts', 'Gender'),
force: 'select',
defaultValue: {
// default to Female 🙋
type: ['F']
value: ['F']
},
options: [
// TODO? make X-WAB-GENDER print in VCARD as well for MS compatibility
{ id: 'F', name: t('contacts', 'Female') },
{ id: 'M', name: t('contacts', 'Male') },
{ id: 'O', name: t('contacts', 'Other') }