diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-09-06 16:09:32 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-09-06 16:09:32 +0200 |
commit | 5aed9e18bedef51be143ab426916ab841f44e032 (patch) | |
tree | 0ae827c792fdc047c481e8904a58fcea9d0b0ec9 /src | |
parent | 034a253915ab45e81d55d391292105678a436292 (diff) | |
parent | f3c0746e5bc2e4e04e4b25bce8169a25541eef26 (diff) |
Merge branch 'vue-settings-addressbook-popovermenu' of https://github.com/nextcloud/contacts into vue-settings-addressbook-popovermenu
Diffstat (limited to 'src')
-rw-r--r-- | src/components/Settings/SettingsAddressbook.vue | 75 | ||||
-rw-r--r-- | src/store/index.js | 2 |
2 files changed, 43 insertions, 34 deletions
diff --git a/src/components/Settings/SettingsAddressbook.vue b/src/components/Settings/SettingsAddressbook.vue index ae76403c..244cf2ab 100644 --- a/src/components/Settings/SettingsAddressbook.vue +++ b/src/components/Settings/SettingsAddressbook.vue @@ -55,8 +55,6 @@ import popoverMenu from '../core/popoverMenu' import shareAddressBook from './SettingsAddressbookShare' import renameAddressBookField from './SettingsRenameAddressbookField' - -import VueClipboard from 'vue-clipboard2' import clickOutside from 'vue-click-outside' export default { @@ -67,8 +65,7 @@ export default { renameAddressBookField }, directives: { - clickOutside, - VueClipboard + clickOutside }, props: { addressbook: { @@ -94,30 +91,45 @@ export default { }, // building the popover menu menu() { - return [{ - href: '#', - icon: 'icon-public', - text: !this.copied ? t('contacts', 'Copy link') : this.copySuccess ? t('contacts', 'Copied') : t('contacts', 'Can not copy'), - action: this.copyLink - }, - { - href: this.addressbook.url + '?export', - icon: 'icon-download', - text: t('contacts', 'Download'), - action: '' - }, - { - icon: 'icon-rename', - text: t('contacts', 'Rename'), - action: this.renameAddressbook - }, - { - icon: 'checkbox', - text: this.enabled ? t('contacts', 'Enabled') : t('contacts', 'Disabled'), - input: 'checkbox', - model: this.enabled, - action: this.toggleAddressbookEnabled - }] + let menu = + [{ + href: this.addressbook.url, + icon: 'icon-public', + text: !this.copied + ? t('contacts', 'Copy link') + : this.copySuccess + ? t('contacts', 'Copied') + : t('contacts', 'Can not copy'), + action: this.copyLink + }, + { + href: this.addressbook.url + '?export', + icon: 'icon-download', + text: t('contacts', 'Download'), + action: null + }, + { + icon: 'icon-rename', + text: t('contacts', 'Rename'), + action: this.renameAddressbook + }, + { + icon: 'checkbox', + text: this.enabled ? t('contacts', 'Enabled') : t('contacts', 'Disabled'), + input: 'checkbox', + key: 'enableAddressbook', + model: this.enabled, + action: this.toggleAddressbookEnabled + }] + // check to ensure last addressbook is not deleted. + if (this.$store.getters.getAddressbooks.length > 1 ) { + menu.push({ + icon: 'icon-delete', + text: t('contacts', 'Delete'), + action: this.deleteAddressbook + }) + } + return menu } }, mounted() { @@ -150,8 +162,6 @@ export default { }, copyLink() { // copy link for addressbook to clipboard - this.copySuccess = true - this.copied = true this.$copyText(this.addressbook.url).then(e => { this.copySuccess = true this.copied = true @@ -160,10 +170,7 @@ export default { this.copied = true }) - setTimeout(function() { - console.log('copied') - this.copied = false - }, 500) + setTimeout(() => { this.copied = false }, 1500) } } } diff --git a/src/store/index.js b/src/store/index.js index 8bd7c2c0..9883147f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -26,8 +26,10 @@ import addressbooks from './addressbooks' import contacts from './contacts' import groups from './groups' import importState from './importState' +import VueClipboard from 'vue-clipboard2' Vue.use(Vuex) +Vue.use(VueClipboard) const mutations = {} |