send filters params in taxonomy components (ref. #94)

This commit is contained in:
eduardohumberto 2018-08-22 21:29:53 -03:00 committed by Mateus Machado Luna
parent a798caca91
commit f8bcce4589
4 changed files with 16 additions and 4 deletions

View File

@ -83,6 +83,10 @@ class REST_Facets_Controller extends REST_Controller {
$options = $metadatum->get_metadata_type_options(); $options = $metadatum->get_metadata_type_options();
$args = $this->prepare_filters($request); $args = $this->prepare_filters($request);
if(isset($request['filter_items'])){
//TODO: HANDLE FILTERS
}
if( $metadatum_type === 'Tainacan\Metadata_Types\Relationship' ){ if( $metadatum_type === 'Tainacan\Metadata_Types\Relationship' ){
$restItemsClass = new REST_Items_Controller(); $restItemsClass = new REST_Items_Controller();

View File

@ -20,6 +20,7 @@
</template> </template>
<script> <script>
import qs from 'qs';
import { tainacan as axios } from '../../../js/axios/axios'; import { tainacan as axios } from '../../../js/axios/axios';
import CheckboxFilterModal from '../../../admin/components/other/checkbox-filter-modal.vue'; import CheckboxFilterModal from '../../../admin/components/other/checkbox-filter-modal.vue';
@ -100,8 +101,10 @@
methods: { methods: {
loadOptions(){ loadOptions(){
this.isLoading = true; this.isLoading = true;
let query_items = { 'filter_items': this.query };
axios.get('/collection/'+ this.collection +'/facets/' + this.metadatum + `?hideempty=0&order=asc&parent=0&number=${this.filter.max_options}`) axios.get('/collection/'+ this.collection +'/facets/' + this.metadatum
+ `?hideempty=0&order=asc&parent=0&number=${this.filter.max_options}&` + qs.stringify(query_items))
.then( res => { .then( res => {
for (let item of res.data) { for (let item of res.data) {

View File

@ -19,6 +19,7 @@
</template> </template>
<script> <script>
import qs from 'qs';
import { tainacan as axios } from "../../../js/axios/axios"; import { tainacan as axios } from "../../../js/axios/axios";
export default { export default {
@ -65,8 +66,9 @@ export default {
methods: { methods: {
loadOptions() { loadOptions() {
this.isLoading = true; this.isLoading = true;
let query_items = { 'filter_items': this.query };
axios.get('/collection/'+ this.collection +'/facets/' + this.metadatum + `?hideempty=0&order=asc`) axios.get('/collection/'+ this.collection +'/facets/' + this.metadatum + `?hideempty=0&order=asc&` + qs.stringify(query_items))
.then( res => { .then( res => {
for (let item of res.data) { for (let item of res.data) {

View File

@ -17,7 +17,8 @@
</template> </template>
<script> <script>
import { tainacan as axios } from '../../../js/axios/axios' import qs from 'qs';
import { tainacan as axios } from '../../../js/axios/axios';
export default { export default {
created(){ created(){
@ -127,9 +128,11 @@
this.isLoading = true; this.isLoading = true;
this.options = []; this.options = [];
let query_items = { 'filter_items': this.query };
let endpoint = this.isRepositoryLevel ? '/facets/' + this.metadatum : '/collection/'+ this.collection +'/facets/' + this.metadatum; let endpoint = this.isRepositoryLevel ? '/facets/' + this.metadatum : '/collection/'+ this.collection +'/facets/' + this.metadatum;
endpoint += '?hideempty=0&order=asc'; endpoint += '?hideempty=0&order=asc&' + qs.stringify(query_items);
let valuesToIgnore = []; let valuesToIgnore = [];
for(let val of this.selected){ for(let val of this.selected){
valuesToIgnore.push( val.value ); valuesToIgnore.push( val.value );