summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2019-09-19 23:25:30 +0200
committerGitHub <noreply@github.com>2019-09-19 23:25:30 +0200
commitc04d1b9ea0db6c511ea48e816d5ee6edfa1cea51 (patch)
tree995ce0692ee4e4f63a3af831236f8557981b365f
parenta95330762e64961058f252f0d438f5a72ad15f92 (diff)
parent0b3bbddde1e381b3762b6d9da6f89f7f0fa7a5d5 (diff)
Added possibility to show and edit vCard Geo attributes (#1250)
Added possibility to show and edit vCard Geo attributes
-rw-r--r--src/components/ContactDetails/ContactDetailsAddNewProp.vue16
-rw-r--r--src/models/rfcProps.js10
2 files changed, 22 insertions, 4 deletions
diff --git a/src/components/ContactDetails/ContactDetailsAddNewProp.vue b/src/components/ContactDetails/ContactDetailsAddNewProp.vue
index 1400d624..abb2985a 100644
--- a/src/components/ContactDetails/ContactDetailsAddNewProp.vue
+++ b/src/components/ContactDetails/ContactDetailsAddNewProp.vue
@@ -39,6 +39,7 @@
import rfcProps from 'Models/rfcProps'
import Contact from 'Models/contact'
import PropertyTitle from 'Components/Properties/PropertyTitle'
+import ICAL from 'ical.js'
export default {
name: 'ContactDetailsAddNewProp',
@@ -101,10 +102,17 @@ export default {
* @param {string} data.id the id of the property. e.g fn
*/
addProp({ id }) {
- let defaultData = this.properties[id].defaultValue
- let property = this.contact.vCard.addPropertyWithValue(id, defaultData ? defaultData.value : '')
- if (defaultData && defaultData.type) {
- property.setParameter('type', defaultData.type)
+ if (this.properties[id] && this.properties[id].defaultjCal
+ && this.properties[id].defaultjCal[this.contact.version]) {
+ let defaultjCal = this.properties[id].defaultjCal[this.contact.version]
+ let property = new ICAL.Property([id, ...defaultjCal])
+ this.contact.vCard.addProperty(property)
+ } else {
+ let defaultData = this.properties[id].defaultValue
+ let property = this.contact.vCard.addPropertyWithValue(id, defaultData ? defaultData.value : '')
+ if (defaultData && defaultData.type) {
+ property.setParameter('type', defaultData.type)
+ }
}
}
}
diff --git a/src/models/rfcProps.js b/src/models/rfcProps.js
index 16c766a2..1f5e4bae 100644
--- a/src/models/rfcProps.js
+++ b/src/models/rfcProps.js
@@ -55,6 +55,15 @@ const properties = {
readableName: t('contacts', 'Website'),
icon: 'icon-public'
},
+ geo: {
+ multiple: true,
+ readableName: t('contacts', 'Location'),
+ icon: 'icon-address',
+ defaultjCal: {
+ '3.0': [{}, 'FLOAT', '90.000;0.000'],
+ '4.0': [{}, 'URI', 'geo:90.000,0.000']
+ }
+ },
cloud: {
multiple: true,
icon: 'icon-public',
@@ -288,6 +297,7 @@ const fieldOrder = [
'tel',
'email',
'adr',
+ 'geo',
'impp',
'nick',
'cloud',