This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/models/namespace.js
konrad cafb960c8d
All checks were successful
continuous-integration/drone/push Build is passing
Colors for lists and namespaces (#74)
Show colors for namespaces bigger

Show colors for lists and namespaces

Add changing color for lists

Add changing color for namespace

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: #74
2020-03-25 21:27:29 +00:00

37 lines
760 B
JavaScript

import AbstractModel from './abstractModel'
import ListModel from './list'
import UserModel from './user'
export default class NamespaceModel extends AbstractModel {
constructor(data) {
super(data)
if (this.hex_color !== '' && this.hex_color.substring(0, 1) !== '#') {
this.hex_color = '#' + this.hex_color
}
this.lists = this.lists.map(l => {
return new ListModel(l)
})
this.owner = new UserModel(this.owner)
this.created = new Date(this.created)
this.updated = new Date(this.updated)
}
// Default attributes that define the 'empty' state.
defaults() {
return {
id: 0,
name: '',
description: '',
owner: UserModel,
lists: [],
is_archived: false,
hex_color: '',
created: null,
updated: null,
}
}
}