summaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-03-28 09:23:35 +0100
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-03-28 09:24:29 +0100
commite4bf88ccd9c03092301999c8dc49524f46411a0b (patch)
tree989cdb2e02d5507dcf4b205553daf26ad9ae7eaa /src/components
parent856513972c65e3fc1775c368a8728102ad3752ad (diff)
Support ABLABEL custom labels
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src/components')
-rw-r--r--src/components/ContactDetails/ContactDetailsProperty.vue20
-rw-r--r--src/components/Properties/PropertyMultipleText.vue7
-rw-r--r--src/components/Properties/PropertyText.vue7
3 files changed, 27 insertions, 7 deletions
diff --git a/src/components/ContactDetails/ContactDetailsProperty.vue b/src/components/ContactDetails/ContactDetailsProperty.vue
index 1d7d9fd1..7776935e 100644
--- a/src/components/ContactDetails/ContactDetailsProperty.vue
+++ b/src/components/ContactDetails/ContactDetailsProperty.vue
@@ -27,7 +27,7 @@
:property="property" :is-last-property="isLastProperty" :class="{'property--last': isLastProperty}"
:contact="contact" :prop-name="propName" :prop-type="propType"
:options="sortedModelOptions" :is-read-only="isReadOnly"
- @delete="deleteProp" />
+ @delete="deleteProp" @update="updateProp" />
</template>
<script>
@@ -261,6 +261,16 @@ export default {
this.type = data.id.split(',')
// only one can coexist
this.contact.vCard.removeProperty(`${this.propGroup[0]}.x-ablabel`)
+
+ // checking if there is any other property in this group
+ const groups = this.contact.jCal[1]
+ .map(prop => prop[0])
+ .filter(name => name.startsWith(`${this.propGroup[0]}.`))
+ if (groups.length === 1) {
+ // then this prop is the latest of its group
+ // -> converting back to simple prop
+ this.property.jCal[0] = this.propGroup[1]
+ }
}
this.$emit('updatedcontact')
}
@@ -322,8 +332,16 @@ export default {
* Delete this property
*/
deleteProp() {
+ console.info('removing', this.property, this.propGroup)
this.contact.vCard.removeProperty(this.property)
this.$emit('updatedcontact')
+ },
+
+ /**
+ * Update this property
+ */
+ updateProp() {
+ this.$emit('updatedcontact')
}
}
}
diff --git a/src/components/Properties/PropertyMultipleText.vue b/src/components/Properties/PropertyMultipleText.vue
index 68f7be9d..1ce64281 100644
--- a/src/components/Properties/PropertyMultipleText.vue
+++ b/src/components/Properties/PropertyMultipleText.vue
@@ -29,9 +29,10 @@
<div class="property__row">
<!-- type selector -->
<multiselect v-if="propModel.options" v-model="localType"
- :options="options" :searchable="false" :placeholder="t('contacts', 'Select type')"
- :disabled="isReadOnly" class="property__label" track-by="id"
- label="name" @input="updateType" />
+ :options="options" :placeholder="t('contacts', 'Select type')"
+ :taggable="true" tag-placeholder="create" :disabled="isReadOnly"
+ class="property__label" track-by="id" label="name"
+ @tag="createLabel" @input="updateType" />
<!-- if we do not support any type on our model but one is set anyway -->
<div v-else-if="selectType" class="property__label">
diff --git a/src/components/Properties/PropertyText.vue b/src/components/Properties/PropertyText.vue
index 02ee97d2..c13baf1d 100644
--- a/src/components/Properties/PropertyText.vue
+++ b/src/components/Properties/PropertyText.vue
@@ -29,9 +29,10 @@
<div class="property__row">
<!-- type selector -->
<multiselect v-if="propModel.options" v-model="localType"
- :options="options" :searchable="false" :placeholder="t('contacts', 'Select type')"
- :disabled="isReadOnly" class="property__label" track-by="id"
- label="name" @input="updateType" />
+ :options="options" :placeholder="t('contacts', 'Select type')"
+ :taggable="true" tag-placeholder="create" :disabled="isReadOnly"
+ class="property__label" track-by="id" label="name"
+ @tag="createLabel" @input="updateType" />
<!-- if we do not support any type on our model but one is set anyway -->
<div v-else-if="selectType" class="property__label">