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: https://kolaente.dev/vikunja/frontend/pulls/74
This commit is contained in:
parent
51de1fe880
commit
cafb960c8d
8 changed files with 84 additions and 6 deletions
|
@ -134,7 +134,8 @@
|
||||||
</span>
|
</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
<label class="menu-label" v-tooltip="n.name + ' (' + n.lists.length + ')'" :for="n.id + 'checker'">
|
<label class="menu-label" v-tooltip="n.name + ' (' + n.lists.length + ')'" :for="n.id + 'checker'">
|
||||||
<span>
|
<span class="name">
|
||||||
|
<span class="color-bubble" v-if="n.hex_color !== ''" :style="{ backgroundColor: n.hex_color }"></span>
|
||||||
{{n.name}} ({{n.lists.length}})
|
{{n.name}} ({{n.lists.length}})
|
||||||
</span>
|
</span>
|
||||||
<span class="is-archived" v-if="n.is_archived">
|
<span class="is-archived" v-if="n.is_archived">
|
||||||
|
@ -147,7 +148,10 @@
|
||||||
<ul class="menu-list can-be-hidden" >
|
<ul class="menu-list can-be-hidden" >
|
||||||
<li v-for="l in n.lists" :key="l.id">
|
<li v-for="l in n.lists" :key="l.id">
|
||||||
<router-link :to="{ name: 'showList', params: { id: l.id} }">
|
<router-link :to="{ name: 'showList', params: { id: l.id} }">
|
||||||
<span>{{l.title}}</span>
|
<span class="name">
|
||||||
|
<span class="color-bubble" v-if="l.hex_color !== ''" :style="{ backgroundColor: l.hex_color }"></span>
|
||||||
|
{{l.title}}
|
||||||
|
</span>
|
||||||
<span class="is-archived" v-if="l.is_archived">
|
<span class="is-archived" v-if="l.is_archived">
|
||||||
Archived
|
Archived
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -34,6 +34,18 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Color</label>
|
||||||
|
<div class="control">
|
||||||
|
<verte
|
||||||
|
v-model="list.hex_color"
|
||||||
|
menuPosition="top"
|
||||||
|
picker="square"
|
||||||
|
model="hex"
|
||||||
|
:enableAlpha="false"
|
||||||
|
:rgbSliders="true"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="columns bigbuttons">
|
<div class="columns bigbuttons">
|
||||||
|
@ -71,6 +83,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import verte from 'verte'
|
||||||
|
import 'verte/dist/verte.css'
|
||||||
|
|
||||||
import auth from '../../auth'
|
import auth from '../../auth'
|
||||||
import router from '../../router'
|
import router from '../../router'
|
||||||
import manageSharing from '../sharing/userTeam'
|
import manageSharing from '../sharing/userTeam'
|
||||||
|
@ -97,6 +112,7 @@
|
||||||
components: {
|
components: {
|
||||||
LinkSharing,
|
LinkSharing,
|
||||||
manageSharing,
|
manageSharing,
|
||||||
|
verte,
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
// Check if the user is already logged in, if so, redirect him to the homepage
|
// Check if the user is already logged in, if so, redirect him to the homepage
|
||||||
|
|
|
@ -42,6 +42,18 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Color</label>
|
||||||
|
<div class="control">
|
||||||
|
<verte
|
||||||
|
v-model="namespace.hex_color"
|
||||||
|
menuPosition="top"
|
||||||
|
picker="square"
|
||||||
|
model="hex"
|
||||||
|
:enableAlpha="false"
|
||||||
|
:rgbSliders="true"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="columns bigbuttons">
|
<div class="columns bigbuttons">
|
||||||
|
@ -77,6 +89,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import verte from 'verte'
|
||||||
|
import 'verte/dist/verte.css'
|
||||||
|
|
||||||
import auth from '../../auth'
|
import auth from '../../auth'
|
||||||
import router from '../../router'
|
import router from '../../router'
|
||||||
import manageSharing from '../sharing/userTeam'
|
import manageSharing from '../sharing/userTeam'
|
||||||
|
@ -100,6 +115,7 @@
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
manageSharing,
|
manageSharing,
|
||||||
|
verte,
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
// Check if the user is already logged in, if so, redirect him to the homepage
|
// Check if the user is already logged in, if so, redirect him to the homepage
|
||||||
|
|
|
@ -6,7 +6,11 @@ export default class ListModel extends AbstractModel {
|
||||||
|
|
||||||
constructor(data) {
|
constructor(data) {
|
||||||
super(data)
|
super(data)
|
||||||
|
|
||||||
|
if (this.hex_color !== '' && this.hex_color.substring(0, 1) !== '#') {
|
||||||
|
this.hex_color = '#' + this.hex_color
|
||||||
|
}
|
||||||
|
|
||||||
// Make all tasks to task models
|
// Make all tasks to task models
|
||||||
this.tasks = this.tasks.map(t => {
|
this.tasks = this.tasks.map(t => {
|
||||||
return new TaskModel(t)
|
return new TaskModel(t)
|
||||||
|
@ -28,6 +32,7 @@ export default class ListModel extends AbstractModel {
|
||||||
tasks: [],
|
tasks: [],
|
||||||
namespaceID: 0,
|
namespaceID: 0,
|
||||||
is_archived: false,
|
is_archived: false,
|
||||||
|
hex_color: '',
|
||||||
|
|
||||||
created: null,
|
created: null,
|
||||||
updated: null,
|
updated: null,
|
||||||
|
|
|
@ -6,6 +6,10 @@ export default class NamespaceModel extends AbstractModel {
|
||||||
constructor(data) {
|
constructor(data) {
|
||||||
super(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 => {
|
this.lists = this.lists.map(l => {
|
||||||
return new ListModel(l)
|
return new ListModel(l)
|
||||||
})
|
})
|
||||||
|
@ -24,6 +28,7 @@ export default class NamespaceModel extends AbstractModel {
|
||||||
owner: UserModel,
|
owner: UserModel,
|
||||||
lists: [],
|
lists: [],
|
||||||
is_archived: false,
|
is_archived: false,
|
||||||
|
hex_color: '',
|
||||||
|
|
||||||
created: null,
|
created: null,
|
||||||
updated: null,
|
updated: null,
|
||||||
|
|
|
@ -28,6 +28,12 @@ export default class ListService extends AbstractService {
|
||||||
model.tasks = model.tasks.map(task => {
|
model.tasks = model.tasks.map(task => {
|
||||||
return taskService.beforeUpdate(task)
|
return taskService.beforeUpdate(task)
|
||||||
})
|
})
|
||||||
|
model.hex_color = model.hex_color.substring(1, 7)
|
||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beforeCreate(list) {
|
||||||
|
list.hex_color = list.hex_color.substring(1, 7)
|
||||||
|
return list
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -22,4 +22,14 @@ export default class NamespaceService extends AbstractService {
|
||||||
modelFactory(data) {
|
modelFactory(data) {
|
||||||
return new NamespaceModel(data)
|
return new NamespaceModel(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beforeUpdate(namespace) {
|
||||||
|
namespace.hex_color = namespace.hex_color.substring(1, 7)
|
||||||
|
return namespace
|
||||||
|
}
|
||||||
|
|
||||||
|
beforeCreate(namespace) {
|
||||||
|
namespace.hex_color = namespace.hex_color.substring(1, 7)
|
||||||
|
return namespace
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -130,9 +130,18 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
span:not(.icon) {
|
span.name:not(.icon) {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
|
.color-bubble {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: initial;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
border-radius: 100%;
|
||||||
|
margin-right: 2px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-archived {
|
.is-archived {
|
||||||
|
@ -149,8 +158,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-label .is-archived {
|
.menu-label {
|
||||||
min-width: 85px;
|
.color-bubble {
|
||||||
|
width: 14px !important;
|
||||||
|
height: 14px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-archived {
|
||||||
|
min-width: 85px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.nsettings{
|
.nsettings{
|
||||||
|
|
Loading…
Reference in a new issue