Solves line-break issue on table due to latest changes in value_as_html. Unregisters several events with , this may improve memory usage.
This commit is contained in:
parent
fe9fd045cb
commit
f2b73f4eb1
|
@ -1073,13 +1073,6 @@ export default {
|
|||
// Sets feedback variables
|
||||
eventBus.$on('isUpdatingValue', (status) => {
|
||||
this.isUpdatingValues = status;
|
||||
// if (this.isUpdatingValues) {
|
||||
// this.$toast.open({
|
||||
// duration: 2000,
|
||||
// message: this.$i18n.get('info_updating_metadata_values'),
|
||||
// position: 'is-bottom',
|
||||
// })
|
||||
// }
|
||||
});
|
||||
eventBus.$on('hasErrorsOnForm', (hasErrors) => {
|
||||
if (hasErrors)
|
||||
|
@ -1089,6 +1082,10 @@ export default {
|
|||
});
|
||||
this.cleanLastUpdated();
|
||||
},
|
||||
beforeDestroy () {
|
||||
eventBus.$off('isUpdatingValue');
|
||||
eventBus.$off('hasErrorsOnForm');
|
||||
},
|
||||
beforeRouteLeave ( to, from, next ) {
|
||||
if (this.item.status == 'auto-draft') {
|
||||
this.$modal.open({
|
||||
|
|
|
@ -101,20 +101,28 @@ export default {
|
|||
},
|
||||
}
|
||||
});
|
||||
},
|
||||
eventOnEditTerm() {
|
||||
this.isEditingTerm = true;
|
||||
},
|
||||
eventOnTermEditionSaved() {
|
||||
this.isEditingTerm = false;
|
||||
this.term.opened = false;
|
||||
},
|
||||
eventOnTermEditionCanceled() {
|
||||
this.isEditingTerm = false;
|
||||
this.term.opened = false;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$termsListBus.$on('editTerm', () => {
|
||||
this.isEditingTerm = true;
|
||||
});
|
||||
this.$termsListBus.$on('termEditionSaved', () => {
|
||||
this.isEditingTerm = false;
|
||||
this.term.opened = false;
|
||||
});
|
||||
this.$termsListBus.$on('termEditionCanceled', () => {
|
||||
this.isEditingTerm = false;
|
||||
this.term.opened = false;
|
||||
});
|
||||
this.$termsListBus.$on('editTerm', this.eventOnEditTerm);
|
||||
this.$termsListBus.$on('termEditionSaved', this.eventOnTermEditionSaved);
|
||||
this.$termsListBus.$on('termEditionCanceled', this.eventOnTermEditionCanceled);
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$termsListBus.$off('editTerm', this.eventOnEditTerm);
|
||||
this.$termsListBus.$off('termEditionSaved', this.eventOnTermEditionSaved);
|
||||
this.$termsListBus.$off('termEditionCanceled', this.eventOnTermEditionCanceled);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -589,7 +589,7 @@
|
|||
column.metadatum !== 'row_actions' &&
|
||||
column.metadatum !== 'row_creation' &&
|
||||
column.metadatum !== 'row_author'"
|
||||
v-html="renderMetadata(item.metadata, column) != '' ? renderMetadata(item.metadata, column) : `<span class='has-text-gray is-italic'>` + $i18n.get('label_value_not_informed') + `</span>`"/>
|
||||
v-html="renderMetadata(item.metadata, column) != '' ? renderMetadata(item.metadata, column, column.metadata_type_object.component) : `<span class='has-text-gray is-italic'>` + $i18n.get('label_value_not_informed') + `</span>`"/>
|
||||
|
||||
<span v-if="column.metadatum == 'row_thumbnail'">
|
||||
<img
|
||||
|
@ -900,7 +900,7 @@ export default {
|
|||
goToItemEditPage(item) {
|
||||
this.$router.push(this.$routerHelper.getItemEditPath(item.collection_id, item.id));
|
||||
},
|
||||
renderMetadata(itemMetadata, column) {
|
||||
renderMetadata(itemMetadata, column, component) {
|
||||
|
||||
let metadata = (itemMetadata != undefined && itemMetadata[column.slug] != undefined) ? itemMetadata[column.slug] : false;
|
||||
|
||||
|
@ -909,7 +909,10 @@ export default {
|
|||
} else if (metadata.date_i18n) {
|
||||
return metadata.date_i18n;
|
||||
} else {
|
||||
return metadata.value_as_html;
|
||||
if (component != undefined && component == 'tainacan-textarea')
|
||||
return metadata.value_as_string;
|
||||
else
|
||||
return metadata.value_as_html;
|
||||
}
|
||||
},
|
||||
getLimitedDescription(description) {
|
||||
|
|
|
@ -231,24 +231,34 @@ export default {
|
|||
},
|
||||
}
|
||||
});
|
||||
},
|
||||
eventOnChildTermDeleted(parentTermId) {
|
||||
if (this.term.id == parentTermId && this.totalTerms > 0)
|
||||
this.totalTerms--;
|
||||
},
|
||||
eventOnEditTerm() {
|
||||
this.isEditingTerm = true;
|
||||
},
|
||||
eventOnTermEditionSaved() {
|
||||
this.isEditingTerm = false;
|
||||
this.term.opened = false;
|
||||
},
|
||||
eventOnTermEditionCanceled() {
|
||||
this.isEditingTerm = false;
|
||||
this.term.opened = false;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$root.$on('onChildTermDeleted', (parentTermId) => {
|
||||
if (this.term.id == parentTermId && this.totalTerms > 0)
|
||||
this.totalTerms--;
|
||||
});
|
||||
this.$termsListBus.$on('editTerm', () => {
|
||||
this.isEditingTerm = true;
|
||||
});
|
||||
this.$termsListBus.$on('termEditionSaved', () => {
|
||||
this.isEditingTerm = false;
|
||||
this.term.opened = false;
|
||||
});
|
||||
this.$termsListBus.$on('termEditionCanceled', () => {
|
||||
this.isEditingTerm = false;
|
||||
this.term.opened = false;
|
||||
});
|
||||
this.$root.$on('onChildTermDeleted', this.eventOnChildTermDeleted);
|
||||
this.$termsListBus.$on('editTerm', this.eventOnEditTerm);
|
||||
this.$termsListBus.$on('termEditionSaved', this.eventOnTermEditionSaved);
|
||||
this.$termsListBus.$on('termEditionCanceled', this.eventOnTermEditionCanceled);
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$root.$off('onChildTermDeleted', this.eventOnChildTermDeleted);
|
||||
this.$termsListBus.$off('editTerm', this.eventOnEditTerm);
|
||||
this.$termsListBus.$off('termEditionSaved', this.eventOnTermEditionSaved);
|
||||
this.$termsListBus.$off('termEditionCanceled', this.eventOnTermEditionCanceled);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -352,18 +352,12 @@ export default {
|
|||
.catch((error) => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.taxonomyId !== String) {
|
||||
this.loadTerms(0);
|
||||
}
|
||||
this.$root.$on('onChildTermDeleted', (parentTermId) => {
|
||||
},
|
||||
eventOnChildTermDeleted(parentTermId) {
|
||||
if ((parentTermId == 0 || parentTermId == undefined ) && this.totalTerms > 0)
|
||||
this.totalTerms--;
|
||||
});
|
||||
this.$termsListBus.$on('editTerm', (term) => {
|
||||
|
||||
},
|
||||
eventOnEditTerm(term) {
|
||||
// Position edit form in a visible area
|
||||
let container = document.getElementById('repository-container');
|
||||
if (container && container.scrollTop && container.scrollTop > 80)
|
||||
|
@ -373,24 +367,37 @@ export default {
|
|||
|
||||
this.editTerm = term;
|
||||
this.isEditingTerm = true;
|
||||
});
|
||||
this.$termsListBus.$on('termEditionSaved', ({hasChangedParent}) => {
|
||||
},
|
||||
eventOnTermEditionSaved({hasChangedParent}) {
|
||||
this.isEditingTerm = false;
|
||||
this.editTerm = null;
|
||||
|
||||
if (hasChangedParent)
|
||||
this.loadTerms(0);
|
||||
});
|
||||
this.$termsListBus.$on('termEditionCanceled', () => {
|
||||
},
|
||||
eventOnTermEditionCanceled() {
|
||||
this.isEditingTerm = false;
|
||||
this.editTerm = null;
|
||||
});
|
||||
this.$termsListBus.$on('addNewChildTerm', (parentId) => {
|
||||
this.addNewTerm(parentId);
|
||||
});
|
||||
this.$termsListBus.$on('deleteBasicTermItem', (term) => {
|
||||
this.deleteBasicTerm(term);
|
||||
});
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.taxonomyId !== String) {
|
||||
this.loadTerms(0);
|
||||
}
|
||||
this.$root.$on('onChildTermDeleted', this.eventOnChildTermDeleted);
|
||||
this.$termsListBus.$on('editTerm', this.eventOnEditTerm);
|
||||
this.$termsListBus.$on('termEditionSaved', this.eventOnTermEditionSaved);
|
||||
this.$termsListBus.$on('termEditionCanceled', this.eventOnTermEditionCanceled);
|
||||
this.$termsListBus.$on('addNewChildTerm', this.addNewTerm);
|
||||
this.$termsListBus.$on('deleteBasicTermItem', this.deleteBasicTerm);
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$root.$off('onChildTermDeleted', this.eventOnChildTermDeleted);
|
||||
this.$termsListBus.$off('editTerm', this.eventOnEditTerm);
|
||||
this.$termsListBus.$off('termEditionSaved', this.eventOnTermEditionSaved);
|
||||
this.$termsListBus.$off('termEditionCanceled', this.eventOnTermEditionCanceled);
|
||||
this.$termsListBus.$off('addNewChildTerm', this.addNewTerm);
|
||||
this.$termsListBus.$off('deleteBasicTermItem', this.deleteBasicTerm);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -205,6 +205,9 @@ export default {
|
|||
}, 20000);
|
||||
|
||||
this.showProcessesList = false;
|
||||
},
|
||||
beforeDestroy() {
|
||||
clearInterval(this.intervalID);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1140,6 +1140,19 @@
|
|||
this.searchControlHeight = this.$refs['search-control'] ? this.$refs['search-control'].clientHeight + this.$refs['search-control'].offsetTop : 0;
|
||||
this.isFiltersMenuCompressed = jQuery(window).width() <= 768;
|
||||
});
|
||||
},
|
||||
removeEventListeners() {
|
||||
// Component
|
||||
this.$off();
|
||||
// Window
|
||||
window.removeEventListener('resize', this.adjustSearchControlHeight);
|
||||
// $root
|
||||
this.$root.$off('openAdvancedSearch');
|
||||
// $eventBusSearch
|
||||
this.$eventBusSearch.$off('isLoadingItems');
|
||||
this.$eventBusSearch.$off('hasFiltered');
|
||||
this.$eventBusSearch.$off('advancedSearchResults');
|
||||
this.$eventBusSearch.$off('hasToPrepareMetadataAndFilters');
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -1153,6 +1166,7 @@
|
|||
|
||||
this.$eventBusSearch.$on('isLoadingItems', isLoadingItems => {
|
||||
this.isLoadingItems = isLoadingItems;
|
||||
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('hasFiltered', hasFiltered => {
|
||||
|
@ -1233,9 +1247,7 @@
|
|||
window.addEventListener('resize', this.adjustSearchControlHeight);
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$off();
|
||||
window.removeEventListener('resize', this.adjustSearchControlHeight);
|
||||
this.$root.$off('openAdvancedSearch');
|
||||
this.removeEventListeners();
|
||||
|
||||
// Cancels previous Request
|
||||
if (this.$eventBusSearch.searchCancel != undefined)
|
||||
|
|
|
@ -1118,6 +1118,19 @@
|
|||
});
|
||||
}
|
||||
},
|
||||
removeEventListeners() {
|
||||
// Component
|
||||
this.$off();
|
||||
// Window
|
||||
window.removeEventListener('resize', this.adjustSearchControlHeight);
|
||||
// $root
|
||||
this.$root.$off('openAdvancedSearch');
|
||||
// $eventBusSearch
|
||||
this.$eventBusSearch.$off('isLoadingItems');
|
||||
this.$eventBusSearch.$off('hasFiltered');
|
||||
this.$eventBusSearch.$off('advancedSearchResults');
|
||||
this.$eventBusSearch.$off('hasToPrepareMetadataAndFilters');
|
||||
},
|
||||
created() {
|
||||
|
||||
this.isOnTheme = (this.$route.name === null);
|
||||
|
@ -1210,8 +1223,11 @@
|
|||
window.addEventListener('resize', this.adjustSearchControlHeight);
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$off();
|
||||
window.removeEventListener('resize', this.adjustSearchControlHeight);
|
||||
this.removeEventListeners();
|
||||
|
||||
// Cancels previous Request
|
||||
if (this.$eventBusSearch.searchCancel != undefined)
|
||||
this.$eventBusSearch.searchCancel.cancel('Item search Canceled.');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -155,8 +155,9 @@
|
|||
font-size: 0.875rem;
|
||||
margin: 0px;
|
||||
text-overflow: ellipsis;
|
||||
overflow-x: hidden;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
// max-height: 1rem;
|
||||
}
|
||||
}
|
||||
img.table-thumb {
|
||||
|
|
|
@ -59,10 +59,7 @@
|
|||
this.$console.log(error);
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', (filterTag) => {
|
||||
if (filterTag.filterId == this.filter.id)
|
||||
this.cleanSearch();
|
||||
})
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
|
@ -161,6 +158,10 @@
|
|||
return false;
|
||||
}
|
||||
},
|
||||
cleanSearchFromTags(filterTag) {
|
||||
if (filterTag.filterId == this.filter.id)
|
||||
this.cleanSearch();
|
||||
},
|
||||
cleanSearch(){
|
||||
this.results = '';
|
||||
this.label = '';
|
||||
|
@ -172,6 +173,9 @@
|
|||
value: ''
|
||||
});
|
||||
},
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -55,38 +55,7 @@
|
|||
this.$console.log(error);
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', (filterTag) => {
|
||||
if (filterTag.filterId == this.filter.id) {
|
||||
|
||||
let selectedIndex = this.selected.findIndex(option => option == filterTag.singleValue);
|
||||
let optionIndex = this.options.findIndex(option => option.label == filterTag.singleValue);
|
||||
let alternativeIndex;
|
||||
|
||||
if (optionIndex >= 0) {
|
||||
alternativeIndex = this.selected.findIndex(option => this.options[optionIndex].value == option);
|
||||
}
|
||||
|
||||
if (selectedIndex >= 0 || alternativeIndex >= 0) {
|
||||
|
||||
selectedIndex >= 0 ? this.selected.splice(selectedIndex, 1) : this.selected.splice(alternativeIndex, 1);
|
||||
|
||||
this.$emit('input', {
|
||||
filter: 'checkbox',
|
||||
compare: 'IN',
|
||||
metadatum_id: this.metadatum,
|
||||
collection_id: ( this.collection_id ) ? this.collection_id : this.filter.collection_id,
|
||||
value: this.selected
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$emit( 'sendValuesToTags', {
|
||||
filterId: this.filter.id,
|
||||
value: this.selected
|
||||
});
|
||||
|
||||
this.selectedValues();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
},
|
||||
props: {
|
||||
isRepositoryLevel: Boolean,
|
||||
|
@ -213,7 +182,42 @@
|
|||
appliedCheckBoxModal: () => this.loadOptions()
|
||||
}
|
||||
});
|
||||
},
|
||||
cleanSearchFromTags(filterTag) {
|
||||
if (filterTag.filterId == this.filter.id) {
|
||||
|
||||
let selectedIndex = this.selected.findIndex(option => option == filterTag.singleValue);
|
||||
let optionIndex = this.options.findIndex(option => option.label == filterTag.singleValue);
|
||||
let alternativeIndex;
|
||||
|
||||
if (optionIndex >= 0) {
|
||||
alternativeIndex = this.selected.findIndex(option => this.options[optionIndex].value == option);
|
||||
}
|
||||
|
||||
if (selectedIndex >= 0 || alternativeIndex >= 0) {
|
||||
|
||||
selectedIndex >= 0 ? this.selected.splice(selectedIndex, 1) : this.selected.splice(alternativeIndex, 1);
|
||||
|
||||
this.$emit('input', {
|
||||
filter: 'checkbox',
|
||||
compare: 'IN',
|
||||
metadatum_id: this.metadatum,
|
||||
collection_id: ( this.collection_id ) ? this.collection_id : this.filter.collection_id,
|
||||
value: this.selected
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$emit( 'sendValuesToTags', {
|
||||
filterId: this.filter.id,
|
||||
value: this.selected
|
||||
});
|
||||
|
||||
this.selectedValues();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -69,10 +69,7 @@
|
|||
this.$console.log(error);
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', (filterTag) => {
|
||||
if (filterTag.filterId == this.filter.id)
|
||||
this.clearSearch();
|
||||
});
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
|
@ -193,6 +190,10 @@
|
|||
// return this.value_init + ' - ' +this.value_end;
|
||||
// }
|
||||
},
|
||||
cleanSearchFromTags(filterTag) {
|
||||
if (filterTag.filterId == this.filter.id)
|
||||
this.cleanSearch();
|
||||
},
|
||||
clearSearch(){
|
||||
|
||||
this.clear = true;
|
||||
|
@ -281,6 +282,9 @@
|
|||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -46,10 +46,7 @@
|
|||
this.$console.error(error);
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', (filterTag) => {
|
||||
if (filterTag.filterId == this.filter.id)
|
||||
this.onSelect();
|
||||
});
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
},
|
||||
props: {
|
||||
isRepositoryLevel: Boolean,
|
||||
|
@ -120,7 +117,14 @@
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
cleanSearchFromTags(filterTag) {
|
||||
if (filterTag.filterId == this.filter.id)
|
||||
this.onSelect();
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -60,37 +60,7 @@
|
|||
this.$console.log(error);
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', (filterTag) => {
|
||||
|
||||
if (filterTag.filterId == this.filter.id) {
|
||||
|
||||
let selectedIndex = this.selected.findIndex(option => option.label == filterTag.singleValue);
|
||||
if (selectedIndex >= 0) {
|
||||
|
||||
this.selected.splice(selectedIndex, 1);
|
||||
|
||||
let values = [];
|
||||
let labels = [];
|
||||
for(let val of this.selected){
|
||||
values.push( val.value );
|
||||
labels.push( val.label );
|
||||
}
|
||||
|
||||
this.$emit('input', {
|
||||
filter: 'taginput',
|
||||
compare: 'IN',
|
||||
metadatum_id: this.metadatum,
|
||||
collection_id: ( this.collection_id ) ? this.collection_id : this.filter.collection_id,
|
||||
value: values
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$emit( 'sendValuesToTags', {
|
||||
filterId: this.filter.id,
|
||||
value: labels
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
|
@ -188,7 +158,41 @@
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
cleanSearchFromTags(filterTag) {
|
||||
|
||||
if (filterTag.filterId == this.filter.id) {
|
||||
|
||||
let selectedIndex = this.selected.findIndex(option => option.label == filterTag.singleValue);
|
||||
if (selectedIndex >= 0) {
|
||||
|
||||
this.selected.splice(selectedIndex, 1);
|
||||
|
||||
let values = [];
|
||||
let labels = [];
|
||||
for(let val of this.selected){
|
||||
values.push( val.value );
|
||||
labels.push( val.label );
|
||||
}
|
||||
|
||||
this.$emit('input', {
|
||||
filter: 'taginput',
|
||||
compare: 'IN',
|
||||
metadatum_id: this.metadatum,
|
||||
collection_id: ( this.collection_id ) ? this.collection_id : this.filter.collection_id,
|
||||
value: values
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$emit( 'sendValuesToTags', {
|
||||
filterId: this.filter.id,
|
||||
value: labels
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -37,37 +37,7 @@
|
|||
this.type = ( this.filter_type ) ? this.filter_type : this.filter.metadatum.metadata_type;
|
||||
this.loadOptions();
|
||||
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', (filterTag) => {
|
||||
if (filterTag.filterId == this.filter.id) {
|
||||
|
||||
let selectedOption = this.options.find(option => option.label == filterTag.singleValue);
|
||||
|
||||
if(selectedOption) {
|
||||
|
||||
let selectedIndex = this.selected.findIndex(option => option == selectedOption.value);
|
||||
if (selectedIndex >= 0) {
|
||||
|
||||
this.selected.splice(selectedIndex, 1);
|
||||
|
||||
this.$emit('input', {
|
||||
filter: 'checkbox',
|
||||
compare: 'IN',
|
||||
taxonomy: this.taxonomy,
|
||||
metadatum_id: this.metadatum,
|
||||
collection_id: ( this.collection_id ) ? this.collection_id : this.filter.collection_id,
|
||||
terms: this.selected
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$emit( 'sendValuesToTags', {
|
||||
filterId: this.filter.id,
|
||||
value: this.selected
|
||||
});
|
||||
|
||||
this.selectedValues();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTag);
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
|
@ -237,7 +207,41 @@
|
|||
},
|
||||
width: 'calc(100% - 8.333333333%)',
|
||||
});
|
||||
},
|
||||
cleanSearchFromTag(filterTag) {
|
||||
if (filterTag.filterId == this.filter.id) {
|
||||
|
||||
let selectedOption = this.options.find(option => option.label == filterTag.singleValue);
|
||||
|
||||
if(selectedOption) {
|
||||
|
||||
let selectedIndex = this.selected.findIndex(option => option == selectedOption.value);
|
||||
if (selectedIndex >= 0) {
|
||||
|
||||
this.selected.splice(selectedIndex, 1);
|
||||
|
||||
this.$emit('input', {
|
||||
filter: 'checkbox',
|
||||
compare: 'IN',
|
||||
taxonomy: this.taxonomy,
|
||||
metadatum_id: this.metadatum,
|
||||
collection_id: ( this.collection_id ) ? this.collection_id : this.filter.collection_id,
|
||||
terms: this.selected
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$emit( 'sendValuesToTags', {
|
||||
filterId: this.filter.id,
|
||||
value: this.selected
|
||||
});
|
||||
|
||||
this.selectedValues();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -38,38 +38,7 @@
|
|||
this.selectedValues( metadatum.metadata_type_options.taxonomy_id );
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', (filterTag) => {
|
||||
|
||||
if (filterTag.filterId == this.filter.id) {
|
||||
|
||||
let selectedIndex = this.selected.findIndex(option => option.label == filterTag.singleValue);
|
||||
if (selectedIndex >= 0) {
|
||||
|
||||
this.selected.splice(selectedIndex, 1);
|
||||
|
||||
let values = [];
|
||||
let labels = [];
|
||||
for(let val of this.selected){
|
||||
values.push( val.value );
|
||||
labels.push( val.label );
|
||||
}
|
||||
|
||||
this.$emit('input', {
|
||||
filter: 'taginput',
|
||||
compare: 'IN',
|
||||
taxonomy: this.taxonomy,
|
||||
metadatum_id: ( this.metadatum_id ) ? this.metadatum_id : this.filter.metadatum,
|
||||
collection_id: ( this.collection_id ) ? this.collection_id : this.filter.collection_id,
|
||||
terms: values
|
||||
});
|
||||
this.$eventBusSearch.$emit( 'sendValuesToTags', {
|
||||
filterId: this.filter.id,
|
||||
value: labels
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTag);
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
|
@ -185,7 +154,42 @@
|
|||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
},
|
||||
cleanSearchFromTag(filterTag) {
|
||||
|
||||
if (filterTag.filterId == this.filter.id) {
|
||||
|
||||
let selectedIndex = this.selected.findIndex(option => option.label == filterTag.singleValue);
|
||||
if (selectedIndex >= 0) {
|
||||
|
||||
this.selected.splice(selectedIndex, 1);
|
||||
|
||||
let values = [];
|
||||
let labels = [];
|
||||
for(let val of this.selected){
|
||||
values.push( val.value );
|
||||
labels.push( val.label );
|
||||
}
|
||||
|
||||
this.$emit('input', {
|
||||
filter: 'taginput',
|
||||
compare: 'IN',
|
||||
taxonomy: this.taxonomy,
|
||||
metadatum_id: ( this.metadatum_id ) ? this.metadatum_id : this.filter.metadatum,
|
||||
collection_id: ( this.collection_id ) ? this.collection_id : this.filter.collection_id,
|
||||
terms: values
|
||||
});
|
||||
this.$eventBusSearch.$emit( 'sendValuesToTags', {
|
||||
filterId: this.filter.id,
|
||||
value: labels
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -11,7 +11,7 @@ export const eventBus = new Vue({
|
|||
if( tainacan_plugin.components ){
|
||||
this.componentsTag = tainacan_plugin.components;
|
||||
}
|
||||
this.$on('input', data => this.updateValue(data) );
|
||||
this.$on('input', this.updateValue );
|
||||
},
|
||||
watch: {
|
||||
errors() {
|
||||
|
@ -128,6 +128,9 @@ export const eventBus = new Vue({
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeUpdate() {
|
||||
this.$off('input', this.updateValue );
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
column.metadatum !== 'row_actions' &&
|
||||
column.metadatum !== 'row_creation' &&
|
||||
column.metadatum !== 'row_author'"
|
||||
v-html="renderMetadata(item.metadata, column) != '' ? renderMetadata(item.metadata, column) : `<span class='has-text-gray is-italic'>` + $i18n.get('label_value_not_informed') + `</span>`"/>
|
||||
v-html="renderMetadata(item.metadata, column) != '' ? renderMetadata(item.metadata, column, column.metadata_type_object.component) : `<span class='has-text-gray is-italic'>` + $i18n.get('label_value_not_informed') + `</span>`"/>
|
||||
|
||||
<span v-if="column.metadatum == 'row_thumbnail'">
|
||||
<img
|
||||
|
@ -132,7 +132,7 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
renderMetadata(itemMetadata, column) {
|
||||
renderMetadata(itemMetadata, column, component) {
|
||||
|
||||
let metadata = (itemMetadata != undefined && itemMetadata[column.slug] != undefined) ? itemMetadata[column.slug] : false;
|
||||
|
||||
|
@ -141,7 +141,10 @@ export default {
|
|||
} else if (metadata.date_i18n) {
|
||||
return metadata.date_i18n;
|
||||
} else {
|
||||
return metadata.value_as_html;
|
||||
if (component != undefined && component == 'tainacan-textarea')
|
||||
return metadata.value_as_string;
|
||||
else
|
||||
return metadata.value_as_html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue