Skip to content

Commit de0145c

Browse files
committed
new filter: unassigned cards
Signed-off-by: Jakob Röhrl <jakob.roehrl@web.de>
1 parent 6ef8b12 commit de0145c

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

src/components/Controls.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@
7474
</div>
7575

7676
<h3>{{ t('deck', 'Filter by assigned user') }}</h3>
77+
<div class="filter--item">
78+
<input
79+
id="unassigned"
80+
v-model="filter.unassigned"
81+
type="checkbox"
82+
class="checkbox"
83+
value="unassigned"
84+
@change="setFilter"
85+
@click="beforeSetFilter">
86+
<label for="unassigned">{{ t('deck', 'Unassigned') }}</label>
87+
</div>
7788
<div v-for="user in board.users" :key="user.uid" class="filter--item">
7889
<input
7990
:id="user.uid"
@@ -200,7 +211,7 @@ export default {
200211
stack: '',
201212
showArchived: false,
202213
isAddStackVisible: false,
203-
filter: { tags: [], users: [], due: '' },
214+
filter: { tags: [], users: [], due: '', unassigned: false },
204215
}
205216
},
206217
@@ -244,6 +255,9 @@ export default {
244255
this.filter.due = ''
245256
this.$store.dispatch('setFilter', { ...this.filter })
246257
}
258+
if (e.target.value === 'unassigned') {
259+
this.filter.users = []
260+
}
247261
},
248262
setFilter() {
249263
this.$nextTick(() => this.$store.dispatch('setFilter', { ...this.filter }))

src/store/card.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ export default {
3232
getters: {
3333
cardsByStack: (state, getters, rootState) => (id) => {
3434
return state.cards.filter((card) => {
35-
const { tags, users, due } = rootState.filter
35+
const { tags, users, due, unassigned } = rootState.filter
3636
let allTagsMatch = true
3737
let allUsersMatch = true
38+
let allUnassigned = true
3839

3940
if (tags.length > 0) {
4041
tags.forEach((tag) => {
@@ -58,6 +59,16 @@ export default {
5859
}
5960
}
6061

62+
if (unassigned) {
63+
if (card.assignedUsers.length > 0) {
64+
allUnassigned = false
65+
}
66+
67+
if (!allUnassigned) {
68+
return false
69+
}
70+
}
71+
6172
if (due !== '') {
6273
const datediffHour = ((new Date(card.duedate) - new Date()) / 3600 / 1000)
6374
switch (due) {

0 commit comments

Comments
 (0)