Show caldav url in settings if it's enabled server side
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2020-10-03 14:58:33 +02:00
parent 2c6ec6ec35
commit 2870f9217e
Signed by: 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">
<tr :key="s.id" v-for="s in linkShares">
<td>
<div class="field has-addons">
<div class="field has-addons no-input-mobile">
<div class="control">
<input :value="getShareLink(s.hash)" class="input" readonly type="text"/>
</div>
<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">
<icon icon="paste"/>
</span>

View File

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

View File

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

View File

@ -174,7 +174,9 @@
</div>
</div>
</div>
<div class="card" v-if="totpEnabled">
<!-- Migration -->
<div class="card" v-if="migratorsEnabled">
<header class="card-header">
<p class="card-header-title">
Migrate from other services to Vikunja
@ -190,6 +192,38 @@
</router-link>
</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>
</template>
@ -204,6 +238,7 @@ import TotpService from '../../services/totp'
import {mapState} from 'vuex'
import AvatarSettings from '../../components/user/avatar-settings'
import copy from 'copy-to-clipboard'
export default {
name: 'Settings',
@ -223,6 +258,8 @@ export default {
totpConfirmPasscode: '',
totpDisableForm: false,
totpDisablePassword: '',
caldavUrl: '',
}
},
components: {
@ -239,6 +276,7 @@ export default {
this.totp = new TotpModel()
this.totpStatus()
this.buildCaldavUrl()
},
mounted() {
this.setTitle('Settings')
@ -246,6 +284,8 @@ export default {
computed: mapState({
totpEnabled: state => state.config.totpEnabled,
migratorsEnabled: state => state.config.availableMigrators !== null && state.config.availableMigrators.length > 0,
caldavEnabled: state => state.config.caldavEnabled,
userInfo: state => state.auth.info,
}),
methods: {
updatePassword() {
@ -319,6 +359,13 @@ export default {
})
.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>