Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion src/components/AppNavigation/CalendarList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,34 @@
:calendar="calendar" />
</template>

<NcAppNavigationCaption v-if="sortedCalendars.tasks.length" :name="$t('calendar', 'Tasks')" />
<template v-if="!isPublic">
<Draggable
v-model="sortedCalendars.tasks"
itemKey="id"
:disabled="disableDragging"
v-bind="{ swapThreshold: 0.30, delay: 500, delayOnTouchOnly: true, touchStartThreshold: 3 }"
draggable=".draggable-calendar-list-item"
@update="updateInput">
<template #item="{ element: calendar }">
<CalendarListItem
:key="calendar.id"
class="draggable-calendar-list-item"
:calendar="calendar" />
</template>
</Draggable>
</template>
<template v-else>
<PublicCalendarListItem
v-for="calendar in sortedCalendars.tasks"
:key="calendar.id"
:calendar="calendar" />
</template>

<NcAppNavigationSpacer />

<!-- The header slot must be placed here, otherwise vuedraggable adds undefined as item to the array -->
<template>

Check warning on line 107 in src/components/AppNavigation/CalendarList.vue

View workflow job for this annotation

GitHub Actions / NPM lint

`<template>` require directive
<CalendarListItemLoadingPlaceholder v-if="loadingCalendars" />
</template>
</div>
Expand Down Expand Up @@ -129,12 +153,13 @@
return {
calendars: [],
/**
* Calendars sorted by personal, shared, and deck
* Calendars sorted by personal, shared, deck, and tasks
*/
sortedCalendars: {
personal: [],
shared: [],
deck: [],
tasks: [],
},

disableDragging: false,
Expand Down Expand Up @@ -182,6 +207,7 @@
personal: [],
shared: [],
deck: [],
tasks: [],
}

this.calendars.forEach((calendar) => {
Expand All @@ -195,6 +221,11 @@
return
}

if (calendar.supportsTasks && !calendar.supportsEvents && !calendar.supportsJournals) {
this.sortedCalendars.tasks.push(calendar)
return
}

this.sortedCalendars.personal.push(calendar)
})
},
Expand All @@ -209,6 +240,7 @@
...this.sortedCalendars.personal,
...this.sortedCalendars.shared,
...this.sortedCalendars.deck,
...this.sortedCalendars.tasks,
]
const newOrder = currentCalendars.reduce((newOrderObj, currentItem, currentIndex) => {
newOrderObj[currentItem.id] = currentIndex
Expand Down
Loading