diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-09-04 09:20:22 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-09-04 10:15:06 +0200 |
commit | 1b12c5e5e57b74512e07482795c0502c589ab75d (patch) | |
tree | 6e4ead02c1a8a52825751612a54487045e25580a | |
parent | 3fa44ad6f725cfe5be77eb6e88d3c4c299f7141a (diff) |
Multiple values saving fix, categories update and design calc fixes
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
-rw-r--r-- | src/components/ContactDetails/ContactDetailsProperty.vue | 7 | ||||
-rw-r--r-- | src/components/Properties/PropertyGroups.vue | 5 | ||||
-rw-r--r-- | src/components/Properties/PropertyMultipleText.vue | 36 | ||||
-rw-r--r-- | src/store/FakeName.vcf | 14 |
4 files changed, 50 insertions, 12 deletions
diff --git a/src/components/ContactDetails/ContactDetailsProperty.vue b/src/components/ContactDetails/ContactDetailsProperty.vue index 4260f447..fc58dbb6 100644 --- a/src/components/ContactDetails/ContactDetailsProperty.vue +++ b/src/components/ContactDetails/ContactDetailsProperty.vue @@ -24,8 +24,8 @@ <!-- If not in the rfcProps then we don't want to display it --> <component v-if="propModel && propType !== 'unknown'" :is="componentInstance" :select-type.sync="selectType" :prop-model="propModel" :value.sync="value" :is-first-property="isFirstProperty" - :is-last-property="isLastProperty" :class="{'property--last': isLastProperty}" :contact="contact" - @delete="deleteProp" /> + :property="property" :is-last-property="isLastProperty" :class="{'property--last': isLastProperty}" + :contact="contact" @delete="deleteProp" /> </template> <script> @@ -185,8 +185,9 @@ export default { this.property.isStructuredValue ? this.property.setValues([data]) : this.property.setValues(data) + } else { + this.property.setValue(data) } - this.property.setValue(data) this.$emit('updatedcontact') } }, diff --git a/src/components/Properties/PropertyGroups.vue b/src/components/Properties/PropertyGroups.vue index 9979733e..be871175 100644 --- a/src/components/Properties/PropertyGroups.vue +++ b/src/components/Properties/PropertyGroups.vue @@ -25,11 +25,14 @@ <div class="property__row"> <div class="property__label">{{ propModel.readableName }}</div> + <!-- multiselect taggable groups with a limit to 3 groups shown --> <multiselect v-model="localValue" :options="groups" :placeholder="t('contacts', 'Add contact in group')" :limit="3" :multiple="true" :taggable="true" :close-on-select="false" tag-placeholder="create" class="multiselect-vue property__value" - @tag="validateGroup" @select="addContactToGroup" @remove="removeContactToGroup"> + @input="updateValue" @tag="validateGroup" @select="addContactToGroup" + @remove="removeContactToGroup"> + <!-- show how many groups are hidden and add tooltip --> <span v-tooltip.auto="formatGroupsTitle" slot="limit" class="multiselect__limit">+{{ localValue.length - 3 }}</span> <span slot="noResult">{{ t('settings', 'No results') }}</span> diff --git a/src/components/Properties/PropertyMultipleText.vue b/src/components/Properties/PropertyMultipleText.vue index 90d2afde..dcbf080f 100644 --- a/src/components/Properties/PropertyMultipleText.vue +++ b/src/components/Properties/PropertyMultipleText.vue @@ -38,15 +38,32 @@ <!-- no options, empty space --> <div v-else class="property__label">{{ propModel.readableName }}</div> + <!-- show the first input if not --> + <input v-if="!property.isStructuredValue" v-model.trim="localValue[0]" class="property__value" + type="text" @input="updateValue"> + <!-- delete the prop --> <button :title="t('contacts', 'Delete')" class="property__delete icon-delete" @click="deleteProperty" /> </div> - <div v-for="index in propModel.displayOrder" :key="index" class="property__row"> - <div class="property__label">{{ propModel.readableValues[index] }}</div> - <input v-model.trim="localValue[index]" class="property__value" type="text" - @input="updateValue"> - </div> + <!-- force order based on model --> + <template v-if="propModel.displayOrder && propModel.readableValues"> + <div v-for="index in propModel.displayOrder" :key="index" class="property__row"> + <div class="property__label">{{ propModel.readableValues[index] }}</div> + <input v-model.trim="localValue[index]" class="property__value" type="text" + @input="updateValue"> + </div> + </template> + + <!-- no order enforced: just iterate on all the values --> + <template v-else> + <div v-for="(value, index) in localValue" v-if="index > 0" :key="index" + class="property__row"> + <div class="property__label" /> + <input v-model.trim="localValue[index]" class="property__value" type="text" + @input="updateValue"> + </div> + </template> </div> </template> @@ -78,6 +95,11 @@ export default { default: () => [], required: true }, + property: { + type: Object, + default: () => {}, + required: true + }, isFirstProperty: { type: Boolean, default: true @@ -99,9 +121,9 @@ export default { gridLength() { let hasTitle = this.isFirstProperty && this.propModel.icon ? 1 : 0 let isLast = this.isLastProperty + let hasValueNames = this.propModel.readableValues ? 1 : 0 let length = this.propModel.displayOrder ? this.propModel.displayOrder.length : this.value.length - // always have a property__label + one extra space at the end - return 1 + hasTitle + length + isLast + return hasValueNames + hasTitle + length + isLast } }, diff --git a/src/store/FakeName.vcf b/src/store/FakeName.vcf index ebfc383a..9dd899b0 100644 --- a/src/store/FakeName.vcf +++ b/src/store/FakeName.vcf @@ -8,6 +8,7 @@ MEMBER:urn:uuid:cd314b39-b71a-41cf-b4eb-5cb61dd6fa24 REV:2017-07-27T05:56:33Z UID:5acf667e-1cbf-48a8-87fe-546ee31a0b23 END:VCARD + BEGIN:VCARD VERSION:4.0 KIND:org @@ -18,7 +19,8 @@ BEGIN:VCARD VERSION:3.0 N:Cunningham;Liam;;Mr.; FN:Liam Cunningham -NICKNAME:Begivaing81 +NICKNAME;TYPE=work:Begivaing81,Test +NICKNAME:Pwet BDAY;VALUE=text:5/26/1981 GENDER:male ORG:Central Hardware; @@ -28,6 +30,16 @@ CATEGORIES:Tech,University TEL;TYPE=VOICE,HOME;VALUE=text:06-22957835 ADR;TYPE=HOME:;;Beilen;DR;9413 BA;Netherlands END:VCARD + +BEGIN:VCARD +VERSION:4.0 +FN:Simon Perreault +N:Perreault;Simon;;;ing. jr,M.Sc. +BDAY:--0203 +ANNIVERSARY:20090808T1430-0500 +GENDER:M +END:VCARD + BEGIN:VCARD VERSION:3.0 N:Kamiński;Przemysł;;Mr.; |