added themecolor and themebgcolor to todos and projects

This commit is contained in:
Paolo Arena
2019-04-29 23:47:42 +02:00
parent 166be747a5
commit 08c0ded31f
26 changed files with 547 additions and 221 deletions

View File

@@ -264,7 +264,6 @@ $heightdescr: 20px;
//padding: 2px;
min-width: 100px;
text-align: left;
color: blue !important;
overflow: hidden;
align-items: center;
@@ -272,8 +271,6 @@ $heightdescr: 20px;
vertical-align: middle;
line-height: 120%;
//background-color: #d50000;
//order: 2;
&.hide {

View File

@@ -3,6 +3,7 @@ import { Component, Prop, Watch } from 'vue-property-decorator'
import { Projects, UserStore } from '@modules'
import { tools } from '../../../store/Modules/tools'
import { lists } from '../../../store/Modules/lists'
import { ITodo } from '../../../model/index'
@@ -17,7 +18,6 @@ import { CDate } from '../../CDate'
name: 'SingleTodo'
})
export default class SingleTodo extends Vue {
public selectPriority: [] = []
public menuPopupTodo: any[] = []
public iconCompleted: string = ''
public classCompleted: string = ''
@@ -90,6 +90,12 @@ export default class SingleTodo extends Vue {
@Watch('itemtodo.assigned_to_userId') public valueChangedend_assigned_to_userId() {
this.watchupdate('assigned_to_userId')
}
@Watch('itemtodo.themecolor') public valueChangedend_themecolor() {
this.watchupdate('themecolor')
}
@Watch('itemtodo.themebgcolor') public valueChangedend_themebgcolor() {
this.watchupdate('themebgcolor')
}
@Watch('itemtodo.phase') public valueChangedend_phase() {
this.watchupdate('phase')
}
@@ -138,6 +144,9 @@ export default class SingleTodo extends Vue {
this.classDescrEdit += ' titleLista-item'
}
this.classDescr += ' text-' + this.itemtodo.themecolor + ' bg-' + this.itemtodo.themebgcolor
this.classDescrEdit += ' text-' + this.itemtodo.themecolor + ' bg-' + this.itemtodo.themebgcolor
if (this.itemtodo.progress > 100)
this.itemtodo.progress = 100
@@ -197,9 +206,6 @@ export default class SingleTodo extends Vue {
this.updateicon()
this.updateClasses()
this.selectPriority = tools.selectPriority[UserStore.state.lang]
}
public getClassRow() {
@@ -315,7 +321,7 @@ export default class SingleTodo extends Vue {
if (((e.keyCode === 8) || (e.keyCode === 46)) && (this.precDescr === '') && !e.shiftKey) {
e.preventDefault()
this.deselectRiga()
this.clickMenu(tools.MenuAction.DELETE)
this.clickMenu(lists.MenuAction.DELETE)
.then(() => {
this.faiFocus('insertTask', true)
return
@@ -343,7 +349,7 @@ export default class SingleTodo extends Vue {
if (((e.keyCode === 8) || (e.keyCode === 46)) && (this.precDescr === '') && !e.shiftKey) {
e.preventDefault()
this.deselectRiga()
this.clickMenu(tools.MenuAction.DELETE)
this.clickMenu(lists.MenuAction.DELETE)
.then(() => {
this.faiFocus('insertTask', true)
return
@@ -452,18 +458,18 @@ export default class SingleTodo extends Vue {
public async clickMenu(action) {
console.log('click menu: ', action)
if (action === tools.MenuAction.DELETE) {
if (action === lists.MenuAction.DELETE) {
return await this.askConfirmDelete()
} else if (action === tools.MenuAction.TOGGLE_EXPIRING) {
} else if (action === lists.MenuAction.TOGGLE_EXPIRING) {
return await this.enableExpiring()
} else if (action === tools.MenuAction.COMPLETED) {
} else if (action === lists.MenuAction.COMPLETED) {
return await this.setCompleted()
} else if (action === tools.MenuAction.PROGRESS_BAR) {
} else if (action === lists.MenuAction.PROGRESS_BAR) {
return await this.updatedata('progress')
} else if (action === tools.MenuAction.CUT) {
} else if (action === lists.MenuAction.CUT) {
const myaction = {
table: tools.todos,
type: tools.MenuAction.CUT,
type: lists.MenuAction.CUT,
_id: this.itemtodo._id,
cat: this.itemtodo.category
}
@@ -474,6 +480,38 @@ export default class SingleTodo extends Vue {
}
public selectSubMenu(action, elem) {
if (action === lists.MenuAction.PRIORITY) {
this.setPriority(elem)
} else if (action === lists.MenuAction.THEME) {
this.setThemeColor(elem, false)
} else if (action === lists.MenuAction.THEMEBG) {
this.setThemeColor(elem, true)
}
}
public setThemeColor(newtheme, bg: boolean) {
let changedfield = ''
if (bg){
if (this.itemtodo.themebgcolor !== newtheme) {
this.itemtodo.themebgcolor = newtheme
changedfield = 'themebgcolor'
}
}else {
if (this.itemtodo.themecolor !== newtheme) {
this.itemtodo.themecolor = newtheme
changedfield = 'themecolor'
}
}
if (changedfield !== '') {
this.updatedata(changedfield)
this.updateicon()
}
}
public setPriority(newpriority) {
if (this.itemtodo.priority !== newpriority) {

View File

@@ -72,7 +72,7 @@
icon="menu">
<q-menu v-if="CanIModifyTodo" ref="popmenu" self="top right">
<SubMenus :menuPopupTodo="menuPopupTodo" :itemtodo="itemtodo" @clickMenu="clickMenu"
@setPriority="setPriority"></SubMenus>
@selectSubMenu="selectSubMenu"></SubMenus>
</q-menu>
</q-btn>