summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/ContactDetails.vue17
-rw-r--r--src/components/ContentList/ContentListItem.vue17
-rw-r--r--src/components/Properties/PropertyDateTime.vue1
-rw-r--r--src/components/Properties/PropertyGroups.vue3
-rw-r--r--src/components/Properties/PropertyMultipleText.vue1
-rw-r--r--src/components/Properties/PropertySelect.vue1
-rw-r--r--src/components/Properties/PropertyText.vue1
-rw-r--r--src/components/Properties/PropertyTitle.vue1
-rw-r--r--src/components/Settings/SettingsAddressbook.vue40
-rw-r--r--src/components/Settings/SettingsAddressbookShare.vue15
-rw-r--r--src/components/Settings/SettingsAddressbookSharee.vue8
-rw-r--r--src/components/Settings/SettingsRenameAddressbookField.vue0
-rw-r--r--src/components/core/popoverMenu/popoverItem.vue2
-rw-r--r--src/store/FakeName.vcf6
-rw-r--r--src/store/addressbooks.js41
15 files changed, 124 insertions, 30 deletions
diff --git a/src/components/ContactDetails.vue b/src/components/ContactDetails.vue
index cae7cd9c..a15a6970 100644
--- a/src/components/ContactDetails.vue
+++ b/src/components/ContactDetails.vue
@@ -82,13 +82,14 @@
<section class="contact-details">
<!-- properties iteration -->
- <contact-details-property v-for="(property, index) in sortedProperties" :key="index" :index="index"
+ <!-- using contact.key in the key and index as key to avoid conflicts between similar data and exact key -->
+ <contact-details-property v-for="(property, index) in sortedProperties" :key="index+contact.key" :index="index"
:sorted-properties="sortedProperties" :property="property" :contact="contact"
@updatedcontact="updateContact" />
- <!-- addressbook change select -->
- <property-select :prop-model="addressbookModel" :value.sync="addressbook"
- :options="addressbooksOptions" class="property--addressbooks" />
+ <!-- addressbook change select - no last property because class is not applied here-->
+ <property-select :prop-model="addressbookModel" :value.sync="addressbook" :is-first-property="true"
+ :is-last-property="false" :options="addressbooksOptions" class="property--addressbooks" />
</section>
</template>
</div>
@@ -245,6 +246,7 @@ export default {
updateContact() {
this.$store.dispatch('updateContact', this.contact)
},
+
/**
* Debounce the contact update for the header props
* photo, fn, org, title
@@ -262,6 +264,13 @@ export default {
},
/**
+ * Dispatch contact deletion request
+ */
+ deleteContact() {
+ this.$store.dispatch('deleteContact', this.contact)
+ },
+
+ /**
* Move contact to the specified addressbook
*
* @param {Object} addressbook the desired addressbook
diff --git a/src/components/ContentList/ContentListItem.vue b/src/components/ContentList/ContentListItem.vue
index 227ff912..6c2ccdbf 100644
--- a/src/components/ContentList/ContentListItem.vue
+++ b/src/components/ContentList/ContentListItem.vue
@@ -36,6 +36,11 @@ export default {
selectedContact() {
return this.$route.params.selectedContact
},
+
+ /**
+ * avatar color based on server toRgb method and the displayName
+ * @returns {String} the color in css format
+ */
colorAvatar() {
try {
let color = this.contact.uid.toRgb()
@@ -46,13 +51,25 @@ export default {
}
},
methods: {
+ /**
+ * Checkbox management method
+ */
toggleSelect() {
// toggle checkbox here because we stop the propagation to not trigger selectContact
+ // therefore the selectContact prevent the checkbox label+input propagation
this.$refs.selected.checked = !this.$refs.selected.checked
},
+
+ /**
+ * Dispatch contact deletion request
+ */
deleteContact() {
this.$store.dispatch('deleteContact', this.contact)
},
+
+ /**
+ * Select this contact within the list
+ */
selectContact() {
// change url with router
this.$router.push({ name: 'contact', params: { selectedGroup: this.selectedGroup, selectedContact: this.contact.key } })
diff --git a/src/components/Properties/PropertyDateTime.vue b/src/components/Properties/PropertyDateTime.vue
index f4f843bc..74f6ed72 100644
--- a/src/components/Properties/PropertyDateTime.vue
+++ b/src/components/Properties/PropertyDateTime.vue
@@ -106,6 +106,7 @@ export default {
/**
* Since we're updating a local data based on the value prop,
* we need to make sure to update the local data on pop change
+ * TODO: check if this create performance drop
*/
value: function() {
this.localValue = this.value
diff --git a/src/components/Properties/PropertyGroups.vue b/src/components/Properties/PropertyGroups.vue
index 56a6ce8e..9979733e 100644
--- a/src/components/Properties/PropertyGroups.vue
+++ b/src/components/Properties/PropertyGroups.vue
@@ -21,7 +21,7 @@
-->
<template>
- <div v-if="propModel" class="grid-span-1 property">
+ <div v-if="propModel" class="grid-span-2 property">
<div class="property__row">
<div class="property__label">{{ propModel.readableName }}</div>
@@ -92,6 +92,7 @@ export default {
/**
* Since we're updating a local data based on the value prop,
* we need to make sure to update the local data on pop change
+ * TODO: check if this create performance drop
*/
value: function() {
this.localValue = this.value
diff --git a/src/components/Properties/PropertyMultipleText.vue b/src/components/Properties/PropertyMultipleText.vue
index 45fc70ef..90d2afde 100644
--- a/src/components/Properties/PropertyMultipleText.vue
+++ b/src/components/Properties/PropertyMultipleText.vue
@@ -109,6 +109,7 @@ export default {
/**
* Since we're updating a local data based on the value prop,
* we need to make sure to update the local data on pop change
+ * TODO: check if this create performance drop
*/
value: function() {
this.localValue = this.value
diff --git a/src/components/Properties/PropertySelect.vue b/src/components/Properties/PropertySelect.vue
index 4981eb47..fb1aa827 100644
--- a/src/components/Properties/PropertySelect.vue
+++ b/src/components/Properties/PropertySelect.vue
@@ -111,6 +111,7 @@ export default {
/**
* Since we're updating a local data based on the value prop,
* we need to make sure to update the local data on pop change
+ * TODO: check if this create performance drop
*/
value: function() {
this.localValue = this.value
diff --git a/src/components/Properties/PropertyText.vue b/src/components/Properties/PropertyText.vue
index 32937db0..9cf499c4 100644
--- a/src/components/Properties/PropertyText.vue
+++ b/src/components/Properties/PropertyText.vue
@@ -105,6 +105,7 @@ export default {
/**
* Since we're updating a local data based on the value prop,
* we need to make sure to update the local data on pop change
+ * TODO: check if this create performance drop
*/
value: function() {
this.localValue = this.value
diff --git a/src/components/Properties/PropertyTitle.vue b/src/components/Properties/PropertyTitle.vue
index cde06dd3..360e813a 100644
--- a/src/components/Properties/PropertyTitle.vue
+++ b/src/components/Properties/PropertyTitle.vue
@@ -43,6 +43,5 @@ export default {
required: true
}
}
-
}
</script>
diff --git a/src/components/Settings/SettingsAddressbook.vue b/src/components/Settings/SettingsAddressbook.vue
index fee2e324..73a80000 100644
--- a/src/components/Settings/SettingsAddressbook.vue
+++ b/src/components/Settings/SettingsAddressbook.vue
@@ -20,7 +20,6 @@
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-->
-
<template>
<div>
<li :class="{'disabled': !addressbook.enabled}" class="addressbook">
@@ -29,6 +28,8 @@
<!-- sharing button -->
<a href="#" class="addressbook__share icon-shared"
@click="toggleShare" />
+ <!-- rename addressbook name -->
+ <rename-addressbook-field v-if="editingName" />
<!-- popovermenu -->
<a v-click-outside="closeMenu" href="#" class="addressbook__menu"
@click="toggleMenu">
@@ -46,6 +47,7 @@
<script>
import popoverMenu from '../core/popoverMenu'
import shareAddressBook from './SettingsAddressbookShare'
+import renameAddressBookField from './SettingsRenameAddressbookField'
import clickOutside from 'vue-click-outside'
@@ -54,6 +56,7 @@ export default {
components: {
popoverMenu,
shareAddressBook,
+ renameAddressBookField,
clickOutside
},
directives: {
@@ -71,27 +74,37 @@ export default {
return {
menuOpen: false,
shareOpen: false,
- enabled: true
+ editingName: false,
+ newName: '' // new name for addressbook
}
},
computed: {
+ enabled() {
+ return this.addressbook.enabled
+ },
// building the popover menu
menu() {
return [{
href: '#',
icon: 'icon-public',
- text: 'Copy link'
+ text: 'Copy link',
+ action: () => {
+ alert('share link')
+ }
},
{
href: '#',
icon: 'icon-download',
- text: 'Download'
+ text: 'Download',
+ action: () => {
+ alert('download')
+ }
},
{
icon: 'icon-rename',
text: 'Rename',
- action: function renameAddressBook() {
- alert('rename the address book')
+ action: () => {
+ /* this.editingName = true */
}
},
{
@@ -99,15 +112,16 @@ export default {
text: 'Enabled',
input: 'checkbox',
model: this.enabled,
- action: function toggleEnabled() {
- alert('This addressbook is: enabled')
+ action: () => {
+ alert('change') // eslint-disable-line
+ this.$store.dispatch('toggleAddressbookEnabled', this.addressbook)
}
},
{
icon: 'icon-delete',
text: 'Delete',
- action: function deleteAddressBook() {
- alert('Delete AddressBook')
+ action: () => {
+ this.$store.dispatch('deleteAddressbook', this.addressbook)
}
}]
}
@@ -121,6 +135,12 @@ export default {
},
toggleMenu() {
this.menuOpen = !this.menuOpen
+ },
+ renameAddressBook() {
+ this.editingName = true
+ let addressbook = this.addressbook
+ let newName = this.newName
+ this.$store.dispatch('renameAddressbook', { addressbook, newName })
}
}
}
diff --git a/src/components/Settings/SettingsAddressbookShare.vue b/src/components/Settings/SettingsAddressbookShare.vue
index f64c5df5..5faec2bb 100644
--- a/src/components/Settings/SettingsAddressbookShare.vue
+++ b/src/components/Settings/SettingsAddressbookShare.vue
@@ -26,14 +26,13 @@
id="users-groups-search"
:options="usersOrGroups"
:searchable="true"
- :loading="isLoading"
:internal-search="false"
:options-limit="250"
:limit="3"
:max-height="600"
:show-no-results="true"
:placeholder="placeholder"
- :class="{ 'showContent': inputGiven }"
+ :class="{ 'showContent': inputGiven, 'icon-loading': isLoading }"
open-direction="bottom"
class="multiselect-vue"
@search-change="asyncFind"
@@ -51,7 +50,7 @@
<span slot="noResult">{{ noResult }} </span>
</multiselect>
<!-- list of user or groups addressbook is shared with -->
- <ul v-if="addressbook.shares.length > 0" class="addressbook__shares__list">
+ <ul v-if="addressbook.shares.length > 0" class="addressbook-shares__list">
<address-book-sharee v-for="sharee in addressbook.shares" :key="sharee.displayname + sharee.group" :sharee="sharee" />
</ul>
</div>
@@ -98,6 +97,10 @@ export default {
return t('contacts', 'No users or groups')
}
},
+ mounted() {
+ // This ensures that the multiselect input is in focus as soon as the user clicks share
+ document.getElementById('users-groups-search').focus()
+ },
methods: {
/**
* Share addressbook
@@ -108,7 +111,6 @@ export default {
let addressbook = this.addressbook
this.$store.dispatch('shareAddressbook', { addressbook, sharee, id, group })
},
-
/**
* Format responses from axios.all and add them to the option array
*
@@ -139,7 +141,6 @@ export default {
group
}
}))
- console.log(this.usersOrGroups) // eslint-disable-line
},
/**
@@ -168,12 +169,12 @@ export default {
console.debug(error)
}
}).then(() => {
-
this.isLoading = false
+ this.inputGiven = true
})
- this.inputGiven = true
} else {
this.inputGiven = false
+ this.isLoading = false
}
}, 500)
}
diff --git a/src/components/Settings/SettingsAddressbookSharee.vue b/src/components/Settings/SettingsAddressbookSharee.vue
index dcb00d03..29902b6b 100644
--- a/src/components/Settings/SettingsAddressbookSharee.vue
+++ b/src/components/Settings/SettingsAddressbookSharee.vue
@@ -21,10 +21,10 @@
-->
<template>
- <li class="addressbook__sharee">
+ <li class="addressbook-sharee">
<span :class="sharee.group ? 'icon-group' : 'icon-user'" class="icon" />
- <span class="addressbook__sharee__identifier">{{ sharee.displayname }}</span>
- <span class="addressbook__sharee__utils">
+ <span class="addressbook-sharee__identifier">{{ sharee.displayname }}</span>
+ <span class="addressbook-sharee__utils">
<input
:id="sharee.displayname"
v-model="writeable"
@@ -32,7 +32,7 @@
name="editable"
type="checkbox">
<label :for="sharee.displayName" @click="editSharee"> can edit</label>
- <span href="#" title="Delete"
+ <a href="#" title="Delete"
class="icon-delete"
@click="deleteSharee" />
</span>
diff --git a/src/components/Settings/SettingsRenameAddressbookField.vue b/src/components/Settings/SettingsRenameAddressbookField.vue
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/components/Settings/SettingsRenameAddressbookField.vue
diff --git a/src/components/core/popoverMenu/popoverItem.vue b/src/components/core/popoverMenu/popoverItem.vue
index e7c0b092..d021c9f3 100644
--- a/src/components/core/popoverMenu/popoverItem.vue
+++ b/src/components/core/popoverMenu/popoverItem.vue
@@ -32,7 +32,7 @@
<!-- If item.input is set instead, an put will be used -->
<span v-else-if="item.input" class="menuitem">
<input :id="item.key" :type="item.input" :class="item.input"
- v-model="item.model">
+ v-model="item.model" @change="item.action">
<label :for="item.key">{{ item.text }}</label>
</span>
<!-- If item.action is set instead, a button will be used -->
diff --git a/src/store/FakeName.vcf b/src/store/FakeName.vcf
index cae71a7b..ebfc383a 100644
--- a/src/store/FakeName.vcf
+++ b/src/store/FakeName.vcf
@@ -9,6 +9,12 @@ REV:2017-07-27T05:56:33Z
UID:5acf667e-1cbf-48a8-87fe-546ee31a0b23
END:VCARD
BEGIN:VCARD
+VERSION:4.0
+KIND:org
+FN:ABC Marketing ORG
+ORG:ABC\, Inc.;North American Division;Marketing
+END:VCARD
+BEGIN:VCARD
VERSION:3.0
N:Cunningham;Liam;;Mr.;
FN:Liam Cunningham
diff --git a/src/store/addressbooks.js b/src/store/addressbooks.js
index 54bd6d8a..d380c1ca 100644
--- a/src/store/addressbooks.js
+++ b/src/store/addressbooks.js
@@ -56,6 +56,37 @@ const mutations = {
},
/**
+ * Delete addressbook
+ *
+ * @param {Object} state Default state
+ * @param {Object} addressbooks Addressbook
+ */
+ deleteAddressbook(state, addressbook) {
+ state.addressbooks.splice(state.addressbooks.indexOf(addressbook), 1)
+ },
+
+ /**
+ * Toggle whether a Addressbook is Enabled
+ * @param {Object} context Current context
+ * @param {Object} addressbook
+ */
+ toggleAddressbookEnabled(context, addressbook) {
+ addressbook = state.addressbooks.find(search => search.id === addressbook.id)
+ addressbook.enabled = !addressbook.enabled
+ },
+
+ /**
+ * Rename a Addressbook
+ * @param {Object} context Current context
+ * @param {Object} data.addressbook
+ * @param {String} data.newName
+ */
+ renameAddressbook(context, { addressbook, newName }) {
+ addressbook = state.addressbooks.find(search => search.id === addressbook.id)
+ addressbook.displayName = newName
+ },
+
+ /**
* Append a list of contacts to an addressbook
* and remove duplicates
*
@@ -151,7 +182,9 @@ const mutations = {
}
}
})
+ console.log(addressbook) // eslint-disable-line
sharee = addressbook.shares.find(search => search === sharee)
+ console.log(sharee) // eslint-disable-line
sharee.writeable = !sharee.writeable
}
@@ -177,6 +210,12 @@ const actions = {
enabled: true,
owner: 'admin'
// dav: addressbook
+ }, {
+ id: 'ab2',
+ displayName: 'Addressbook 2',
+ enabled: true,
+ owner: 'admin'
+ // dav: addressbook
}]
// })
@@ -224,7 +263,6 @@ const actions = {
* @param {Object} sharee Addressbook sharee object
*/
removeSharee(context, sharee) {
- // Remove sharee from addressbook.
context.commit('removeSharee', sharee)
},
@@ -234,7 +272,6 @@ const actions = {
* @param {Object} sharee Addressbook sharee object
*/
toggleShareeWritable(context, sharee) {
- // Toggle sharee edit permissions.
context.commit('updateShareeWritable', sharee)
},