Skip to content

Commit

Permalink
fix(PageList): Add icon to clear the filter/search string
Browse files Browse the repository at this point in the history
Fixes: #1501

Signed-off-by: Jonas <jonas@freesources.org>
  • Loading branch information
mejo- committed Sep 24, 2024
1 parent e405d89 commit dfed63f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/components/PageList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
:label="t('collectives', 'Search pages')"
:value.sync="filterString"
class="page-filter"
:placeholder="t('collectives', 'Search pages ...')" />
:placeholder="t('collectives', 'Search pages ...')"
trailing-button-icon="close"
:show-trailing-button="isFilteredView"
@trailing-button-click="clearFilterString" />
<NcActions class="toggle toggle-push-to-right">
<NcActionButton class="toggle-button"
:aria-label="labels.showTemplates"
Expand Down Expand Up @@ -95,9 +98,9 @@
:key="templateView.id"
:page="templateView"
:level="1"
:filtered-view="isFilteredview"
:filtered-view="isFilteredView"
:is-template="true" />
<div v-if="isFilteredview" ref="pageListFiltered" class="page-list-filtered">
<div v-if="isFilteredView" ref="pageListFiltered" class="page-list-filtered">
<NcAppNavigationCaption v-if="filteredPages.length > 0" :name="t('Collectives','Results in title')" />
<RecycleScroller v-if="filteredPages.length > 0"
v-slot="{ item }"
Expand Down Expand Up @@ -133,7 +136,7 @@
<Draggable v-else
:list="subpages"
:parent-id="rootPage.id"
:disable-sorting="isFilteredview">
:disable-sorting="isFilteredView">
<SubpageList v-for="page in subpages"
:key="page.id"
:data-page-id="page.id"
Expand Down Expand Up @@ -273,7 +276,7 @@ export default {
return (sortOrder) => this.sortByOrder === sortOrder
},

isFilteredview() {
isFilteredView() {
return this.filterString !== ''
},

Expand Down Expand Up @@ -351,6 +354,10 @@ export default {
...mapActions(usePagesStore, ['setPageOrder', 'toggleTemplates']),
...mapActions(useSearchStore, ['setSearchQuery']),

clearFilterString() {
this.filterString = ''
},

/**
* Change page sort order and scroll to current page
*
Expand Down

0 comments on commit dfed63f

Please sign in to comment.