Fix setting a default color when none was saved
This commit is contained in:
parent
7ace71ad2e
commit
603345b326
2 changed files with 13 additions and 9 deletions
|
|
@ -47,11 +47,7 @@ export default class TaskModel extends AbstractModel {
|
|||
return new LabelModel(l)
|
||||
})
|
||||
|
||||
// Set the default color
|
||||
if (this.hexColor === '') {
|
||||
this.hexColor = this.defaultColor
|
||||
}
|
||||
if (this.hexColor.substring(0, 1) !== '#') {
|
||||
if (this.hexColor !== '' && this.hexColor.substring(0, 1) !== '#') {
|
||||
this.hexColor = '#' + this.hexColor
|
||||
}
|
||||
|
||||
|
|
@ -124,6 +120,14 @@ export default class TaskModel extends AbstractModel {
|
|||
return this.identifier
|
||||
}
|
||||
|
||||
getHexColor() {
|
||||
if (this.hexColor === '') {
|
||||
return `#${this.defaultColor}`
|
||||
}
|
||||
|
||||
return this.hexColor
|
||||
}
|
||||
|
||||
/////////////////
|
||||
// Helper functions
|
||||
///////////////
|
||||
|
|
|
|||
Reference in a new issue