Fix angular dependency in board selector

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2019-10-24 16:04:18 +02:00
parent 9c8f5d5f63
commit 56bee425b9
4 changed files with 10 additions and 20 deletions

View File

@@ -25,7 +25,8 @@
<div id="modal-inner" :class="{ 'icon-loading': loading }">
<h1>{{ t('deck', 'Select the board to link to a project') }}</h1>
<ul v-if="!loading">
<li v-for="board in boards" v-if="!currentBoard || ''+board.id !== ''+currentBoard" :class="{'selected': (selectedBoard === board.id) }"
<li v-for="board in boards" v-if="!currentBoard || ''+board.id !== ''+currentBoard" :key="board.id"
:class="{'selected': (selectedBoard === board.id) }"
@click="selectedBoard=board.id">
<span :style="{ 'backgroundColor': '#' + board.color }" class="board-bullet" />
<span>{{ board.title }}</span>
@@ -87,17 +88,10 @@ export default {
loading: true,
currentBoard: null
}
},
computed: {
},
beforeMount() {
this.fetchBoards()
if (typeof angular !== 'undefined' && angular.element('#board')) {
try {
this.currentBoard = angular.element('#board').scope().boardservice.id || null
} catch (e) {}
}
this.currentBoard = window.location.hash.match(/\/boards\/([0-9]+)/)[1] || null
},
methods: {
fetchBoards() {
@@ -111,7 +105,6 @@ export default {
},
select() {
this.$root.$emit('select', this.selectedBoard)
}
}

View File

@@ -21,14 +21,14 @@
-->
<template>
<Modal @close="close" :title="t('deck', 'Select the card to link to a project')">
<Modal :title="t('deck', 'Select the card to link to a project')" @close="close">
<div id="modal-inner" :class="{ 'icon-loading': loading }">
<Multiselect :placeholder="t('deck', 'Select a board')" v-model="selectedBoard" :options="boards"
label="title"
@select="fetchCardsFromBoard" />
<Multiselect :placeholder="t('deck', 'Select a card')" v-model="selectedCard" :options="cardsFromBoard"
label="title"/>
label="title" />
<button :disabled="!isBoardAndStackChoosen" class="primary" @click="select">{{ t('deck', 'Link to card') }}</button>
<button @click="close">{{ t('deck', 'Cancel') }}</button>
@@ -44,7 +44,7 @@ import axios from 'nextcloud-axios'
export default {
name: 'CollaborationView',
components: {
Modal,
Modal,
Multiselect
},
data() {
@@ -85,7 +85,7 @@ export default {
} catch (err) {
return err
}
},
close() {
this.$root.$emit('close')

View File

@@ -73,7 +73,7 @@
<div class="section-wrapper">
<collection-list v-if="currentCard.id" :id="`${currentCard.id}`" :name="currentCard.title"
type="deck-card" />
type="deck-card" />
</div>
<h5>Description</h5>

View File

@@ -27,9 +27,6 @@ import CardSelector from './CardSelector'
import './../css/collections.css'
'use strict'
/* global __webpack_nonce__ __webpack_public_path__ OC t n */
// eslint-disable-next-line
__webpack_nonce__ = btoa(OC.requestToken);
// eslint-disable-next-line
@@ -55,7 +52,7 @@ Vue.prototype.OC = OC;
ComponentVM.$root.$on('close', () => {
ComponentVM.$el.remove()
ComponentVM.$destroy()
reject()
reject(new Error('Board selection canceled'))
})
ComponentVM.$root.$on('select', (id) => {
resolve(id)
@@ -82,7 +79,7 @@ Vue.prototype.OC = OC;
ComponentVM.$root.$on('close', () => {
ComponentVM.$el.remove()
ComponentVM.$destroy()
reject()
reject(new Error('Card selection canceled'))
})
ComponentVM.$root.$on('select', (id) => {
resolve(id)