summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJessica <jessica@Absolventas-MacBook-Pro.local>2018-08-13 19:24:27 +0200
committerJessica <jessica@Absolventas-MacBook-Pro.local>2018-08-13 19:24:27 +0200
commit104c8115cbf38d7b35135d0fb940efb2c83fef28 (patch)
tree01ad65865d3cae8ea43ea62dd4d93a74d52b314b /src
parent54e04c4e5657b411d1d72a1c363fb07f1a3f4b2c (diff)
added group to sharee so to distinguish groups and users and decide which icon to display
Diffstat (limited to 'src')
-rw-r--r--src/components/Settings/SettingsAddressbook.vue8
-rw-r--r--src/components/Settings/SettingsAddressbookShare.vue22
-rw-r--r--src/components/Settings/SettingsAddressbookSharee.vue3
-rw-r--r--src/components/Settings/SettingsNewAddressbook.vue2
-rw-r--r--src/components/SettingsSection.vue12
-rw-r--r--src/store/addressbooks.js17
6 files changed, 34 insertions, 30 deletions
diff --git a/src/components/Settings/SettingsAddressbook.vue b/src/components/Settings/SettingsAddressbook.vue
index 0b393d7b..8544794b 100644
--- a/src/components/Settings/SettingsAddressbook.vue
+++ b/src/components/Settings/SettingsAddressbook.vue
@@ -39,21 +39,21 @@
</a>
</li>
<!-- sharing input -->
- <share-address-book v-if="shareOpen" :addressbook="addressbook" />
+ <share-addressbook v-if="shareOpen" :addressbook="addressbook" />
</div>
</template>
<script>
import popoverMenu from '../core/popoverMenu'
-import shareAddressBook from './SettingsAddressBookShare'
+import shareAddressbook from './SettingsAddressbookShare'
import clickOutside from 'vue-click-outside'
export default {
- name: 'SettingsAddressBook',
+ name: 'SettingsAddressbook',
components: {
popoverMenu,
- shareAddressBook,
+ shareAddressbook,
clickOutside
},
directives: {
diff --git a/src/components/Settings/SettingsAddressbookShare.vue b/src/components/Settings/SettingsAddressbookShare.vue
index 223387b1..00ad7d22 100644
--- a/src/components/Settings/SettingsAddressbookShare.vue
+++ b/src/components/Settings/SettingsAddressbookShare.vue
@@ -49,24 +49,24 @@
</multiselect>
<!-- list of user or groups addressbook is shared with -->
<ul v-if="addressbook.shares.length > 0" class="addressbook__shares__list">
- <address-book-sharee v-for="sharee in addressbook.shares" :key="sharee.displayname" :sharee="sharee" />
+ <addressbook-sharee v-for="sharee in addressbook.shares" :key="sharee.displayname + sharee.group" :sharee="sharee" />
</ul>
</div>
</template>
<script>
import Multiselect from 'vue-multiselect'
-import addressBookSharee from './SettingsAddressBookSharee'
+import addressbookSharee from './SettingsAddressbookSharee'
import clickOutside from 'vue-click-outside'
import api from '../../services/api'
export default {
- name: 'SettingsShareAddressBook',
+ name: 'SettingsShareAddressbook',
components: {
clickOutside,
Multiselect,
- addressBookSharee
+ addressbookSharee
},
directives: {
clickOutside
@@ -98,10 +98,11 @@ export default {
let payload = []
payload.push(this.addressbook)
payload.push(chosenUserOrGroup.match)
+ payload.push(chosenUserOrGroup.matchgroup)
this.$store.dispatch('shareAddressbook', payload)
},
- formatMatchResults(matches, query, matchTag) {
+ formatMatchResults(matches, query, group) {
// format response from axios.all and add them to the option array
if (matches.length < 1) {
return
@@ -109,17 +110,18 @@ export default {
let regex = new RegExp(query, 'i')
for (let i = 0; i < matches.length; i++) {
for (let j = 0; j < this.addressbook.shares.length; j++) {
- if (this.addressbook.shares[j].displayname === matches[i] + ' ' + matchTag) {
+ if (this.addressbook.shares[j].displayname === matches[i] && this.addressbook.shares[j].group === group) {
return
}
}
let matchResult = matches[i].split(regex)
let newMatch = {
- match: matches[i] + ' ' + matchTag,
+ match: matches[i],
matchstart: matchResult[0],
matchpattern: matches[i].match(regex)[0],
matchend: matchResult[1],
- matchtag: matchTag
+ matchtag: group ? '(group)' : '(user)',
+ matchgroup: group
}
this.usersOrGroups.push(newMatch)
}
@@ -136,12 +138,12 @@ export default {
let matchingUsers = response[0].data.ocs.data.users
let matchingGroups = response[1].data.ocs.data.groups
try {
- this.formatMatchResults(matchingUsers, query, '(user)')
+ this.formatMatchResults(matchingUsers, query, false)
} catch (error) {
console.debug(error)
}
try {
- this.formatMatchResults(matchingGroups, query, '(group)')
+ this.formatMatchResults(matchingGroups, query, true)
} catch (error) {
console.debug(error)
}
diff --git a/src/components/Settings/SettingsAddressbookSharee.vue b/src/components/Settings/SettingsAddressbookSharee.vue
index 0cccb8b2..60fc832e 100644
--- a/src/components/Settings/SettingsAddressbookSharee.vue
+++ b/src/components/Settings/SettingsAddressbookSharee.vue
@@ -22,7 +22,8 @@
<template>
<li class="addressbook__sharee">
- <span class="icon icon-group" />
+ <span v-if="sharee.group" class="icon icon-group" />
+ <span v-else class="icon icon-user" />
<span class="addressbook__sharee__identifier">{{ sharee.displayname }}</span>
<span class="addressbook__sharee__utils">
<input
diff --git a/src/components/Settings/SettingsNewAddressbook.vue b/src/components/Settings/SettingsNewAddressbook.vue
index 18e2e988..d31fee0e 100644
--- a/src/components/Settings/SettingsNewAddressbook.vue
+++ b/src/components/Settings/SettingsNewAddressbook.vue
@@ -40,7 +40,7 @@
import clickOutside from 'vue-click-outside'
export default {
- name: 'SettingsNewAddressBook',
+ name: 'SettingsNewAddressbook',
components: {
clickOutside
},
diff --git a/src/components/SettingsSection.vue b/src/components/SettingsSection.vue
index 4743e6ae..8e50157e 100644
--- a/src/components/SettingsSection.vue
+++ b/src/components/SettingsSection.vue
@@ -23,9 +23,9 @@
<template>
<div>
<ul id="address-book-list">
- <address-book v-for="addressbook in addressbooks" :key="addressbook.id" :addressbook="addressbook" />
+ <addressbook v-for="addressbook in addressbooks" :key="addressbook.id" :addressbook="addressbook" />
</ul>
- <add-address-book :addressbooks="addressbooks" />
+ <add-addressbook :addressbooks="addressbooks" />
<import-contacts :addressbooks="addressbooks" class="settings-section" />
<sort-contacts class="settings-section" />
@@ -33,16 +33,16 @@
</template>
<script>
-import addressBook from '../components/Settings/SettingsAddressBook'
-import addAddressBook from '../components/Settings/SettingsNewAddressBook'
+import addressbook from '../components/Settings/SettingsAddressbook'
+import addAddressbook from '../components/Settings/SettingsNewAddressbook'
import importContacts from '../components/Settings/SettingsImportContacts'
import sortContacts from '../components/Settings/SettingsSortContacts'
export default {
name: 'ContentList',
components: {
- addressBook,
- addAddressBook,
+ addressbook,
+ addAddressbook,
importContacts,
sortContacts
},
diff --git a/src/store/addressbooks.js b/src/store/addressbooks.js
index 9697fb2d..4902f5ed 100644
--- a/src/store/addressbooks.js
+++ b/src/store/addressbooks.js
@@ -102,11 +102,12 @@ const mutations = {
* @param {Object} data
* @param {Object} data.addressbook the addressbook
*/
- shareAddressbook(state, [ addressbook, sharee ]) {
+ shareAddressbook(state, [ addressbook, sharee, group ]) {
addressbook = state.addressbooks.find(search => search === addressbook)
let newSharee = {}
newSharee.displayname = sharee
newSharee.writeable = false
+ newSharee.group = group
addressbook.shares.push(newSharee)
},
@@ -171,9 +172,9 @@ const actions = {
enabled: true,
owner: 'admin',
shares: [
- { displayname: 'Bob', writeable: true },
- { displayname: 'Rita', writeable: true },
- { displayname: 'Sue', writeable: false }
+ { displayname: 'Bob', writeable: true, group: false },
+ { displayname: 'Rita', writeable: true, group: false },
+ { displayname: 'Sue', writeable: false, group: false }
],
contacts: {}
},
@@ -183,8 +184,8 @@ const actions = {
enabled: false,
owner: 'admin',
shares: [
- { displayname: 'Aimee', writeable: false },
- { displayname: 'Jaguar', writeable: true }
+ { displayname: 'Aimee', writeable: false, group: false },
+ { displayname: 'Jaguar', writeable: true, group: true }
],
contacts: {}
},
@@ -250,9 +251,9 @@ const actions = {
* @param {Object} addressbook Addressbook selected
* @param {Object} sharee Addressbook sharee object
*/
- shareAddressbook(context, [ addressbook, sharee ]) {
+ shareAddressbook(context, [ addressbook, sharee, group ]) {
// Share addressbook with entered group or user
- context.commit('shareAddressbook', [ addressbook, sharee ])
+ context.commit('shareAddressbook', [ addressbook, sharee, group ])
}
}