From 414a89fdd656a11a68c6fafcf09280dbc42d3f5a Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Mon, 1 Jul 2024 12:20:37 -0300 Subject: [PATCH] Fixes to items list perpage and link reference. --- src/views/admin/scss/_filters-menu-modal.scss | 2 +- .../theme-search/js/view-modes-mixin.js | 4 ++-- .../faceted-search/theme-search/scss/_layout.scss | 6 +++++- .../gutenberg-blocks/blocks/faceted-search/theme.vue | 11 ++++++----- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/views/admin/scss/_filters-menu-modal.scss b/src/views/admin/scss/_filters-menu-modal.scss index 4fdabe8ad..7caa641fd 100644 --- a/src/views/admin/scss/_filters-menu-modal.scss +++ b/src/views/admin/scss/_filters-menu-modal.scss @@ -44,7 +44,7 @@ @media screen and (max-width: 768px) { - &:not(.filters-menu-modal) { + &.modal:not(.filters-menu-modal) { .modal-content { background-color: var(--tainacan-background-color); margin: 0 12% 0 0; diff --git a/src/views/gutenberg-blocks/blocks/faceted-search/theme-search/js/view-modes-mixin.js b/src/views/gutenberg-blocks/blocks/faceted-search/theme-search/js/view-modes-mixin.js index 432d196fa..14d38567e 100644 --- a/src/views/gutenberg-blocks/blocks/faceted-search/theme-search/js/view-modes-mixin.js +++ b/src/views/gutenberg-blocks/blocks/faceted-search/theme-search/js/view-modes-mixin.js @@ -82,8 +82,8 @@ export const viewModesMixin = { // Inserts information necessary for item by item navigation on single pages this.queries['pos'] = ((this.queries['paged'] - 1) * this.queries['perpage']) + index; this.queries['source_list'] = this.termId ? 'term' : (!this.collectionId || this.collectionId == 'default' ? 'repository' : 'collection'); - if ( this.$route && this.$route.path ) - this.queries['ref'] = this.$route.path; + if ( this.$route && this.$route.href && this.$route.href.split('?') && this.$route.href.split('?').length ) + this.queries['ref'] = this.$route.href; return itemUrl + '?' + qs.stringify(this.queries); } return itemUrl; diff --git a/src/views/gutenberg-blocks/blocks/faceted-search/theme-search/scss/_layout.scss b/src/views/gutenberg-blocks/blocks/faceted-search/theme-search/scss/_layout.scss index 250ae221e..a7f46bab2 100644 --- a/src/views/gutenberg-blocks/blocks/faceted-search/theme-search/scss/_layout.scss +++ b/src/views/gutenberg-blocks/blocks/faceted-search/theme-search/scss/_layout.scss @@ -215,13 +215,17 @@ @media screen and (max-width: 768px) { &.is-filters-menu-open { - + + .items-list-area { + max-width: 100%; + } .filters-menu { float: none; max-width: 100%; } .items-list-area { width: 100%; + max-width: 100%; } .filters-menu { diff --git a/src/views/gutenberg-blocks/blocks/faceted-search/theme.vue b/src/views/gutenberg-blocks/blocks/faceted-search/theme.vue index c2c10ff21..0ada8cf20 100644 --- a/src/views/gutenberg-blocks/blocks/faceted-search/theme.vue +++ b/src/views/gutenberg-blocks/blocks/faceted-search/theme.vue @@ -1078,6 +1078,12 @@ } } + // If any default items per page is set, apply it + // 12 is already the default value, se we don't set this value + if (this.defaultItemsPerPage != undefined && this.defaultItemsPerPage !== 12 ) { + this.$eventBusSearch.setItemsPerPage(this.defaultItemsPerPage, true); + } + for (let key in currentQuery) { if (currentQuery[key] == 'true') currentQuery[key] = true; @@ -1172,11 +1178,6 @@ this.$eventBusSearch.setItemsPerPage(24, true); } } - - // If any default items per page is set, apply it - if (this.defaultItemsPerPage) - this.$eventBusSearch.setItemsPerPage(this.defaultItemsPerPage, true); - // Watches window resize to adjust filter's top position and compression on mobile if ( !this.hideFilters && !this.shouldNotHideFiltersOnMobile ) {