Allow editing cards on filtered views
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -113,9 +113,15 @@ export default {
|
||||
currentBoard: state => state.currentBoard,
|
||||
}),
|
||||
...mapGetters([
|
||||
'canEdit',
|
||||
'isArchived',
|
||||
]),
|
||||
canEdit() {
|
||||
if (this.currentBoard) {
|
||||
return this.$store.getters.canEdit
|
||||
}
|
||||
const board = this.$store.getters.boards.find((item) => item.id === this.card.boardId)
|
||||
return board.permissions.PERMISSION_EDIT
|
||||
},
|
||||
card() {
|
||||
return this.item ? this.item : this.$store.getters.cardById(this.id)
|
||||
},
|
||||
@@ -148,7 +154,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
openCard() {
|
||||
const boardId = this.item ? this.item.boardId : this.$route.params.id
|
||||
const boardId = this.card ? this.card.boardId : this.$route.params.id
|
||||
this.$router.push({ name: 'card', params: { id: boardId, cardId: this.card.id } }).catch(() => {})
|
||||
},
|
||||
startEditing(card) {
|
||||
|
||||
@@ -95,14 +95,19 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'canEdit',
|
||||
'isArchived',
|
||||
]),
|
||||
...mapState({
|
||||
showArchived: state => state.showArchived,
|
||||
currentBoard: state => state.currentBoard,
|
||||
}),
|
||||
|
||||
canEdit() {
|
||||
if (this.currentBoard) {
|
||||
return this.$store.getters.canEdit
|
||||
}
|
||||
const board = this.$store.getters.boards.find((item) => item.id === this.card.boardId)
|
||||
return board.permissions.PERMISSION_EDIT
|
||||
},
|
||||
isBoardAndStackChoosen() {
|
||||
if (this.selectedBoard === '' || this.selectedStack === '') {
|
||||
return false
|
||||
|
||||
@@ -26,44 +26,44 @@
|
||||
|
||||
<div v-if="loading" key="loading" class="emptycontent">
|
||||
<div class="icon icon-loading" />
|
||||
<h2>{{ t('deck', 'Loading Dashboard') }}</h2>
|
||||
<h2>{{ t('deck', 'Loading filtered view') }}</h2>
|
||||
<p />
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<div v-if="filter=='due'" class="dashboard">
|
||||
<div class="dashboard-column">
|
||||
<h2>{{ t('deck', 'overdue') }}</h2>
|
||||
<h2>{{ t('deck', 'Overdue') }}</h2>
|
||||
<div v-for="card in withDueDashboardGroup.overdue" :key="card.id">
|
||||
<CardItem :item="card" />
|
||||
<CardItem :id="card.id" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-column">
|
||||
<h2>{{ t('deck', 'today') }}</h2>
|
||||
<h2>{{ t('deck', 'Today') }}</h2>
|
||||
<div v-for="card in withDueDashboardGroup.today" :key="card.id">
|
||||
<CardItem :item="card" />
|
||||
<CardItem :id="card.id" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-column">
|
||||
<h2>{{ t('deck', 'tomorrow') }}</h2>
|
||||
<h2>{{ t('deck', 'Tomorrow') }}</h2>
|
||||
<div v-for="card in withDueDashboardGroup.tomorrow" :key="card.id">
|
||||
<CardItem :item="card" />
|
||||
<CardItem :id="card.id" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-column">
|
||||
<h2>{{ t('deck', 'this week') }}</h2>
|
||||
<h2>{{ t('deck', 'This week') }}</h2>
|
||||
<div v-for="card in withDueDashboardGroup.later" :key="card.id">
|
||||
<CardItem :item="card" />
|
||||
<CardItem :id="card.id" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-column">
|
||||
<h2>{{ t('deck', 'later') }}</h2>
|
||||
<h2>{{ t('deck', 'Later') }}</h2>
|
||||
<div v-for="card in withDueDashboardGroup.thisWeek" :key="card.id">
|
||||
<CardItem :item="card" />
|
||||
<CardItem :id="card.id" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -72,42 +72,42 @@
|
||||
<div class="dashboard-column">
|
||||
<h2>{{ t('deck', 'no due') }}</h2>
|
||||
<div v-for="card in assignedCardsDashboardGroup.nodue" :key="card.id">
|
||||
<CardItem :item="card" />
|
||||
<CardItem :id="card.id" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-column">
|
||||
<h2>{{ t('deck', 'overdue') }}</h2>
|
||||
<div v-for="card in assignedCardsDashboardGroup.overdue" :key="card.id">
|
||||
<CardItem :item="card" />
|
||||
<CardItem :id="card.id" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-column">
|
||||
<h2>{{ t('deck', 'today') }}</h2>
|
||||
<div v-for="card in assignedCardsDashboardGroup.today" :key="card.id">
|
||||
<CardItem :item="card" />
|
||||
<CardItem :id="card.id" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-column">
|
||||
<h2>{{ t('deck', 'tomorrow') }}</h2>
|
||||
<div v-for="card in assignedCardsDashboardGroup.tomorrow" :key="card.id">
|
||||
<CardItem :item="card" />
|
||||
<CardItem :id="card.id" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-column">
|
||||
<h2>{{ t('deck', 'this week') }}</h2>
|
||||
<div v-for="card in assignedCardsDashboardGroup.thisWeek" :key="card.id">
|
||||
<CardItem :item="card" />
|
||||
<CardItem :id="card.id" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-column">
|
||||
<h2>{{ t('deck', 'later') }}</h2>
|
||||
<div v-for="card in withDueDashboardGroup.later" :key="card.id">
|
||||
<CardItem :item="card" />
|
||||
<CardItem :id="card.id" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -56,14 +56,22 @@ export default {
|
||||
},
|
||||
actions: {
|
||||
async loadDueDashboard({ commit }) {
|
||||
const withDue = await apiClient.findAllWithDue()
|
||||
const withDueFlat = withDue.flat()
|
||||
commit('setCurrentBoard', null)
|
||||
const cardsWithDueDate = await apiClient.findAllWithDue()
|
||||
const withDueFlat = cardsWithDueDate.flat()
|
||||
for (const i in withDueFlat) {
|
||||
commit('addCard', withDueFlat[i])
|
||||
}
|
||||
commit('setWithDueDashboard', withDueFlat)
|
||||
},
|
||||
|
||||
async loadAssignDashboard({ commit }) {
|
||||
commit('setCurrentBoard', null)
|
||||
const assignedCards = await apiClient.findMyAssignedCards()
|
||||
const assignedCardsFlat = assignedCards.flat()
|
||||
for (const i in assignedCardsFlat) {
|
||||
commit('addCard', assignedCardsFlat[i])
|
||||
}
|
||||
commit('setAssignedCards', assignedCardsFlat)
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user