Skip to content

Commit

Permalink
Added posibility to show and edit vCard Geo attibutes
Browse files Browse the repository at this point in the history
Signed-off-by: Arne Hamann <kontakt+github@arne.email>
  • Loading branch information
tacruc authored and skjnldsv committed Sep 19, 2019
1 parent ccb6828 commit 3de0a41
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/components/ContactDetails/ContactDetailsAddNewProp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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)
}
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/models/rfcProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -288,6 +297,7 @@ const fieldOrder = [
'tel',
'email',
'adr',
'geo',
'impp',
'nick',
'cloud',
Expand Down

0 comments on commit 3de0a41

Please sign in to comment.