Skip to content

Commit

Permalink
feat: Add Page Templates text filtering - MEED-6844 - Meeds-io/MIPs#133
Browse files Browse the repository at this point in the history
… (#64)
  • Loading branch information
boubaker authored May 17, 2024
1 parent 916c9bb commit 9e4e3c4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
placeholder: $t('pageTemplates.filter.placeholder'),
tooltip: $t('pageTemplates.filter.placeholder'),
}"
@filter-text-input-end-typing="$emit('page-templates-filter', $event)">
@filter-text-input="$emit('page-templates-filter', $event)">
<template #left>
<v-btn
id="applicationToolbarLeftButton"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<v-data-table
:headers="headers"
:items="pageTemplates"
:items="filteredPageTemplates"
:loading="loading"
:disable-sort="$root.isMobile"
:hide-default-header="$root.isMobile"
Expand Down Expand Up @@ -56,6 +56,14 @@ export default {
},
];
},
filteredPageTemplates() {
return this.keyword?.length && this.pageTemplates.filter(t => {
const name = this.$te(t.name) ? this.$t(t.name) : t.name;
const description = this.$te(t.description) ? this.$t(t.description) : t.description;
return name?.toLowerCase?.()?.includes(this.keyword.toLowerCase())
|| this.$utils.htmlToText(description)?.toLowerCase?.()?.includes(this.keyword.toLowerCase());
}) || this.pageTemplates;
},
},
created() {
this.refreshPageTemplates();
Expand Down

0 comments on commit 9e4e3c4

Please sign in to comment.