Merge pull request #3147 from nextcloud/enh/dashboardAddCardButton2

This commit is contained in:
Julius Härtl
2021-06-25 11:27:26 +02:00
committed by GitHub

View File

@@ -21,32 +21,39 @@
-->
<template>
<DashboardWidget :items="cards"
empty-content-icon="icon-deck"
:empty-content-message="t('deck', 'No upcoming cards')"
:show-more-text="t('deck', 'upcoming cards')"
:show-more-url="showMoreUrl"
:loading="loading"
@hide="() => {}"
@markDone="() => {}">
<template #default="{ item }">
<a :key="item.id"
:href="cardLink(item)"
target="_blank"
class="card">
<div class="card--header">
<DueDate class="right" :card="item" />
<span class="title">{{ item.title }}</span>
</div>
<ul v-if="item.labels && item.labels.length"
class="labels">
<li v-for="label in item.labels" :key="label.id" :style="labelStyle(label)">
<span>{{ label.title }}</span>
</li>
</ul>
</a>
</template>
</DashboardWidget>
<div>
<DashboardWidget :items="cards"
empty-content-icon="icon-deck"
:empty-content-message="t('deck', 'No upcoming cards')"
:show-more-text="t('deck', 'upcoming cards')"
:loading="loading"
@hide="() => {}"
@markDone="() => {}">
<template #default="{ item }">
<a :key="item.id"
:href="cardLink(item)"
target="_blank"
class="card">
<div class="card--header">
<DueDate class="right" :card="item" />
<span class="title">{{ item.title }}</span>
</div>
<ul v-if="item.labels && item.labels.length"
class="labels">
<li v-for="label in item.labels" :key="label.id" :style="labelStyle(label)">
<span>{{ label.title }}</span>
</li>
</ul>
</a>
</template>
</DashboardWidget>
<div class="center-button">
<button @click="toggleAddCardModel">
{{ t('deck', 'Add card') }}
</button>
<CardCreateDialog v-if="showAddCardModal" @close="toggleAddCardModel" />
</div>
</div>
</template>
<script>
@@ -55,17 +62,20 @@ import { mapGetters } from 'vuex'
import labelStyle from './../mixins/labelStyle'
import DueDate from '../components/cards/badges/DueDate'
import { generateUrl } from '@nextcloud/router'
import CardCreateDialog from '../CardCreateDialog'
export default {
name: 'Dashboard',
components: {
DueDate,
DashboardWidget,
CardCreateDialog,
},
mixins: [labelStyle],
data() {
return {
loading: false,
showAddCardModal: false,
}
},
computed: {
@@ -81,7 +91,7 @@ export default {
list.sort((a, b) => {
return (new Date(a.duedate)).getTime() - (new Date(b.duedate)).getTime()
})
return list
return list.slice(0, 6)
},
cardLink() {
return (card) => {
@@ -98,12 +108,21 @@ export default {
this.loading = false
})
},
methods: {
toggleAddCardModel() {
this.showAddCardModal = !this.showAddCardModal
},
},
}
</script>
<style lang="scss" scoped>
@import './../css/labels';
.center-button {
text-align: center;
}
#deck-widget-empty-content {
text-align: center;
margin-top: 5vh;