Fixes facets list block linking to invalid URL.

This commit is contained in:
mateuswetah 2024-05-09 11:51:30 -03:00
parent 7581a4e9d7
commit 83db922a6b
5 changed files with 21 additions and 11 deletions

View File

@ -195,6 +195,8 @@
.wp-block-tainacan-facets-list ul.facets-list-edit li.facet-list-item {
display: flex;
align-items: flex-start; }
.wp-block-tainacan-facets-list ul.facets-list-edit li.facet-list-item a {
pointer-events: none; }
.wp-block-tainacan-facets-list ul.facets-list-edit li.facet-list-item button {
position: absolute !important;
background-color: rgba(255, 255, 255, 0.75);

File diff suppressed because one or more lines are too long

View File

@ -261,14 +261,14 @@ export default function({ attributes, setAttributes, isSelected, clientId }) {
if (isMetadatumTypeTaxonomy(metadatumType)) {
for (let facet of response.data.values) {
facetsObject.push(Object.assign({
term_url: facet.entity && facet.entity.url ? facet.entity.url : tainacan_blocks.site_url + '/' + collectionSlug + '/#/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value,
url: tainacan_blocks.site_url + '/' + collectionSlug + '/#/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value
term_url: facet.entity && facet.entity.url ? facet.entity.url : tainacan_blocks.site_url + '/' + collectionSlug + '/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value,
url: tainacan_blocks.site_url + '/' + collectionSlug + '/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value
}, facet));
}
} else {
for (let facet of response.data.values) {
facetsObject.push(Object.assign({
url: tainacan_blocks.site_url + '/' + collectionSlug + '/#/?metaquery[0][key]=' + metadatumId + '&metaquery[0][value]=' + facet.value
url: tainacan_blocks.site_url + '/' + collectionSlug + '/?metaquery[0][key]=' + metadatumId + '&metaquery[0][value]=' + facet.value
}, facet));
}
}
@ -344,8 +344,8 @@ export default function({ attributes, setAttributes, isSelected, clientId }) {
for (let facet of response.data.values) {
childFacets.push(Object.assign({
term_url: facet.entity && facet.entity.url ? facet.entity.url : tainacan_blocks.site_url + '/' + collectionSlug + '/#/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value,
url: tainacan_blocks.site_url + '/' + collectionSlug + '/#/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value
term_url: facet.entity && facet.entity.url ? facet.entity.url : tainacan_blocks.site_url + '/' + collectionSlug + '/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value,
url: tainacan_blocks.site_url + '/' + collectionSlug + '/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value
}, facet));
}

View File

@ -226,6 +226,10 @@
display: flex;
align-items: flex-start;
a {
pointer-events: none;
}
button {
position: absolute !important;
background-color: rgba(255, 255, 255, 0.75);

View File

@ -33,6 +33,7 @@
<ul
v-if="layout !== 'list'"
:style="{
listStyle: 'none',
gridGap: layout == 'grid' ? (gridMargin + 'px') : 'inherit',
marginTop: showSearchBar ? '1.5em' : '4px'
}"
@ -50,6 +51,7 @@
<ul
v-else
:style="{
listStyle: 'none',
marginTop: showSearchBar ? '1.5em' : '4px'
}"
class="facets-list"
@ -73,6 +75,7 @@
<ul
v-if="facets.length > 0 && layout != 'list'"
:style="{
listStyle: 'none',
gridGap: layout == 'grid' ? (gridMargin + 'px') : 'inherit',
marginTop: showSearchBar ? '1.5em' : '0px'
}"
@ -102,6 +105,7 @@
<ul
v-if="facets.length > 0 && layout == 'list'"
:style="{
listStyle: 'none',
marginTop: showSearchBar ? '1.5em' : '0px'
}"
class="facets-list"
@ -321,14 +325,14 @@ export default {
if (this.isMetadatumTypeTaxonomy) {
for (let facet of response.data.values) {
this.facets.push(Object.assign({
term_url: facet.entity && facet.entity.url ? facet.entity.url : this.tainacanSiteUrl + '/' + this.collectionSlug + '/#/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value,
url: this.tainacanSiteUrl + '/' + this.collectionSlug + '/#/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value
term_url: facet.entity && facet.entity.url ? facet.entity.url : this.tainacanSiteUrl + '/' + this.collectionSlug + '/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value,
url: this.tainacanSiteUrl + '/' + this.collectionSlug + '/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value
}, facet));
}
} else {
for (let facet of response.data.values) {
this.facets.push(Object.assign({
url: this.tainacanSiteUrl + '/' + this.collectionSlug + '/#/?metaquery[0][key]=' + this.metadatumId + '&metaquery[0][value]=' + facet.value
url: this.tainacanSiteUrl + '/' + this.collectionSlug + '/?metaquery[0][key]=' + this.metadatumId + '&metaquery[0][value]=' + facet.value
}, facet));
}
}
@ -387,8 +391,8 @@ export default {
for (let facet of response.data.values) {
childFacets.push(Object.assign({
term_url: facet.entity && facet.entity.url ? facet.entity.url : this.tainacanSiteUrl + '/' + this.collectionSlug + '/#/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value,
url: this.tainacanSiteUrl + '/' + this.collectionSlug + '/#/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value
term_url: facet.entity && facet.entity.url ? facet.entity.url : this.tainacanSiteUrl + '/' + this.collectionSlug + '/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value,
url: this.tainacanSiteUrl + '/' + this.collectionSlug + '/?taxquery[0][compare]=IN&taxquery[0][taxonomy]=' + facet.taxonomy + '&taxquery[0][terms][0]=' + facet.value
}, facet));
}