Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce done and open filters #5488

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 41 additions & 5 deletions src/components/Controls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,40 @@
<label :for="user.uid"><NcAvatar :user="user.uid" :size="24" :disable-menu="true" /> {{ user.displayname }}</label>
</div>

<h3>{{ t('deck', 'Filter by due date') }}</h3>
<h3>{{ t('deck', 'Filter by completed') }}</h3>
<div class="filter--item">
<input id="filter-option-both"
v-model="filter.completed"
type="radio"
class="radio"
value="both"
@change="setFilter"
@click="beforeSetFilter">
<label for="filter-option-both">{{ t('deck', 'Open and completed') }}</label>
</div>
<div class="filter--item">
<input id="filter-option-open"
v-model="filter.completed"
type="radio"
class="radio"
value="open"
@change="setFilter"
@click="beforeSetFilter">
<label for="filter-option-open">{{ t('deck', 'Open') }}</label>
</div>

<div class="filter--item">
<input id="filter-option-completed"
v-model="filter.completed"
type="radio"
class="radio"
value="completed"
@change="setFilter"
@click="beforeSetFilter">
<label for="filter-option-completed">{{ t('deck', 'Completed') }}</label>
</div>

<h3>{{ t('deck', 'Filter by due date') }}</h3>
<div class="filter--item">
<input id="overdue"
v-model="filter.due"
Expand Down Expand Up @@ -293,7 +325,7 @@ export default {
filterVisible: false,
showArchived: false,
isAddStackVisible: false,
filter: { tags: [], users: [], due: '', unassigned: false },
filter: { tags: [], users: [], due: '', unassigned: false, completed: 'both' },
showAddCardModal: false,
defaultPageTitle: false,
isNotifyPushEnabled: isNotifyPushEnabled(),
Expand All @@ -317,7 +349,7 @@ export default {
}
},
isFilterActive() {
return this.filter.tags.length !== 0 || this.filter.users.length !== 0 || this.filter.due !== ''
return this.filter.tags.length !== 0 || this.filter.users.length !== 0 || this.filter.due !== '' || this.filter.completed !== 'both'
},
labelsSorted() {
return [...this.board.labels].sort((a, b) => (a.title < b.title) ? -1 : 1)
Expand Down Expand Up @@ -360,7 +392,12 @@ export default {
}
if (e.target.value === 'unassigned') {
this.filter.users = []
this.$store.dispatch('setFilter', { ...this.filter })
} else {
this.filter.completed = 'both'
this.$store.dispatch('setFilter', { ...this.filter })
}
this.$store.dispatch('setFilter', { ...this.filter })
},
setFilter() {
if (this.filter.users.length > 0) {
Expand Down Expand Up @@ -402,7 +439,7 @@ export default {
}
},
clearFilter() {
const filterReset = { tags: [], users: [], due: '' }
const filterReset = { tags: [], users: [], due: '', completed: 'both' }
this.$store.dispatch('setFilter', { ...filterReset })
this.filter = filterReset
},
Expand Down Expand Up @@ -519,7 +556,6 @@ export default {
input + label {
display: block;
padding: 6px 0;
vertical-align: middle;
.avatardiv {
vertical-align: middle;
margin-bottom: 2px;
Expand Down
5 changes: 4 additions & 1 deletion src/store/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export default {
getters: {
cardsByStack: (state, getters, rootState) => (id) => {
return state.cards.filter((card) => {
const { tags, users, due, unassigned } = rootState.filter
const { tags, users, due, unassigned, completed } = rootState.filter

if (completed === 'open' && card.done !== null) { return false }
if (completed === 'completed' && card.done == null) { return false }
let allTagsMatch = true
let allUsersMatch = true

Expand Down
2 changes: 1 addition & 1 deletion src/store/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default new Vuex.Store({
searchQuery: '',
activity: [],
activityLoadMore: true,
filter: { tags: [], users: [], due: '' },
filter: { tags: [], users: [], due: '', completed: 'both' },
shortcutLock: false,
},
getters: {
Expand Down
Loading