Moves removeSearchTag function from filters and move to mixin.
This commit is contained in:
parent
d5851b71b8
commit
2e42fb5186
|
@ -278,11 +278,11 @@
|
|||
<script>
|
||||
import qs from 'qs';
|
||||
import { tainacan as axios, isCancel } from '../../../js/axios/axios';
|
||||
import { filter_type_mixin } from '../../../classes/filter-types/filter-types-mixin';
|
||||
import { filterTypeMixin } from '../../../classes/filter-types/filter-types-mixin';
|
||||
|
||||
export default {
|
||||
name: 'CheckboxFilterModal',
|
||||
mixins: [ filter_type_mixin ],
|
||||
mixins: [ filterTypeMixin ],
|
||||
props: {
|
||||
isFilter: {
|
||||
type: Boolean,
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
<script>
|
||||
import { tainacan as axios, isCancel } from '../../../js/axios/axios'
|
||||
import { filter_type_mixin } from '../filter-types-mixin'
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
// import qs from 'qs';
|
||||
|
||||
export default {
|
||||
|
@ -68,8 +68,6 @@
|
|||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
|
@ -87,7 +85,7 @@
|
|||
isRepositoryLevel: Boolean,
|
||||
labelId: String
|
||||
},
|
||||
mixins: [filter_type_mixin],
|
||||
mixins: [filterTypeMixin],
|
||||
methods: {
|
||||
setResults(option){
|
||||
if(!option)
|
||||
|
@ -186,9 +184,6 @@
|
|||
value: ''
|
||||
});
|
||||
},
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
<script>
|
||||
import { tainacan as axios, isCancel } from '../../../js/axios/axios';
|
||||
import { filter_type_mixin } from '../filter-types-mixin';
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
import CheckboxRadioModal from '../../../admin/components/other/checkbox-radio-modal.vue';
|
||||
|
||||
export default {
|
||||
|
@ -69,8 +69,6 @@
|
|||
this.$console.log(error);
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
|
||||
if (this.isUsingElasticSearch) {
|
||||
this.isLoadingOptions = false;
|
||||
this.$eventBusSearch.$on('isLoadingItems', this.updatesIsLoading);
|
||||
|
@ -89,7 +87,7 @@
|
|||
metadatum_object: {}
|
||||
}
|
||||
},
|
||||
mixins: [filter_type_mixin],
|
||||
mixins: [filterTypeMixin],
|
||||
watch: {
|
||||
selected: function(){
|
||||
//this.selected = val;
|
||||
|
@ -228,8 +226,7 @@
|
|||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
|
||||
|
||||
if (this.isUsingElasticSearch)
|
||||
this.$eventBusSearch.$off('isLoadingItems', this.updatesIsLoading);
|
||||
}
|
||||
|
|
|
@ -68,10 +68,15 @@
|
|||
<script>
|
||||
import { tainacan as axios } from '../../../js/axios/axios';
|
||||
import { wpAjax, dateInter } from "../../../admin/js/mixins";
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
import moment from 'moment';
|
||||
|
||||
export default {
|
||||
mixins: [ wpAjax, dateInter ],
|
||||
mixins: [
|
||||
wpAjax,
|
||||
dateInter,
|
||||
filterTypeMixin
|
||||
],
|
||||
created() {
|
||||
this.collection = this.filter.collection_id;
|
||||
this.metadatum = this.filter.metadatum.metadatum_id;
|
||||
|
@ -94,8 +99,6 @@
|
|||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
|
@ -301,9 +304,6 @@
|
|||
if (values[0] != undefined && values[1] != undefined)
|
||||
this.$emit( 'sendValuesToTags', this.parseDateToNavigatorLanguage(values[0]) + ' - ' + this.parseDateToNavigatorLanguage(values[1]));
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -112,10 +112,15 @@
|
|||
<script>
|
||||
import { tainacan as axios } from '../../../js/axios/axios';
|
||||
import { wpAjax, dateInter } from "../../../admin/js/mixins";
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
import moment from 'moment';
|
||||
|
||||
export default {
|
||||
mixins: [ wpAjax, dateInter ],
|
||||
mixins: [
|
||||
wpAjax,
|
||||
dateInter,
|
||||
filterTypeMixin
|
||||
],
|
||||
created() {
|
||||
this.collection = this.filter.collection_id;
|
||||
this.metadatum = (typeof this.filter.metadatum.metadatum_id == 'object' ? this.filter.metadatum.metadatum_id.metadatum_id : this.filter.metadatum.metadatum_id);
|
||||
|
@ -137,7 +142,6 @@
|
|||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
},
|
||||
mounted() {
|
||||
this.selectedValues();
|
||||
|
@ -265,9 +269,6 @@
|
|||
this.comparator = newComparator;
|
||||
this.emit();
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -2,7 +2,7 @@ import qs from 'qs';
|
|||
import axios from '../../js/axios/axios';
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export const filter_type_mixin = {
|
||||
export const filterTypeMixin = {
|
||||
data () {
|
||||
return {
|
||||
thumbPlaceholderPath: tainacan_plugin.base_url + '/admin/images/placeholder_square.png',
|
||||
|
@ -16,9 +16,12 @@ export const filter_type_mixin = {
|
|||
query: {}
|
||||
},
|
||||
created() {
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
|
||||
// We listen to event, but reload event if hasFiltered is negative, as
|
||||
// an empty query also demands filters reloading.
|
||||
this.$eventBusSearch.$on('hasFiltered', this.reloadOptionsDueToFiltering);
|
||||
if (this.options != undefined)
|
||||
this.$eventBusSearch.$on('hasFiltered', this.reloadOptionsDueToFiltering);
|
||||
},
|
||||
computed: {
|
||||
facetsFromItemSearch() {
|
||||
|
@ -318,6 +321,7 @@ export const filter_type_mixin = {
|
|||
if (this.getOptionsValuesCancel != undefined)
|
||||
this.getOptionsValuesCancel.cancel('Facet search Canceled.');
|
||||
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
this.$eventBusSearch.$off('hasFiltered', this.reloadOptionsDueToFiltering);
|
||||
},
|
||||
};
|
|
@ -19,14 +19,13 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
export default {
|
||||
mixins: [ filterTypeMixin ],
|
||||
created() {
|
||||
this.collectionId = this.filter.collection_id;
|
||||
this.metadatumId = this.filter.metadatum.metadatum_id;
|
||||
this.filterTypeOptions = this.filter.filter_type_options;
|
||||
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
|
@ -123,9 +122,6 @@
|
|||
},
|
||||
mounted() {
|
||||
this.selectedValues();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
export default {
|
||||
mixins: [ filterTypeMixin ],
|
||||
created() {
|
||||
this.collectionId = this.filter.collection_id;
|
||||
this.metadatumId = this.filter.metadatum.metadatum_id;
|
||||
this.filterTypeOptions = this.filter.filter_type_options;
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -118,9 +118,6 @@
|
|||
},
|
||||
mounted() {
|
||||
this.selectedValues();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -72,9 +72,13 @@
|
|||
<script>
|
||||
import { tainacan as axios } from '../../../js/axios/axios';
|
||||
import { wpAjax } from "../../../admin/js/mixins";
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
|
||||
export default {
|
||||
mixins: [ wpAjax ],
|
||||
mixins: [
|
||||
wpAjax,
|
||||
filterTypeMixin
|
||||
],
|
||||
created() {
|
||||
this.collection = this.filter.collection_id;
|
||||
this.metadatum = (typeof this.filter.metadatum.metadatum_id == 'object' ? this.filter.metadatum.metadatum_id.metadatum_id : this.filter.metadatum.metadatum_id);
|
||||
|
@ -96,7 +100,6 @@
|
|||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
},
|
||||
mounted() {
|
||||
this.selectedValues();
|
||||
|
@ -196,9 +199,6 @@
|
|||
this.comparator = newComparator;
|
||||
this.emit();
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
<script>
|
||||
import { tainacan as axios, isCancel } from '../../../js/axios/axios';
|
||||
import { filter_type_mixin } from '../filter-types-mixin'
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
|
||||
export default {
|
||||
created(){
|
||||
|
@ -54,8 +54,6 @@
|
|||
.catch(error => {
|
||||
this.$console.error(error);
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
|
||||
if (this.isUsingElasticSearch) {
|
||||
this.$eventBusSearch.$on('isLoadingItems', isLoading => {
|
||||
|
@ -75,7 +73,7 @@
|
|||
metadatum: ''
|
||||
}
|
||||
},
|
||||
mixins: [filter_type_mixin],
|
||||
mixins: [filterTypeMixin],
|
||||
watch: {
|
||||
selected(value) {
|
||||
if (value)
|
||||
|
@ -131,8 +129,6 @@
|
|||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
|
||||
if (this.isUsingElasticSearch)
|
||||
this.$eventBusSearch.$off('isLoadingItems');
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
<script>
|
||||
import { tainacan as axios, isCancel } from '../../../js/axios/axios';
|
||||
import { filter_type_mixin } from '../filter-types-mixin'
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
import qs from 'qs';
|
||||
|
||||
export default {
|
||||
|
@ -71,8 +71,6 @@
|
|||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
|
@ -89,7 +87,7 @@
|
|||
isRepositoryLevel: Boolean,
|
||||
labelId: String
|
||||
},
|
||||
mixins: [filter_type_mixin],
|
||||
mixins: [filterTypeMixin],
|
||||
watch: {
|
||||
selected( value ){
|
||||
this.selected = value;
|
||||
|
@ -206,9 +204,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -50,15 +50,16 @@
|
|||
import { tainacan as axios, CancelToken, isCancel } from '../../../js/axios/axios';
|
||||
import { mapGetters } from 'vuex';
|
||||
import CheckboxRadioModal from '../../../admin/components/other/checkbox-radio-modal.vue';
|
||||
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
|
||||
export default {
|
||||
mixins: [ filterTypeMixin ],
|
||||
created(){
|
||||
this.collection = this.filter.collection_id;
|
||||
this.metadatum = this.filter.metadatum.metadatum_id ;
|
||||
this.type = this.filter.metadatum.metadata_type;
|
||||
|
||||
this.loadOptions();
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
|
||||
if (this.isUsingElasticSearch)
|
||||
this.$eventBusSearch.$on('isLoadingItems', this.updatesIsLoading);
|
||||
|
@ -348,7 +349,6 @@
|
|||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
|
||||
// Cancels previous Request
|
||||
if (this.getOptionsValuesCancel != undefined)
|
||||
|
|
|
@ -38,8 +38,10 @@
|
|||
<script>
|
||||
import qs from 'qs';
|
||||
import { tainacan as axios } from '../../../js/axios/axios';
|
||||
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
|
||||
export default {
|
||||
mixins: [ filterTypeMixin ],
|
||||
created(){
|
||||
this.collection = this.filter.collection_id;
|
||||
this.metadatum = this.filter.metadatum.metadatum_id;
|
||||
|
@ -56,8 +58,6 @@
|
|||
let metadatum = res.data;
|
||||
this.selectedValues( metadatum.metadata_type_options.taxonomy_id );
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
|
@ -210,9 +210,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue