Orders selection blocks by post__in. #741.
This commit is contained in:
parent
d5174a1d2f
commit
6498b0a5cb
|
@ -364,7 +364,8 @@ class REST_Controller extends \WP_REST_Controller {
|
||||||
'meta_value',
|
'meta_value',
|
||||||
'meta_value_num',
|
'meta_value_num',
|
||||||
'menu_order',
|
'menu_order',
|
||||||
'rand'
|
'rand',
|
||||||
|
'post__in'
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ export default function ({ attributes, setAttributes, className, isSelected, cli
|
||||||
|
|
||||||
collections = [];
|
collections = [];
|
||||||
|
|
||||||
let endpoint = '/collections?'+ qs.stringify({ postin: selectedCollections.map((collection) => { return collection.id }), perpage: selectedCollections.length, fetch_preview_image_items: showCollectionThumbnail ? 0 : 3 }) + '&fetch_only=name,url,thumbnail';
|
let endpoint = '/collections?'+ qs.stringify({ postin: selectedCollections.map((collection) => { return collection.id }), perpage: selectedCollections.length, fetch_preview_image_items: showCollectionThumbnail ? 0 : 3 }) + '&orderby=post__in&fetch_only=name,url,thumbnail';
|
||||||
tainacan.get(endpoint, { cancelToken: itemsRequestSource.token })
|
tainacan.get(endpoint, { cancelToken: itemsRequestSource.token })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ export default {
|
||||||
|
|
||||||
this.collectionsRequestSource = axios.CancelToken.source();
|
this.collectionsRequestSource = axios.CancelToken.source();
|
||||||
|
|
||||||
let endpoint = '/collections?'+ qs.stringify({ postin: this.selectedCollections, perpage: this.selectedCollections.length, fetch_preview_image_items: this.showCollectionThumbnail ? 0 : 3 }) + '&fetch_only=name,url,thumbnail';
|
let endpoint = '/collections?'+ qs.stringify({ postin: this.selectedCollections, perpage: this.selectedCollections.length, fetch_preview_image_items: this.showCollectionThumbnail ? 0 : 3 }) + '&orderby=post__in&fetch_only=name,url,thumbnail';
|
||||||
|
|
||||||
this.tainacanAxios.get(endpoint, { cancelToken: this.collectionsRequestSource.token })
|
this.tainacanAxios.get(endpoint, { cancelToken: this.collectionsRequestSource.token })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
|
@ -150,7 +150,7 @@ export default function({ attributes, setAttributes, className, isSelected, clie
|
||||||
|
|
||||||
itemsRequestSource = axios.CancelToken.source();
|
itemsRequestSource = axios.CancelToken.source();
|
||||||
|
|
||||||
let endpoint = '/collection/' + collectionId + '/items?'+ qs.stringify({ postin: selectedItems, perpage: selectedItems.length }) + '&fetch_only=title,url,thumbnail';
|
let endpoint = '/collection/' + collectionId + '/items?'+ qs.stringify({ postin: selectedItems, perpage: selectedItems.length }) + '&orderby=post__in&fetch_only=title,url,thumbnail';
|
||||||
|
|
||||||
tainacan.get(endpoint, { cancelToken: itemsRequestSource.token })
|
tainacan.get(endpoint, { cancelToken: itemsRequestSource.token })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
|
@ -246,7 +246,7 @@ export default {
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if (this.loadStrategy == 'selection') {
|
} else if (this.loadStrategy == 'selection') {
|
||||||
let endpoint = '/collection/' + this.collectionId + '/items?' + qs.stringify({ postin: this.selectedItems, perpage: this.selectedItems.length }) + '&fetch_only=title,url,thumbnail';
|
let endpoint = '/collection/' + this.collectionId + '/items?' + qs.stringify({ postin: this.selectedItems, perpage: this.selectedItems.length }) + '&orderby=post__in&fetch_only=title,url,thumbnail';
|
||||||
|
|
||||||
this.tainacanAxios.get(endpoint, { cancelToken: this.itemsRequestSource.token })
|
this.tainacanAxios.get(endpoint, { cancelToken: this.itemsRequestSource.token })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
|
@ -233,7 +233,7 @@ export default function({ attributes, setAttributes, className, isSelected, clie
|
||||||
|
|
||||||
itemsRequestSource = axios.CancelToken.source();
|
itemsRequestSource = axios.CancelToken.source();
|
||||||
|
|
||||||
let endpoint = '/collection/' + collectionId + '/items?'+ qs.stringify({ postin: selectedItems, perpage: selectedItems.length }) + '&fetch_only=title,url,thumbnail';
|
let endpoint = '/collection/' + collectionId + '/items?'+ qs.stringify({ postin: selectedItems, perpage: selectedItems.length }) + '&orderby=post__in&fetch_only=title,url,thumbnail';
|
||||||
|
|
||||||
tainacan.get(endpoint, { cancelToken: itemsRequestSource.token })
|
tainacan.get(endpoint, { cancelToken: itemsRequestSource.token })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
|
@ -373,7 +373,7 @@ export default {
|
||||||
|
|
||||||
this.localMaxItemsNumber = this.selectedItems.length;
|
this.localMaxItemsNumber = this.selectedItems.length;
|
||||||
|
|
||||||
let endpoint = '/collection/' + this.collectionId + '/items?' + qs.stringify({ postin: this.selectedItems, perpage: this.localMaxItemsNumber }) + '&fetch_only=title,url,thumbnail';
|
let endpoint = '/collection/' + this.collectionId + '/items?' + qs.stringify({ postin: this.selectedItems, perpage: this.localMaxItemsNumber }) + '&orderby=post__in&fetch_only=title,url,thumbnail';
|
||||||
|
|
||||||
this.tainacanAxios.get(endpoint, { cancelToken: this.itemsRequestSource.token })
|
this.tainacanAxios.get(endpoint, { cancelToken: this.itemsRequestSource.token })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
|
@ -86,7 +86,7 @@ export default class ItemsModal extends React.Component {
|
||||||
|
|
||||||
let anItemsRequestSource = axios.CancelToken.source();
|
let anItemsRequestSource = axios.CancelToken.source();
|
||||||
|
|
||||||
let endpoint = '/collection/' + this.state.collectionId + '/items?'+ qs.stringify({ postin: selectedItems, perpage: selectedItems.length }) + '&fetch_only=title,url,thumbnail';
|
let endpoint = '/collection/' + this.state.collectionId + '/items?'+ qs.stringify({ postin: selectedItems, perpage: selectedItems.length }) + '&orderby=post__in&fetch_only=title,url,thumbnail';
|
||||||
|
|
||||||
tainacan.get(endpoint, { cancelToken: anItemsRequestSource.token })
|
tainacan.get(endpoint, { cancelToken: anItemsRequestSource.token })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
Loading…
Reference in New Issue