Show caldav url in settings if it's enabled server side

This commit is contained in:
kolaente 2020-10-03 14:58:33 +02:00
parent 2c6ec6ec35
commit 2870f9217e
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
4 changed files with 64 additions and 17 deletions

View File

@ -38,12 +38,12 @@
<template v-if="linkShares.length > 0"> <template v-if="linkShares.length > 0">
<tr :key="s.id" v-for="s in linkShares"> <tr :key="s.id" v-for="s in linkShares">
<td> <td>
<div class="field has-addons"> <div class="field has-addons no-input-mobile">
<div class="control"> <div class="control">
<input :value="getShareLink(s.hash)" class="input" readonly type="text"/> <input :value="getShareLink(s.hash)" class="input" readonly type="text"/>
</div> </div>
<div class="control"> <div class="control">
<a @click="copy(getShareLink(s.hash))" class="button is-success noshadow"> <a @click="copy(getShareLink(s.hash))" class="button is-success noshadow" v-tooltip="'Copy to clipboard'">
<span class="icon"> <span class="icon">
<icon icon="paste"/> <icon icon="paste"/>
</span> </span>

View File

@ -19,6 +19,7 @@ export default {
imprintUrl: '', imprintUrl: '',
privacyPolicyUrl: '', privacyPolicyUrl: '',
}, },
caldavEnabled: false,
}), }),
mutations: { mutations: {
[CONFIG](state, config) { [CONFIG](state, config) {
@ -34,6 +35,7 @@ export default {
state.enabledBackgroundProviders = config.enabled_background_providers state.enabledBackgroundProviders = config.enabled_background_providers
state.legal.imprintUrl = config.legal.imprint_url state.legal.imprintUrl = config.legal.imprint_url
state.legal.privacyPolicyUrl = config.legal.privacy_policy_url state.legal.privacyPolicyUrl = config.legal.privacy_policy_url
state.caldavEnabled = config.caldav_enabled
}, },
}, },
actions: { actions: {

View File

@ -23,24 +23,22 @@
} }
} }
.link-share-list { .field.has-addons.no-input-mobile {
.field.has-addons { .control:first-child {
width: 100%;
}
.button {
height: 40px;
}
@media screen and (max-width: $tablet) {
.control:first-child { .control:first-child {
width: 100%; display: none;
} }
.button { .button {
height: 40px; border-radius: $radius !important;
}
@media screen and (max-width: $tablet) {
.control:first-child {
display: none;
}
.button {
border-radius: $radius !important;
}
} }
} }
} }

View File

@ -174,7 +174,9 @@
</div> </div>
</div> </div>
</div> </div>
<div class="card" v-if="totpEnabled">
<!-- Migration -->
<div class="card" v-if="migratorsEnabled">
<header class="card-header"> <header class="card-header">
<p class="card-header-title"> <p class="card-header-title">
Migrate from other services to Vikunja Migrate from other services to Vikunja
@ -190,6 +192,38 @@
</router-link> </router-link>
</div> </div>
</div> </div>
<!-- Caldav -->
<div class="card" v-if="caldavEnabled">
<header class="card-header">
<p class="card-header-title">
Caldav
</p>
</header>
<div class="card-content content">
<p>
You can connect Vikunja to caldav clients to view and manage all tasks from different clients.
Enter this url into your client:
</p>
<div class="field has-addons no-input-mobile">
<div class="control is-expanded">
<input type="text" v-model="caldavUrl" class="input" readonly/>
</div>
<div class="control">
<a @click="copy(caldavUrl)" class="button is-success noshadow" v-tooltip="'Copy to clipboard'">
<span class="icon">
<icon icon="paste"/>
</span>
</a>
</div>
</div>
<p>
<a href="https://vikunja.io/docs/caldav/" target="_blank">
More information about caldav in Vikunja
</a>
</p>
</div>
</div>
</div> </div>
</template> </template>
@ -204,6 +238,7 @@ import TotpService from '../../services/totp'
import {mapState} from 'vuex' import {mapState} from 'vuex'
import AvatarSettings from '../../components/user/avatar-settings' import AvatarSettings from '../../components/user/avatar-settings'
import copy from 'copy-to-clipboard'
export default { export default {
name: 'Settings', name: 'Settings',
@ -223,6 +258,8 @@ export default {
totpConfirmPasscode: '', totpConfirmPasscode: '',
totpDisableForm: false, totpDisableForm: false,
totpDisablePassword: '', totpDisablePassword: '',
caldavUrl: '',
} }
}, },
components: { components: {
@ -239,6 +276,7 @@ export default {
this.totp = new TotpModel() this.totp = new TotpModel()
this.totpStatus() this.totpStatus()
this.buildCaldavUrl()
}, },
mounted() { mounted() {
this.setTitle('Settings') this.setTitle('Settings')
@ -246,6 +284,8 @@ export default {
computed: mapState({ computed: mapState({
totpEnabled: state => state.config.totpEnabled, totpEnabled: state => state.config.totpEnabled,
migratorsEnabled: state => state.config.availableMigrators !== null && state.config.availableMigrators.length > 0, migratorsEnabled: state => state.config.availableMigrators !== null && state.config.availableMigrators.length > 0,
caldavEnabled: state => state.config.caldavEnabled,
userInfo: state => state.auth.info,
}), }),
methods: { methods: {
updatePassword() { updatePassword() {
@ -319,6 +359,13 @@ export default {
}) })
.catch(e => this.error(e, this)) .catch(e => this.error(e, this))
}, },
buildCaldavUrl() {
const apiBase = window.API_URL.replace('/api/v1', '')
this.caldavUrl = `${apiBase}/dav/principals/${this.userInfo.username}/`
},
copy(text) {
copy(text)
},
}, },
} }
</script> </script>