Skip to content

Commit

Permalink
Don't use deprecated filters anymore
Browse files Browse the repository at this point in the history
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
  • Loading branch information
raimund-schluessler committed Apr 25, 2022
1 parent 4237950 commit 76d406e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 24 deletions.
30 changes: 17 additions & 13 deletions src/components/AppNavigation/ListItemCalendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
<Avatar v-if="calendar.isSharedWithMe && loadedOwnerPrincipal" :user="ownerUserId" :display-name="ownerDisplayname" />
<div v-if="calendar.isSharedWithMe && !loadedOwnerPrincipal" class="icon icon-loading" />
<AppNavigationCounter v-if="calendarCount">
{{ calendarCount | counterFormatter }}
{{ counterFormatter(calendarCount) }}
</AppNavigationCounter>
</template>

Expand Down Expand Up @@ -186,18 +186,6 @@ export default {
directives: {
clickOutside: ClickOutside.directive,
},
filters: {
counterFormatter(count) {
switch (false) {
case count !== 0:
return ''
case count < 999:
return '999+'
default:
return count
}
},
},
props: {
calendar: {
type: Object,
Expand Down Expand Up @@ -309,6 +297,22 @@ export default {
'deleteCalendar',
'moveTask',
]),
/**
* Format the task counter
*
* @param {number} count The number of tasks
*/
counterFormatter(count) {
switch (false) {
case count !== 0:
return ''
case count < 999:
return '999+'
default:
return count
}
},
/**
* Handle the drag over
*
Expand Down
29 changes: 18 additions & 11 deletions src/views/AppNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
</template>
<template #counter>
<AppNavigationCounter v-show="collectionCount(collection.id)">
{{ collectionCount(collection.id) | counterFormatter }}
{{ counterFormatter(collectionCount(collection.id)) }}
</AppNavigationCounter>
</template>
</AppNavigationItem>
Expand Down Expand Up @@ -144,16 +144,7 @@ export default {
clickOutside: ClickOutside.directive,
},
filters: {
counterFormatter(count) {
switch (false) {
case count !== 0:
return ''
case count < 999:
return '999+'
default:
return count
}
},
},
data() {
return {
Expand Down Expand Up @@ -195,6 +186,22 @@ export default {
'setCalendarOrder',
]),
/**
* Format the task counter
*
* @param {number} count The number of tasks
*/
counterFormatter(count) {
switch (false) {
case count !== 0:
return ''
case count < 999:
return '999+'
default:
return count
}
},
/**
* Indicate that we drag a calendar item
*
Expand Down

0 comments on commit 76d406e

Please sign in to comment.