Merge pull request #988 from nextcloud/bugfix/967/collections-fixes

Bugfix/967/collections fixes
This commit is contained in:
Julius Härtl
2019-04-11 10:20:55 +02:00
committed by GitHub
3 changed files with 19 additions and 10 deletions

View File

@@ -19,12 +19,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
/* global oc_defaults oc_config OC OCP OCA t n */
import app from '../app/App.js'; import app from '../app/App.js';
import Vue from 'vue'; import Vue from 'vue';
Vue.prototype.t = t;
Vue.prototype.n = n;
Vue.prototype.OC = OC;
import CollaborationView from '../views/CollaborationView'; import CollaborationView from '../views/CollaborationView';
/* global oc_defaults oc_config OC OCP OCA */
app.controller('BoardController', function ($rootScope, $scope, $element, $stateParams, StatusService, BoardService, StackService, CardService, LabelService, $state, $transitions, $filter, FileService) { app.controller('BoardController', function ($rootScope, $scope, $element, $stateParams, StatusService, BoardService, StackService, CardService, LabelService, $state, $transitions, $filter, FileService) {
$scope.sidebar = $rootScope.sidebar; $scope.sidebar = $rootScope.sidebar;

View File

@@ -29,17 +29,17 @@ __webpack_nonce__ = btoa(OC.requestToken);
__webpack_public_path__ = OC.linkTo('deck', 'js/build/'); __webpack_public_path__ = OC.linkTo('deck', 'js/build/');
import Vue from 'vue'; import Vue from 'vue';
Vue.prototype.t = t;
Vue.prototype.n = n;
Vue.prototype.OC = OC;
import BoardSelector from './views/BoardSelector'; import BoardSelector from './views/BoardSelector';
import './../css/collections.css'; import './../css/collections.css';
((function(OCP) { ((function(OCP) {
Vue.prototype.$ = $
Vue.prototype.t = t
Vue.prototype.n = n
Vue.prototype.OC = OC
OCP.Collaboration.registerType('deck', { OCP.Collaboration.registerType('deck', {
action: () => { action: () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@@ -63,7 +63,7 @@ import './../css/collections.css';
}); });
}); });
}, },
typeString: t('deck', 'board'), typeString: t('deck', 'Link to a board'),
typeIconClass: 'icon-deck' typeIconClass: 'icon-deck'
}); });
})(window.OCP)); })(window.OCP));

View File

@@ -23,14 +23,14 @@
<template> <template>
<Modal @close="close"> <Modal @close="close">
<div id="modal-inner" :class="{ 'icon-loading': loading }"> <div id="modal-inner" :class="{ 'icon-loading': loading }">
<h1>Select a board to add to the collection</h1> <h1>{{ t('deck', 'Select the board to link to a project') }}</h1>
<ul v-if="!loading"> <ul v-if="!loading">
<li v-for="board in boards" @click="selectedBoard=board.id" :class="{'selected': (selectedBoard === board.id) }"> <li v-for="board in boards" v-if="currentBoard && ''+board.id !== ''+currentBoard" @click="selectedBoard=board.id" :class="{'selected': (selectedBoard === board.id) }">
<span class="board-bullet" :style="{ 'backgroundColor': '#' + board.color }"></span> <span class="board-bullet" :style="{ 'backgroundColor': '#' + board.color }"></span>
<span>{{ board.title }}</span> <span>{{ board.title }}</span>
</li> </li>
</ul> </ul>
<button v-if="!loading" @click="select" class="primary">Select board</button> <button v-if="!loading" @click="select" class="primary">{{ t('deck', 'Select board') }}</button>
</div> </div>
</Modal> </Modal>
</template> </template>
@@ -84,10 +84,14 @@
boards: [], boards: [],
selectedBoard: null, selectedBoard: null,
loading: true, loading: true,
currentBoard: null,
} }
}, },
beforeMount() { beforeMount() {
this.fetchBoards(); this.fetchBoards();
if (angular.element('#board')) {
this.currentBoard = angular.element('#board').scope().boardservice.id || null;
}
}, },
methods: { methods: {
fetchBoards() { fetchBoards() {