Adds URL to list filtered by taxonomy as well.

This commit is contained in:
Mateus Machado Luna 2019-06-10 16:24:40 -03:00
parent fb00023747
commit 10aa8ca39c
6 changed files with 32 additions and 14 deletions

View File

@ -441,8 +441,9 @@
.wp-block-tainacan-facets-list ul.facets-list-edit.facets-layout-cloud li.facet-list-item {
position: relative;
display: inline-block;
margin: 3px 12px;
line-height: normal; }
margin: 5px 12px;
line-height: normal;
vertical-align: middle; }
.wp-block-tainacan-facets-list ul.facets-list.facets-layout-cloud li.facet-list-item a,
.wp-block-tainacan-facets-list ul.facets-list-edit.facets-layout-cloud li.facet-list-item a {
color: #454647;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -222,12 +222,20 @@ export default {
this.tainacanAxios.get(endpoint, { cancelToken: this.facetsRequestSource.token })
.then(response => {
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
}, facet));
if (this.metadatumType == 'Taxonomy') {
for (let facet of response.data.values) {
this.facets.push(Object.assign({
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
}, facet));
}
}
this.isLoading = false;
this.totalFacets = Number(response.headers['x-wp-total']);
this.lastTerm = response.data.values.length > 0 ? response.data.last_term : '';

View File

@ -372,8 +372,9 @@
li.facet-list-item {
position: relative;
display: inline-block;
margin: 3px 12px;
margin: 5px 12px;
line-height: normal;
vertical-align: middle;
a {
color: #454647;

View File

@ -224,10 +224,18 @@ registerBlockType('tainacan/facets-list', {
.then(response => {
facetsObject = [];
for (let facet of response.data.values) {
facetsObject.push(Object.assign({
url: tainacan_plugin.site_url + '/' + collectionSlug + '/#/?metaquery[0][key]=' + metadatumId + '&metaquery[0][value]=' + facet.value
}, facet));
if (metadatumType == 'Taxonomy') {
for (let facet of response.data.values) {
facetsObject.push(Object.assign({
url: tainacan_plugin.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_plugin.site_url + '/' + collectionSlug + '/#/?metaquery[0][key]=' + metadatumId + '&metaquery[0][value]=' + facet.value
}, facet));
}
}
for (let facet of facetsObject)