cartodb-4.42/lib/assets/javascripts/new-dashboard/components/MapCard/shared/methods.js
2024-04-06 05:25:13 +00:00

44 lines
1.0 KiB
JavaScript

export default {
toggleSelection ($event) {
this.$emit('toggleSelection', {
map: this.$props.visualization,
isSelected: !this.$props.isSelected,
event: $event
});
},
toggleFavorite () {
if (this.$props.visualization.liked) {
this.$store.dispatch(`${this.$props.storeActionType}/deleteLike`, this.$props.visualization);
} else {
this.$store.dispatch(`${this.$props.storeActionType}/like`, this.$props.visualization);
}
},
openQuickActions () {
this.areQuickActionsOpen = true;
},
closeQuickActions () {
this.areQuickActionsOpen = false;
},
mouseOverChildElement () {
this.activeHover = false;
},
mouseOutChildElement () {
this.activeHover = true;
},
onThumbnailError () {
this.isThumbnailErrored = true;
},
onDataChanged () {
this.$emit('dataChanged');
},
onClick (event) {
if (this.$props.selectMode) {
event.preventDefault();
this.toggleSelection(event);
}
},
isLastTag (index) {
return index === this.tagsLength - 1;
}
};