Regression fix: Highlight selected task "dot" in shots/assets table

Quick hack to restore functionality. Known limitations:
* A direct link to task will not highlight it
* When a new task is created it will not be highlighted
* Selected row will not be highlighted
This commit is contained in:
2019-02-13 13:03:17 +01:00
parent ac8a6284d4
commit fbe4e53e50
3 changed files with 31 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
/**
* Temporary (cross my fingers) hack to restore "active" item in table
*/
export const Events = {
DESELECT_ITEMS: 'deselect_items',
}
export const EventBus = new Vue();

View File

@@ -1,3 +1,4 @@
import {EventBus, Events} from '../../../EventBus'
let CellDefault = pillar.vuecomponents.table.cells.renderer.CellDefault;
const TEMPLATE =`
@@ -33,9 +34,22 @@ let CellTasks = Vue.component('attract-cell-tasks', {
return attract.auth.AttractAuth.canUserCreateTask(projectId);
}
},
data() {
return {
selected_task_id: null
}
},
created() {
EventBus.$on(Events.DESELECT_ITEMS, this.deselectTask);
},
beforeDestroy() {
EventBus.$off(Events.DESELECT_ITEMS, this.deselectTask);
},
methods: {
taskClass(task) {
return `task status-${task.properties.status}`
let classes = {'active': this.selected_task_id === task._id};
classes[`task status-${task.properties.status}`] = true;
return classes;
},
taskLink(task) {
let project_url = ProjectUtils.projectUrl();
@@ -49,9 +63,14 @@ let CellTasks = Vue.component('attract-cell-tasks', {
},
onTaskClicked(task) {
task_open(task._id, ProjectUtils.projectUrl());
EventBus.$emit(Events.DESELECT_ITEMS);
this.selected_task_id = task._id;
},
onAddTask(event) {
task_create(this.rowObject.getId(), this.column.taskType);
},
deselectTask() {
this.selected_task_id = null;
}
},
});

View File

@@ -141,6 +141,10 @@ $thumbnail-max-height: calc(110px * (9/16))
&:hover
box-shadow: inset 0px 0px 5px $color-background-active-dark
&.active
border: 2px solid white
box-shadow: 0 0 0 1px rgba($color-primary, .2), 1px 1px 0 rgba(black, .2)
.pillar-table-menu