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