-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain-view.js
60 lines (58 loc) · 1.82 KB
/
main-view.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { MainViewTemplate } from '../../templates/layout/main-view-template.js'
import { Task } from '../other/task.js'
const MainView = {
components: {
'task': Task
},
data: function () {
return {
currListName: "",
isMenuOpen: false,
addingNewTask: false,
newTaskName: "",
tasks: []
}
},
methods: {
displayTasks (newList) {
this.currListName = newList.name;
this.tasks = newList.tasks;
},
setMenuState (isOpen) {
this.isMenuOpen = isOpen;
},
onTaskToggleSelect (taskIndex) {
this.$emit("task-toggle-select", taskIndex);
},
onTaskToggleCompleted (taskIndex) {
this.$emit("task-toggle-completed", taskIndex);
},
onTaskChangeDueDate (taskIndex, newDueDate) {
this.$emit("task-change-due-date", taskIndex, newDueDate);
},
onTaskChangeImportance (taskIndex, newImportance) {
this.$emit("task-change-importance", taskIndex, newImportance);
},
onTaskMove (taskIndex, newList) {
this.$emit("task-move", taskIndex, newList);
},
onTaskDelete (taskIndex) {
this.$emit("task-delete", taskIndex);
},
unselectAllTasks () {
this.$children.forEach(component => {
if (component.$options._componentTag == "task") {
if (component.isSelected) {
component.toggleTaskSelect();
}
}
});
},
confirmNewTask (keepTask) {
this.$emit('confirm-new-task', keepTask, this.newTaskName)
this.addingNewTask = false;
},
},
template: MainViewTemplate,
}
export { MainView }