From 1e4d663c11d1701b288de179a51ad473ed30349a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Sat, 24 Nov 2018 10:17:17 +0100 Subject: [PATCH 001/334] Add basic vue structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .babelrc | 5 ++ .eslintrc.js | 67 ++++++++++++++++++++++ .eslintrc.yml | 43 -------------- .gitignore | 4 ++ package.json | 99 ++++++++++++++++++++++++++++++++ src/App.vue | 31 ++++++++++ src/main.js | 53 +++++++++++++++++ src/router.js | 51 +++++++++++++++++ src/store/main.js | 34 +++++++++++ src/views/Board.vue | 35 ++++++++++++ src/views/List.vue | 35 ++++++++++++ src/views/Main.vue | 130 ++++++++++++++++++++++++++++++++++++++++++ src/views/Sidebar.vue | 35 ++++++++++++ webpack.common.js | 42 ++++++++++++++ webpack.dev.js | 12 ++++ webpack.prod.js | 7 +++ 16 files changed, 640 insertions(+), 43 deletions(-) create mode 100644 .babelrc create mode 100644 .eslintrc.js delete mode 100644 .eslintrc.yml create mode 100644 package.json create mode 100644 src/App.vue create mode 100644 src/main.js create mode 100644 src/router.js create mode 100644 src/store/main.js create mode 100644 src/views/Board.vue create mode 100644 src/views/List.vue create mode 100644 src/views/Main.vue create mode 100644 src/views/Sidebar.vue create mode 100644 webpack.common.js create mode 100644 webpack.dev.js create mode 100644 webpack.prod.js diff --git a/.babelrc b/.babelrc new file mode 100644 index 000000000..3de69bf40 --- /dev/null +++ b/.babelrc @@ -0,0 +1,5 @@ +{ + "plugins": [ + "@babel/plugin-syntax-dynamic-import" + ] +} diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..340cc1cfa --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,67 @@ +module.exports = { + root: true, + env: { + browser: true, + es6: true, + node: true, + jest: true + }, + globals: { + t: true, + n: true, + OC: true, + OCA: true, + Vue: true, + VueRouter: true + }, + parserOptions: { + parser: 'babel-eslint', + ecmaVersion: 6 + }, + extends: [ + 'eslint:recommended', + 'plugin:node/recommended', + 'plugin:vue/essential', + 'plugin:vue/recommended', + 'standard' + ], + plugins: ['vue', 'node'], + rules: { + // space before function () + 'space-before-function-paren': ['error', 'never'], + // curly braces always space + 'object-curly-spacing': ['error', 'always'], + // stay consistent with array brackets + 'array-bracket-newline': ['error', 'consistent'], + // 1tbs brace style + 'brace-style': 'error', + // tabs only + indent: ['error', 'tab'], + 'no-tabs': 0, + 'vue/html-indent': ['error', 'tab'], + // only debug console + 'no-console': ['error', { allow: ['error', 'warn', 'debug'] }], + // classes blocks + 'padded-blocks': ['error', { classes: 'always' }], + // always have the operator in front + 'operator-linebreak': ['error', 'before'], + // ternary on multiline + 'multiline-ternary': ['error', 'always-multiline'], + // es6 import/export and require + 'node/no-unpublished-require': ['off'], + 'node/no-unsupported-features/es-syntax': ['off'], + // space before self-closing elements + 'vue/html-closing-bracket-spacing': 'error', + // code spacing with attributes + 'vue/max-attributes-per-line': [ + 'error', + { + singleline: 3, + multiline: { + max: 3, + allowFirstLine: true + } + } + ] + } +} diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index fed0e4eb0..000000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,43 +0,0 @@ -root: true - -extends: - - eslint:recommended - -env: - browser: true - amd: true - es6: true - -globals: - global: false - app: false - angular: false - $: false - escapeHTML: false - OC: false - OCA: false - t: false - oc_current_user: false - oc_requesttoken: false - Clipboard: false - oc_defaults: false - -parserOptions: - ecmaVersion: 6 - sourceType: "module" - -rules: - curly: error - eqeqeq: ["error", "smart"] - guard-for-in: error - no-console: off - no-fallthrough: error - no-mixed-spaces-and-tabs: error - no-unused-vars: warn - no-useless-escape: warn - no-use-before-define: error - semi: ["error", "always"] - indent: - - error - - tab - - SwitchCase: 1 diff --git a/.gitignore b/.gitignore index a6073ac05..46cafbc9c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +node_modules/* +js/*deck.js +js/*deck.js.map + js/node_modules/* js/vendor/ js/public/ diff --git a/package.json b/package.json new file mode 100644 index 000000000..0b3cfcc47 --- /dev/null +++ b/package.json @@ -0,0 +1,99 @@ +{ + "name": "deck", + "description": "", + "version": "1.0.0", + "authors": [ + { + "name": "Julius Härtl", + "email": "jus@bitgrid.net", + "role": "Developer" + }, + { + "name": "Michael Weimann", + "email": "mail@michael-weimann.eu", + "role": "Developer" + } + ], + "license": "agpl", + "private": true, + "scripts": { + "dev": "webpack --config webpack.dev.js", + "watch": "webpack --progress --watch --config webpack.dev.js", + "build": "webpack --progress --hide-modules --config webpack.prod.js", + "lint": "eslint --ext .js,.vue src tests", + "lint:fix": "eslint --ext .js,.vue src tests --fix", + "test": "jest", + "test:coverage": "jest --coverage" + }, + "dependencies": { + "@babel/polyfill": "^7.0.0", + "nextcloud-axios": "^0.1.2", + "nextcloud-server": "^0.15.9", + "nextcloud-vue": "^0.4.2", + "vue": "^2.5.16", + "vue-click-outside": "^1.0.7", + "vue-infinite-loading": "^2.4.1", + "vue-router": "^3.0.1", + "vuex": "^3.0.1", + "vuex-router-sync": "^5.0.0" + }, + "browserslist": [ + "last 2 versions", + "not ie <= 11" + ], + "engines": { + "node": ">=10.0.0" + }, + "devDependencies": { + "@babel/core": "^7.1.2", + "@babel/plugin-syntax-dynamic-import": "^7.0.0", + "@babel/preset-env": "^7.1.0", + "@vue/test-utils": "^1.0.0-beta.25", + "babel-eslint": "^8.2.5", + "babel-jest": "^23.6.0", + "babel-loader": "^8.0.4", + "css-loader": "^0.28.11", + "eslint": "^4.19.1", + "eslint-config-standard": "^11.0.0", + "eslint-friendly-formatter": "^4.0.1", + "eslint-loader": "^2.1.1", + "eslint-plugin-import": "^2.13.0", + "eslint-plugin-node": "^7.0.1", + "eslint-plugin-promise": "^3.8.0", + "eslint-plugin-standard": "^3.1.0", + "eslint-plugin-vue": "^4.5.0", + "extract-text-webpack-plugin": "^3.0.2", + "file-loader": "^1.1.11", + "jest": "^23.6.0", + "jest-serializer-vue": "^2.0.2", + "mini-css-extract-plugin": "^0.4.4", + "prettier-eslint": "^8.8.2", + "raw-loader": "^0.5.1", + "stylelint": "^8.4.0", + "stylelint-config-recommended-scss": "^3.2.0", + "stylelint-webpack-plugin": "^0.10.5", + "vue-jest": "^2.6.0", + "vue-loader": "^15.4.2", + "vue-style-loader": "^4.1.1", + "vue-template-compiler": "^2.5.16", + "webpack": "^4.23.1", + "webpack-cli": "^3.1.2", + "webpack-merge": "^4.1.2" + }, + "jest": { + "moduleFileExtensions": [ + "js", + "vue" + ], + "moduleNameMapper": { + "^@/(.*)$": "/src/$1" + }, + "transform": { + "^.+\\.js$": "/node_modules/babel-jest", + ".*\\.(vue)$": "/node_modules/vue-jest" + }, + "snapshotSerializers": [ + "/node_modules/jest-serializer-vue" + ] + } +} diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 000000000..8fcbaa2f0 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/src/main.js b/src/main.js new file mode 100644 index 000000000..a12f0efa9 --- /dev/null +++ b/src/main.js @@ -0,0 +1,53 @@ +/* + * @copyright Copyright (c) 2018 Julius Härtl + * + * @author Julius Härtl + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +import Vue from 'vue' +import App from './App' +import router from './router' +import store from './store/main' +import { sync } from 'vuex-router-sync' +import { translate, translatePlural } from 'nextcloud-server/dist/l10n' +import { generateFilePath } from 'nextcloud-server/dist/router' +import VTooltip from 'v-tooltip' + +// eslint-disable-next-line +__webpack_nonce__ = btoa(OC.requestToken) +// eslint-disable-next-line +__webpack_public_path__ = generateFilePath('deck', '', 'js/') + +sync(store, router) + +Vue.mixin({ + methods: { + t: translate, + n: translatePlural + } +}) + +Vue.use(VTooltip) + +/* eslint-disable-next-line no-new */ +new Vue({ + el: '#content', + router, + store, + render: h => h(App) +}) diff --git a/src/router.js b/src/router.js new file mode 100644 index 000000000..61c2ef5ef --- /dev/null +++ b/src/router.js @@ -0,0 +1,51 @@ +/* + * @copyright Copyright (c) 2018 Julius Härtl + * + * @author Julius Härtl + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +import Vue from 'vue' +import Router from 'vue-router' +import { generateUrl } from 'nextcloud-server/dist/router' + +const Main = () => import('./views/Main') + +Vue.use(Router) + +export default new Router({ + base: generateUrl('/apps/deck/'), + linkActiveClass: 'active', + routes: [ + { + path: '/', + name: 'main', + component: Main + }, + { + path: '/boards', + name: 'boards', + component: Main + }, + { + path: '/boards/archived', + name: 'boards.archived', + component: Main + } + ] +}) diff --git a/src/store/main.js b/src/store/main.js new file mode 100644 index 000000000..b6c4c1600 --- /dev/null +++ b/src/store/main.js @@ -0,0 +1,34 @@ +/* + * @copyright Copyright (c) 2018 Julius Härtl + * + * @author Julius Härtl + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +import Vue from 'vue' +import Vuex from 'vuex' + +Vue.use(Vuex) + +const debug = process.env.NODE_ENV !== 'production' + +export default new Vuex.Store({ + modules: { + }, + strict: debug +}) diff --git a/src/views/Board.vue b/src/views/Board.vue new file mode 100644 index 000000000..d5c974934 --- /dev/null +++ b/src/views/Board.vue @@ -0,0 +1,35 @@ + + + + + + + diff --git a/src/views/List.vue b/src/views/List.vue new file mode 100644 index 000000000..fdfb710c5 --- /dev/null +++ b/src/views/List.vue @@ -0,0 +1,35 @@ + + + + + + + diff --git a/src/views/Main.vue b/src/views/Main.vue new file mode 100644 index 000000000..d88ea8702 --- /dev/null +++ b/src/views/Main.vue @@ -0,0 +1,130 @@ + + + + + + + diff --git a/src/views/Sidebar.vue b/src/views/Sidebar.vue new file mode 100644 index 000000000..a63cb70ad --- /dev/null +++ b/src/views/Sidebar.vue @@ -0,0 +1,35 @@ + + + + + + + diff --git a/webpack.common.js b/webpack.common.js new file mode 100644 index 000000000..407715ca6 --- /dev/null +++ b/webpack.common.js @@ -0,0 +1,42 @@ +const path = require('path'); +const { VueLoaderPlugin } = require('vue-loader'); + +module.exports = { + entry: path.join(__dirname, 'src', 'main.js'), + output: { + path: path.resolve(__dirname, './js'), + publicPath: '/js/', + filename: 'deck.js' + }, + module: { + rules: [ + { + test: /\.css$/, + use: ['vue-style-loader', 'css-loader'] + }, + { + test: /\.vue$/, + loader: 'vue-loader' + }, + { + test: /\.js$/, + loader: 'babel-loader', + exclude: /node_modules/ + }, + { + test: /\.(png|jpg|gif|svg)$/, + loader: 'file-loader', + options: { + name: '[name].[ext]?[hash]' + } + } + ] + }, + plugins: [new VueLoaderPlugin()], + resolve: { + alias: { + vue$: 'vue/dist/vue.esm.js' + }, + extensions: ['*', '.js', '.vue', '.json'] + } +}; diff --git a/webpack.dev.js b/webpack.dev.js new file mode 100644 index 000000000..49291d777 --- /dev/null +++ b/webpack.dev.js @@ -0,0 +1,12 @@ +const merge = require('webpack-merge'); +const common = require('./webpack.common.js'); + +module.exports = merge(common, { + mode: 'development', + devServer: { + historyApiFallback: true, + noInfo: true, + overlay: true + }, + devtool: 'source-map', +}) diff --git a/webpack.prod.js b/webpack.prod.js new file mode 100644 index 000000000..f081567bd --- /dev/null +++ b/webpack.prod.js @@ -0,0 +1,7 @@ +const merge = require('webpack-merge') +const common = require('./webpack.common.js') + +module.exports = merge(common, { + mode: 'production', + devtool: '#source-map' +}) From 7f6cde15d4c3761a6a49bb1f6b898dd596c8c5d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Sat, 24 Nov 2018 10:17:49 +0100 Subject: [PATCH 002/334] Use vue template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Controller/PageController.php | 2 +- templates/vue.php | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 templates/vue.php diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index e457c154f..76f3dc542 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -66,7 +66,7 @@ class PageController extends Controller { $this->defaultBoardService->createDefaultBoard($this->l10n->t('Personal'), $this->userId, '000000'); } - return new TemplateResponse('deck', 'main', $params); + return new TemplateResponse('deck', 'vue', $params); } } diff --git a/templates/vue.php b/templates/vue.php new file mode 100644 index 000000000..c293f74e2 --- /dev/null +++ b/templates/vue.php @@ -0,0 +1,27 @@ + + * + * @author Julius Härtl + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +style('deck', 'style'); +script('deck', 'deck'); +?> + + \ No newline at end of file From 0a50467db0eae864bfc25c83907fdacf7af7bc1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Sat, 24 Nov 2018 10:23:30 +0100 Subject: [PATCH 003/334] Update drone for vue build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .drone.yml | 9 +++++---- run-eslint.sh | 19 ------------------- 2 files changed, 5 insertions(+), 23 deletions(-) delete mode 100755 run-eslint.sh diff --git a/.drone.yml b/.drone.yml index 17215f715..122ed29d0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -219,15 +219,16 @@ pipeline: eslint: image: nextcloudci/eslint:eslint-1 commands: - - ./run-eslint.sh + - npm install + - npm run lint when: matrix: TESTS: eslint jsbuild: - image: mhart/alpine-node:6.8.0 + image: node:11-alpine commands: - - apk add --no-cache make - - make build-js + - npm install + - npm run build when: matrix: TESTS: jsbuild diff --git a/run-eslint.sh b/run-eslint.sh deleted file mode 100755 index 18f757737..000000000 --- a/run-eslint.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -set -e - -ESLINT=$(which eslint || true) -if [ -z "$ESLINT" ]; then - echo "Can't find command \"eslint\" in $PATH" - exit 1 -fi - -echo Checking scripts with $ESLINT ... -find -name "*.js" -path '*js/*' -not -path '*js/node_modules*' \ - -not -path '*l10n/*' \ - -not -path '*js/vendor*' \ - -not -path '*js/tests*' \ - -not -path '*js/webpack*' \ - -not -path '*js/public*' \ - -not -path '*build/*' \ - -not -path '*tests/*' \ - -print0 | xargs -0 $ESLINT From c5179ac62f7b83f813f9fc5e73015830bf835a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Sat, 24 Nov 2018 10:56:55 +0100 Subject: [PATCH 004/334] Build branch on CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 122ed29d0..d45d222e5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -217,7 +217,7 @@ pipeline: matrix: TESTS: integration eslint: - image: nextcloudci/eslint:eslint-1 + image: node:11-alpine commands: - npm install - npm run lint @@ -249,6 +249,6 @@ matrix: - TESTS: jsbuild #- TESTS: integration -branches: [ master, stable* ] +branches: [ master, stable*, vue ] From 921cfdfc4ad004417eaaa6b19c2e4ba79c0e2d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Sun, 25 Nov 2018 13:27:41 +0100 Subject: [PATCH 005/334] Bump dependencies --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 0b3cfcc47..d04a05e95 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@babel/plugin-syntax-dynamic-import": "^7.0.0", "@babel/preset-env": "^7.1.0", "@vue/test-utils": "^1.0.0-beta.25", - "babel-eslint": "^8.2.5", + "babel-eslint": "^10.0.1", "babel-jest": "^23.6.0", "babel-loader": "^8.0.4", "css-loader": "^0.28.11", @@ -58,12 +58,12 @@ "eslint-friendly-formatter": "^4.0.1", "eslint-loader": "^2.1.1", "eslint-plugin-import": "^2.13.0", - "eslint-plugin-node": "^7.0.1", - "eslint-plugin-promise": "^3.8.0", + "eslint-plugin-node": "^8.0.0", + "eslint-plugin-promise": "^4.0.1", "eslint-plugin-standard": "^3.1.0", "eslint-plugin-vue": "^4.5.0", "extract-text-webpack-plugin": "^3.0.2", - "file-loader": "^1.1.11", + "file-loader": "^2.0.0", "jest": "^23.6.0", "jest-serializer-vue": "^2.0.2", "mini-css-extract-plugin": "^0.4.4", @@ -72,7 +72,7 @@ "stylelint": "^8.4.0", "stylelint-config-recommended-scss": "^3.2.0", "stylelint-webpack-plugin": "^0.10.5", - "vue-jest": "^2.6.0", + "vue-jest": "^3.0.0", "vue-loader": "^15.4.2", "vue-style-loader": "^4.1.1", "vue-template-compiler": "^2.5.16", From 6783962cd8f8ee39a26d7524fbadaa814f90ca9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Sun, 25 Nov 2018 13:31:55 +0100 Subject: [PATCH 006/334] Move template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Controller/PageController.php | 2 +- templates/main.php | 79 ++++++------------------------- templates/vue.php | 27 ----------- 3 files changed, 15 insertions(+), 93 deletions(-) delete mode 100644 templates/vue.php diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 76f3dc542..e457c154f 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -66,7 +66,7 @@ class PageController extends Controller { $this->defaultBoardService->createDefaultBoard($this->l10n->t('Personal'), $this->userId, '000000'); } - return new TemplateResponse('deck', 'vue', $params); + return new TemplateResponse('deck', 'main', $params); } } diff --git a/templates/main.php b/templates/main.php index 73cb8271e..c293f74e2 100644 --- a/templates/main.php +++ b/templates/main.php @@ -1,78 +1,27 @@ + * @copyright Copyright (c) 2018 Julius Härtl * * @author Julius Härtl * * @license GNU AGPL version 3 or any later version * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . * */ - -use OCP\Util; - -Util::addScript('activity', 'richObjectStringParser'); -if (\OC_Util::getVersion()[0] > 14) { - Util::addScript('activity', 'templates'); -} - -Util::addStyle('activity', 'style'); -Util::addStyle('comments', 'comments'); -Util::addScript('oc-backbone-webdav'); - -Util::addStyle('deck', '../js/build/vendor'); -Util::addScript('deck', 'build/vendor'); - -Util::addStyle('deck', 'style'); -Util::addScript('deck', 'build/deck'); - -if (\OC_Util::getVersion()[0] < 14) { - Util::addStyle('deck', 'comp-13'); -} +style('deck', 'style'); +script('deck', 'deck'); ?> -
- -
- inc('part.navigation')); ?> - inc('part.settings')); */ ?> -
-
-
- - - - - - - - -
+ \ No newline at end of file diff --git a/templates/vue.php b/templates/vue.php deleted file mode 100644 index c293f74e2..000000000 --- a/templates/vue.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * @author Julius Härtl - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ -style('deck', 'style'); -script('deck', 'deck'); -?> - - \ No newline at end of file From 4ef6045ee581d00d2a2138faa9ac3f7964b56982 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 26 Nov 2018 02:29:41 +0000 Subject: [PATCH 007/334] Update css-loader requirement from ^0.28.11 to ^1.0.1 Updates the requirements on [css-loader](https://github.com/webpack-contrib/css-loader) to permit the latest version. - [Release notes](https://github.com/webpack-contrib/css-loader/releases) - [Changelog](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md) - [Commits](https://github.com/webpack-contrib/css-loader/commits/v1.0.1) Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d04a05e95..c53ed9d97 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "babel-eslint": "^10.0.1", "babel-jest": "^23.6.0", "babel-loader": "^8.0.4", - "css-loader": "^0.28.11", + "css-loader": "^1.0.1", "eslint": "^4.19.1", "eslint-config-standard": "^11.0.0", "eslint-friendly-formatter": "^4.0.1", From c121a936efc6986be6d986de03a074376d6b8a03 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Sun, 2 Dec 2018 11:02:25 +0100 Subject: [PATCH 008/334] Adds sass style support for vue --- package.json | 2 ++ webpack.common.js | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/package.json b/package.json index c53ed9d97..42d07c383 100644 --- a/package.json +++ b/package.json @@ -67,8 +67,10 @@ "jest": "^23.6.0", "jest-serializer-vue": "^2.0.2", "mini-css-extract-plugin": "^0.4.4", + "node-sass": "^4.10.0", "prettier-eslint": "^8.8.2", "raw-loader": "^0.5.1", + "sass-loader": "^7.1.0", "stylelint": "^8.4.0", "stylelint-config-recommended-scss": "^3.2.0", "stylelint-webpack-plugin": "^0.10.5", diff --git a/webpack.common.js b/webpack.common.js index 407715ca6..56160fb55 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -14,6 +14,14 @@ module.exports = { test: /\.css$/, use: ['vue-style-loader', 'css-loader'] }, + { + test: /\.scss$/, + use: [ + 'vue-style-loader', + 'css-loader', + 'sass-loader' + ] + }, { test: /\.vue$/, loader: 'vue-loader' From 37ce80b085d8fd3f37cfe8a68cb4e889c18bc81c Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Sun, 2 Dec 2018 11:02:36 +0100 Subject: [PATCH 009/334] Adds the package lock file to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 46cafbc9c..023392376 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ tests/integration/vendor/ tests/integration/composer.lock vendor/ *.lock +package-lock.json From 6ae42b10070064d49193dadc8e8b8eef493ea1c5 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Sun, 2 Dec 2018 11:02:52 +0100 Subject: [PATCH 010/334] Extends the nextcloud version range --- appinfo/info.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index a86a57867..ebff8ee05 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -36,7 +36,7 @@ pgsql sqlite mysql - + OCA\Deck\Cron\DeleteCron From 18b03550ccf81c9684a2eef03129b3c2950e4206 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Sun, 2 Dec 2018 12:24:55 +0100 Subject: [PATCH 011/334] Restructures the app main, nav and sidebar --- src/App.vue | 70 ++++++++++++- src/{views => components}/Board.vue | 0 src/components/Controls.vue | 44 +++++++++ src/{views => components}/List.vue | 0 src/components/Main.vue | 36 +++++++ src/{views => components}/Sidebar.vue | 2 +- src/router.js | 2 +- src/store/main.js | 13 ++- src/store/modules/nav.js | 135 ++++++++++++++++++++++++++ src/store/modules/sidebar.js | 53 ++++++++++ src/views/Main.vue | 130 ------------------------- 11 files changed, 348 insertions(+), 137 deletions(-) rename src/{views => components}/Board.vue (100%) create mode 100644 src/components/Controls.vue rename src/{views => components}/List.vue (100%) create mode 100644 src/components/Main.vue rename src/{views => components}/Sidebar.vue (97%) create mode 100644 src/store/modules/nav.js create mode 100644 src/store/modules/sidebar.js delete mode 100644 src/views/Main.vue diff --git a/src/App.vue b/src/App.vue index 8fcbaa2f0..35adf283c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -21,11 +21,77 @@ --> + + diff --git a/src/views/Board.vue b/src/components/Board.vue similarity index 100% rename from src/views/Board.vue rename to src/components/Board.vue diff --git a/src/components/Controls.vue b/src/components/Controls.vue new file mode 100644 index 000000000..d28393726 --- /dev/null +++ b/src/components/Controls.vue @@ -0,0 +1,44 @@ + + + + + + + diff --git a/src/views/List.vue b/src/components/List.vue similarity index 100% rename from src/views/List.vue rename to src/components/List.vue diff --git a/src/components/Main.vue b/src/components/Main.vue new file mode 100644 index 000000000..0b0221e96 --- /dev/null +++ b/src/components/Main.vue @@ -0,0 +1,36 @@ + + + + + + + diff --git a/src/views/Sidebar.vue b/src/components/Sidebar.vue similarity index 97% rename from src/views/Sidebar.vue rename to src/components/Sidebar.vue index a63cb70ad..84d27fb76 100644 --- a/src/views/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -21,7 +21,7 @@ --> From 411cab1d45c24b54c3d8a319f93800a3f3d21f90 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Mon, 3 Dec 2018 22:40:39 +0100 Subject: [PATCH 012/334] Happifies eslint and adds an editorconfig --- .editorconfig | 9 ++ src/App.vue | 68 +++++++-------- src/components/Controls.vue | 18 ++-- src/components/Main.vue | 6 +- src/store/main.js | 14 +-- src/store/modules/nav.js | 163 ++++++++++++++++++----------------- src/store/modules/sidebar.js | 27 +++--- 7 files changed, 159 insertions(+), 146 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..d1ab2f62d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true + +[*.{js,vue}] +indent_style = tab diff --git a/src/App.vue b/src/App.vue index 35adf283c..8b4bb3e9e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -22,18 +22,18 @@ @@ -49,13 +49,13 @@ export default { components: { AppNavigation, Controls, - Sidebar + Sidebar }, computed: mapState({ navHidden: state => state.nav.hidden, sidebarHidden: state => state.sidebar.hidden, menu: state => state.nav.menu, - sidebarComponent: state => state.sidebar.component + sidebarComponent: state => state.sidebar.component }) } @@ -63,35 +63,35 @@ export default { diff --git a/src/components/Controls.vue b/src/components/Controls.vue index d28393726..2c4aa6d2a 100644 --- a/src/components/Controls.vue +++ b/src/components/Controls.vue @@ -22,20 +22,20 @@ diff --git a/src/components/Main.vue b/src/components/Main.vue index 0b0221e96..a50d96fe2 100644 --- a/src/components/Main.vue +++ b/src/components/Main.vue @@ -21,9 +21,9 @@ --> diff --git a/src/store/modules/nav.js b/src/store/modules/nav.js index 9f7e17533..e86b1790e 100644 --- a/src/store/modules/nav.js +++ b/src/store/modules/nav.js @@ -20,10 +20,29 @@ * */ -// nav stuff -// todo maybe move out of nav.js directly and import here - import { translate as t } from 'nextcloud-server/dist/l10n' +import axios from 'nextcloud-axios' + +/** + * Maps an API board to a menu item. + * @param board + * @returns {{id: *, classes: Array, bullet: string, text: *, router: {name: string, params: {id: *}}, utils: {actions: *[]}}} + */ +const mapBoardToItem = board => { + return { + id: board.id, + classes: [], + bullet: `#${board.color}`, + text: board.title, + router: { + name: 'board', + params: { id: board.id } + }, + utils: { + actions: boardActions + } + } +} let defaultCategories = [ { @@ -82,22 +101,6 @@ const boardActions = [ } ] -const boards = [ - { - id: 'deck-board-1', - classes: [], - bullet: '#00cc00', - text: 'Example board', - router: { - name: 'board', - params: { id: 1 } - }, - utils: { - actions: boardActions - } - } -] - const addButton = { icon: 'icon-add', text: t('deck', 'Create new board'), @@ -108,19 +111,32 @@ const addButton = { // initial state const state = { hidden: false, - menu: { - items: defaultCategories.concat(boards).concat([addButton]), - loading: false - } + boards: [], + loading: false } // getters -const getters = {} +const getters = { + menu: state => { + return { + loading: state.loading, + items: defaultCategories + .concat(state.boards.map(mapBoardToItem)) + .concat([addButton]) + } + } +} // actions const actions = { toggle({ commit }) { commit('toggle') + }, + loadBoards({ commit }) { + axios.get('/apps/deck/boards') + .then((response) => { + commit('setBoards', response.data) + }) } } @@ -128,6 +144,9 @@ const actions = { const mutations = { toggle(state) { state.hidden = !state.hidden + }, + setBoards(state, boards) { + state.boards = boards } } From 5ea20e1268c6e13187257b9ddb0c8d56bf0cd622 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 4 Dec 2018 00:10:58 +0100 Subject: [PATCH 014/334] Implements board filters --- src/components/{Main.vue => Boards.vue} | 15 +++++++++++++-- src/router.js | 23 +++++++++++++++++++---- src/store/modules/nav.js | 24 ++++++++++++++++++++++-- 3 files changed, 54 insertions(+), 8 deletions(-) rename src/components/{Main.vue => Boards.vue} (84%) diff --git a/src/components/Main.vue b/src/components/Boards.vue similarity index 84% rename from src/components/Main.vue rename to src/components/Boards.vue index a50d96fe2..68f8fe9c9 100644 --- a/src/components/Main.vue +++ b/src/components/Boards.vue @@ -22,13 +22,24 @@ diff --git a/src/router.js b/src/router.js index 0b0847a20..811e02f90 100644 --- a/src/router.js +++ b/src/router.js @@ -23,8 +23,9 @@ import Vue from 'vue' import Router from 'vue-router' import { generateUrl } from 'nextcloud-server/dist/router' +import { BOARD_FILTERS } from './store/modules/nav' -const Main = () => import('./components/Main') +const Boards = () => import('./components/Boards') Vue.use(Router) @@ -35,17 +36,31 @@ export default new Router({ { path: '/', name: 'main', - component: Main + component: Boards }, { path: '/boards', name: 'boards', - component: Main + component: Boards, + props: { + navFilter: BOARD_FILTERS.ALL + } }, { path: '/boards/archived', name: 'boards.archived', - component: Main + component: Boards, + props: { + navFilter: BOARD_FILTERS.ARCHIVED + } + }, + { + path: '/boards/shared', + name: 'boards.shared', + component: Boards, + props: { + navFilter: BOARD_FILTERS.SHARED + } } ] }) diff --git a/src/store/modules/nav.js b/src/store/modules/nav.js index e86b1790e..723e99216 100644 --- a/src/store/modules/nav.js +++ b/src/store/modules/nav.js @@ -20,6 +20,8 @@ * */ +// eslint + import { translate as t } from 'nextcloud-server/dist/l10n' import axios from 'nextcloud-axios' @@ -112,16 +114,31 @@ const addButton = { const state = { hidden: false, boards: [], - loading: false + loading: false, + filter: '' +} + +export const BOARD_FILTERS = { + ALL: '', + ARCHIVED: 'archived', + SHARED: 'shared' } // getters const getters = { menu: state => { + + // filters the boards depending on the active filter + const boards = state.boards.filter(board => { + return state.filter === BOARD_FILTERS.ALL + || (state.filter === BOARD_FILTERS.ARCHIVED && board.archived === true) + || (state.filter === BOARD_FILTERS.SHARED && board.shared === 1) + }) + return { loading: state.loading, items: defaultCategories - .concat(state.boards.map(mapBoardToItem)) + .concat(boards.map(mapBoardToItem)) .concat([addButton]) } } @@ -147,6 +164,9 @@ const mutations = { }, setBoards(state, boards) { state.boards = boards + }, + setFilter(state, filter) { + state.filter = filter } } From a4dbb31b8ccc2c152db9ec4870f3fb7a0ddd7214 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 4 Dec 2018 00:14:44 +0100 Subject: [PATCH 015/334] Adds the board route --- src/components/Board.vue | 10 ++++++++-- src/router.js | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/components/Board.vue b/src/components/Board.vue index d5c974934..1ed32526e 100644 --- a/src/components/Board.vue +++ b/src/components/Board.vue @@ -21,12 +21,18 @@ --> diff --git a/src/router.js b/src/router.js index 811e02f90..c43223aa7 100644 --- a/src/router.js +++ b/src/router.js @@ -24,8 +24,8 @@ import Vue from 'vue' import Router from 'vue-router' import { generateUrl } from 'nextcloud-server/dist/router' import { BOARD_FILTERS } from './store/modules/nav' - -const Boards = () => import('./components/Boards') +import Boards from './components/Boards' +import Board from './components/Board' Vue.use(Router) @@ -61,6 +61,12 @@ export default new Router({ props: { navFilter: BOARD_FILTERS.SHARED } + }, + { + path: '/boards/:id', + name: 'board', + component: Board, + props: true } ] }) From 8c94da81f1cb3b39392a119aed4e2387c26fc0f4 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Wed, 5 Dec 2018 04:56:03 +0100 Subject: [PATCH 016/334] Implements the breadcrumbs home link --- src/components/Controls.vue | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/components/Controls.vue b/src/components/Controls.vue index 2c4aa6d2a..b7231ba83 100644 --- a/src/components/Controls.vue +++ b/src/components/Controls.vue @@ -1,5 +1,5 @@ - diff --git a/src/components/boards/BoardItem.vue b/src/components/boards/BoardItem.vue new file mode 100644 index 000000000..3f8cdf8ae --- /dev/null +++ b/src/components/boards/BoardItem.vue @@ -0,0 +1,75 @@ + + + + + + + diff --git a/src/store/modules/nav.js b/src/store/modules/nav.js index 723e99216..c0dfeadb2 100644 --- a/src/store/modules/nav.js +++ b/src/store/modules/nav.js @@ -36,6 +36,7 @@ const mapBoardToItem = board => { classes: [], bullet: `#${board.color}`, text: board.title, + owner: board.owner, router: { name: 'board', params: { id: board.id } @@ -141,6 +142,16 @@ const getters = { .concat(boards.map(mapBoardToItem)) .concat([addButton]) } + }, + boards: state => { + // filters the boards depending on the active filter + const boards = state.boards.filter(board => { + return state.filter === BOARD_FILTERS.ALL + || (state.filter === BOARD_FILTERS.ARCHIVED && board.archived === true) + || (state.filter === BOARD_FILTERS.SHARED && board.shared === 1) + }) + + return boards.map(mapBoardToItem) } } From 17fcf0cd61ad48e39953ac042c4d86d0cf275974 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 10 Dec 2018 02:21:23 +0000 Subject: [PATCH 018/334] Update mini-css-extract-plugin requirement from ^0.4.4 to ^0.5.0 Updates the requirements on [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) to permit the latest version. - [Release notes](https://github.com/webpack-contrib/mini-css-extract-plugin/releases) - [Changelog](https://github.com/webpack-contrib/mini-css-extract-plugin/blob/master/CHANGELOG.md) - [Commits](https://github.com/webpack-contrib/mini-css-extract-plugin/commits/v0.5.0) Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 42d07c383..4806d8fe2 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "file-loader": "^2.0.0", "jest": "^23.6.0", "jest-serializer-vue": "^2.0.2", - "mini-css-extract-plugin": "^0.4.4", + "mini-css-extract-plugin": "^0.5.0", "node-sass": "^4.10.0", "prettier-eslint": "^8.8.2", "raw-loader": "^0.5.1", From 643d70e6f0b52d0dd1607663fe1fc70a5811baa8 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 11 Dec 2018 14:59:52 +0100 Subject: [PATCH 019/334] Removes filtering of the left side bar boards --- src/store/modules/nav.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/store/modules/nav.js b/src/store/modules/nav.js index c0dfeadb2..503a51734 100644 --- a/src/store/modules/nav.js +++ b/src/store/modules/nav.js @@ -129,17 +129,10 @@ export const BOARD_FILTERS = { const getters = { menu: state => { - // filters the boards depending on the active filter - const boards = state.boards.filter(board => { - return state.filter === BOARD_FILTERS.ALL - || (state.filter === BOARD_FILTERS.ARCHIVED && board.archived === true) - || (state.filter === BOARD_FILTERS.SHARED && board.shared === 1) - }) - return { loading: state.loading, items: defaultCategories - .concat(boards.map(mapBoardToItem)) + .concat(state.boards.map(mapBoardToItem)) .concat([addButton]) } }, From 6b2873ab28282d8cae269a26ac5e974f669a056b Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 11 Dec 2018 15:42:25 +0100 Subject: [PATCH 020/334] Moves boards into their own state --- src/App.vue | 2 +- src/components/Boards.vue | 8 +-- src/router.js | 2 +- src/store/main.js | 2 + src/store/modules/boards.js | 128 +++++++++++++++++++++++++++++++++++ src/store/modules/nav.js | 95 ++------------------------ src/store/modules/sidebar.js | 2 +- 7 files changed, 142 insertions(+), 97 deletions(-) create mode 100644 src/store/modules/boards.js diff --git a/src/App.vue b/src/App.vue index 179e92354..0694f9056 100644 --- a/src/App.vue +++ b/src/App.vue @@ -62,7 +62,7 @@ export default { }) }, created: function() { - this.$store.dispatch('nav/loadBoards') + this.$store.dispatch('boards/loadBoards') } } diff --git a/src/components/Boards.vue b/src/components/Boards.vue index 0816702be..c31cebc48 100644 --- a/src/components/Boards.vue +++ b/src/components/Boards.vue @@ -28,7 +28,7 @@
Members
- + @@ -49,13 +49,13 @@ export default { } }, computed: { - ...mapGetters('nav', [ - 'boards' + ...mapGetters('boards', [ + 'filteredBoards' ]) }, watch: { navFilter: function(value) { - this.$store.commit('nav/setFilter', value) + this.$store.commit('boards/setFilter', value) } } } diff --git a/src/router.js b/src/router.js index c43223aa7..eda0f751b 100644 --- a/src/router.js +++ b/src/router.js @@ -23,7 +23,7 @@ import Vue from 'vue' import Router from 'vue-router' import { generateUrl } from 'nextcloud-server/dist/router' -import { BOARD_FILTERS } from './store/modules/nav' +import { BOARD_FILTERS } from './store/modules/boards' import Boards from './components/Boards' import Board from './components/Board' diff --git a/src/store/main.js b/src/store/main.js index aa619c5db..35bbe8914 100644 --- a/src/store/main.js +++ b/src/store/main.js @@ -22,6 +22,7 @@ import Vue from 'vue' import Vuex from 'vuex' +import boards from './modules/boards' import nav from './modules/nav' import sidebar from './modules/sidebar' @@ -31,6 +32,7 @@ const debug = process.env.NODE_ENV !== 'production' export default new Vuex.Store({ modules: { + boards, nav, sidebar }, diff --git a/src/store/modules/boards.js b/src/store/modules/boards.js new file mode 100644 index 000000000..52673008d --- /dev/null +++ b/src/store/modules/boards.js @@ -0,0 +1,128 @@ +/* + * @copyright Copyright (c) 2018 Michael Weimann + * + * @author Michael Weimann + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +import axios from 'nextcloud-axios' + +const boardActions = [ + { + action: () => { + }, + icon: 'icon-edit', + text: t('deck', 'Edit board') + }, + { + action: () => { + }, + icon: 'icon-archive', + text: t('deck', 'Archive board') + }, + { + action: () => { + }, + icon: 'icon-delete', + text: t('deck', 'Delete board') + }, + { + action: () => { + }, + icon: 'icon-settings', + text: t('deck', 'Board details') + } +] + +export const BOARD_FILTERS = { + ALL: '', + ARCHIVED: 'archived', + SHARED: 'shared' +} + +/** + * Maps an API board to a menu item. + * @param board + * @returns {{id: *, classes: Array, bullet: string, text: *, router: {name: string, params: {id: *}}, utils: {actions: *[]}}} + */ +export const mapBoardToItem = board => { + return { + id: board.id, + classes: [], + bullet: `#${board.color}`, + text: board.title, + owner: board.owner, + router: { + name: 'board', + params: { id: board.id } + }, + utils: { + actions: boardActions + } + } +} + +const state = { + boards: [], + loading: false, + filter: '' +} + +const getters = { + filteredBoards: state => { + // filters the boards depending on the active filter + const boards = state.boards.filter(board => { + return state.filter === BOARD_FILTERS.ALL + || (state.filter === BOARD_FILTERS.ARCHIVED && board.archived === true) + || (state.filter === BOARD_FILTERS.SHARED && board.shared === 1) + }) + return boards.map(mapBoardToItem) + } +} + +const actions = { + toggle({ commit }) { + commit('toggle') + }, + loadBoards({ commit }) { + axios.get('/apps/deck/boards') + .then((response) => { + commit('setBoards', response.data) + }) + } +} + +const mutations = { + toggle(state) { + state.hidden = !state.hidden + }, + setBoards(state, boards) { + state.boards = boards + }, + setFilter(state, filter) { + state.filter = filter + } +} + +export default { + namespaced: true, + state, + getters, + actions, + mutations +} diff --git a/src/store/modules/nav.js b/src/store/modules/nav.js index 503a51734..dc54155f2 100644 --- a/src/store/modules/nav.js +++ b/src/store/modules/nav.js @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2018 Julius Härtl + * @copyright Copyright (c) 2018 Michael Weimann * * @author Michael Weimann * @@ -20,32 +20,8 @@ * */ -// eslint - import { translate as t } from 'nextcloud-server/dist/l10n' -import axios from 'nextcloud-axios' - -/** - * Maps an API board to a menu item. - * @param board - * @returns {{id: *, classes: Array, bullet: string, text: *, router: {name: string, params: {id: *}}, utils: {actions: *[]}}} - */ -const mapBoardToItem = board => { - return { - id: board.id, - classes: [], - bullet: `#${board.color}`, - text: board.title, - owner: board.owner, - router: { - name: 'board', - params: { id: board.id } - }, - utils: { - actions: boardActions - } - } -} +import { mapBoardToItem } from './boards' let defaultCategories = [ { @@ -77,33 +53,6 @@ let defaultCategories = [ } ] -const boardActions = [ - { - action: () => { - }, - icon: 'icon-edit', - text: t('deck', 'Edit board') - }, - { - action: () => { - }, - icon: 'icon-archive', - text: t('deck', 'Archive board') - }, - { - action: () => { - }, - icon: 'icon-delete', - text: t('deck', 'Delete board') - }, - { - action: () => { - }, - icon: 'icon-settings', - text: t('deck', 'Board details') - } -] - const addButton = { icon: 'icon-add', text: t('deck', 'Create new board'), @@ -111,53 +60,25 @@ const addButton = { } } -// initial state const state = { hidden: false, - boards: [], - loading: false, - filter: '' + loading: false } -export const BOARD_FILTERS = { - ALL: '', - ARCHIVED: 'archived', - SHARED: 'shared' -} - -// getters const getters = { - menu: state => { - + menu: (state, getters, rootState) => { return { loading: state.loading, items: defaultCategories - .concat(state.boards.map(mapBoardToItem)) + .concat(rootState.boards.boards.map(mapBoardToItem)) .concat([addButton]) } - }, - boards: state => { - // filters the boards depending on the active filter - const boards = state.boards.filter(board => { - return state.filter === BOARD_FILTERS.ALL - || (state.filter === BOARD_FILTERS.ARCHIVED && board.archived === true) - || (state.filter === BOARD_FILTERS.SHARED && board.shared === 1) - }) - - return boards.map(mapBoardToItem) } } -// actions const actions = { toggle({ commit }) { commit('toggle') - }, - loadBoards({ commit }) { - axios.get('/apps/deck/boards') - .then((response) => { - commit('setBoards', response.data) - }) } } @@ -165,12 +86,6 @@ const actions = { const mutations = { toggle(state) { state.hidden = !state.hidden - }, - setBoards(state, boards) { - state.boards = boards - }, - setFilter(state, filter) { - state.filter = filter } } diff --git a/src/store/modules/sidebar.js b/src/store/modules/sidebar.js index f282c3359..9817fd894 100644 --- a/src/store/modules/sidebar.js +++ b/src/store/modules/sidebar.js @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2018 Julius Härtl + * @copyright Copyright (c) 2018 Michael Weimann * * @author Michael Weimann * From 2649309e57d8553df21be89a33e303d33c11c0c6 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 11 Dec 2018 16:58:42 +0100 Subject: [PATCH 021/334] WiP implements the add board action --- src/store/modules/nav.js | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/store/modules/nav.js b/src/store/modules/nav.js index dc54155f2..2ce90d478 100644 --- a/src/store/modules/nav.js +++ b/src/store/modules/nav.js @@ -22,6 +22,7 @@ import { translate as t } from 'nextcloud-server/dist/l10n' import { mapBoardToItem } from './boards' +import store from '../main' let defaultCategories = [ { @@ -53,16 +54,24 @@ let defaultCategories = [ } ] -const addButton = { - icon: 'icon-add', - text: t('deck', 'Create new board'), - action: () => { - } -} - const state = { hidden: false, - loading: false + loading: false, + addButton: { + icon: 'icon-add', + classes: [], + text: t('deck', 'Create new board'), + edit: { + text: t('deck', 'new board'), + action: () => { + }, + reset: () => { + } + }, + action: () => { + store.dispatch('nav/startAddBoard') + } + } } const getters = { @@ -71,7 +80,7 @@ const getters = { loading: state.loading, items: defaultCategories .concat(rootState.boards.boards.map(mapBoardToItem)) - .concat([addButton]) + .concat([state.addButton]) } } } @@ -79,6 +88,9 @@ const getters = { const actions = { toggle({ commit }) { commit('toggle') + }, + startAddBoard({ commit }) { + commit('startAddBoard') } } @@ -86,6 +98,9 @@ const actions = { const mutations = { toggle(state) { state.hidden = !state.hidden + }, + startAddBoard(state) { + state.addButton.classes.push('editing') } } From 6a3643384c2cb5c013baf49595ca140841491810 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 11 Dec 2018 19:46:36 +0100 Subject: [PATCH 022/334] State refactoring, adds a sidebar example, extends the breadcrumb navigation, introduces an API class --- src/App.vue | 64 ++++++---- src/components/Controls.vue | 13 +- src/components/DeckAppNav.vue | 102 ++++++++++++++++ .../{Sidebar.vue => board/Board.vue} | 48 +++++++- .../{Board.vue => board/BoardSidebar.vue} | 14 ++- src/components/{ => boards}/Boards.vue | 27 +++-- .../boards.js => helpers/boardToMenuItem.js} | 60 +--------- src/router.js | 12 +- .../sidebar.js => services/BoardApi.js} | 59 +++++---- src/store/main.js | 74 ++++++++++-- src/store/modules/nav.js | 113 ------------------ 11 files changed, 336 insertions(+), 250 deletions(-) create mode 100644 src/components/DeckAppNav.vue rename src/components/{Sidebar.vue => board/Board.vue} (55%) rename src/components/{Board.vue => board/BoardSidebar.vue} (87%) rename src/components/{ => boards}/Boards.vue (75%) rename src/{store/modules/boards.js => helpers/boardToMenuItem.js} (60%) rename src/{store/modules/sidebar.js => services/BoardApi.js} (54%) delete mode 100644 src/store/modules/nav.js diff --git a/src/App.vue b/src/App.vue index 0694f9056..c62fa66d3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -22,16 +22,13 @@ @@ -52,6 +55,9 @@ export default { methods: { toggleNav() { this.$store.dispatch('toggleNav') + }, + toggleSidebar: function() { + this.$store.dispatch('toggleSidebar') } } } @@ -67,4 +73,14 @@ export default { position: static; } + .board-actions { + flex-grow: 1; + order: 100; + display: flex; + justify-content: flex-end; + } + button.icon-settings { + width: 44px; + } + diff --git a/src/components/board/Board.vue b/src/components/board/Board.vue index 02bdaa39e..55e1161a8 100644 --- a/src/components/board/Board.vue +++ b/src/components/board/Board.vue @@ -24,7 +24,6 @@
- board {{ board.title }}
@@ -104,7 +103,7 @@ export default { board: state => state.currentBoard }), orderedCards() { - //return (stack) => _.orderBy(this.stacks[stack].cards, 'order') + // return (stack) => _.orderBy(this.stacks[stack].cards, 'order') } }, diff --git a/src/components/board/BoardSidebar.vue b/src/components/board/BoardSidebar.vue index f485105eb..4bb4ff9cf 100644 --- a/src/components/board/BoardSidebar.vue +++ b/src/components/board/BoardSidebar.vue @@ -23,9 +23,6 @@ diff --git a/src/components/board/Board.vue b/src/components/board/Board.vue index bc8c9e4c6..944eaf2ff 100644 --- a/src/components/board/Board.vue +++ b/src/components/board/Board.vue @@ -34,7 +34,7 @@
- + Add card
@@ -53,7 +53,7 @@ + From f04225a33a21fa79da0dc662265b335373e76a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 25 Apr 2019 21:41:06 +0200 Subject: [PATCH 069/334] Fix edit icon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/components/navigation/AppNavigationBoard.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/navigation/AppNavigationBoard.vue b/src/components/navigation/AppNavigationBoard.vue index 3c62b3b49..ab2d0f8fb 100644 --- a/src/components/navigation/AppNavigationBoard.vue +++ b/src/components/navigation/AppNavigationBoard.vue @@ -115,7 +115,7 @@ export default { this.editTitle = this.board.title this.editing = true }, - icon: 'icon-edit', + icon: 'icon-rename', text: t('deck', 'Edit board') }) @@ -160,8 +160,8 @@ export default { actions.push({ action: () => { - const route = this.routeTo; - route.name = 'board.details'; + const route = this.routeTo + route.name = 'board.details' this.$router.push(route) }, icon: 'icon-settings-dark', From 47f9b6cfc3c05fdfbfbbb2237ef940c35e58119d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 25 Apr 2019 21:50:40 +0200 Subject: [PATCH 070/334] Add navigation to start screen board list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/components/boards/BoardItem.vue | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/components/boards/BoardItem.vue b/src/components/boards/BoardItem.vue index 3f8cdf8ae..3ca504512 100644 --- a/src/components/boards/BoardItem.vue +++ b/src/components/boards/BoardItem.vue @@ -21,26 +21,41 @@ --> From 29c63288bf8e0d65d2af3a9e0b2d5d52a0f0b64a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 25 Apr 2019 21:51:39 +0200 Subject: [PATCH 071/334] Add loading icon to group selector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/components/boards/BoardItem.vue | 6 +++--- src/components/navigation/AppNavigation.vue | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/boards/BoardItem.vue b/src/components/boards/BoardItem.vue index 3ca504512..86707515f 100644 --- a/src/components/boards/BoardItem.vue +++ b/src/components/boards/BoardItem.vue @@ -21,9 +21,9 @@ --> - From 74eb57947487576f8de200aa31b03f1f2f35186f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 26 Apr 2019 09:56:17 +0200 Subject: [PATCH 075/334] Add color picker to board edit mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/components/ColorPicker.vue | 14 ++++++++++++-- src/components/navigation/AppNavigationBoard.vue | 10 ++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/components/ColorPicker.vue b/src/components/ColorPicker.vue index 6e5f441a2..0d6a6705f 100644 --- a/src/components/ColorPicker.vue +++ b/src/components/ColorPicker.vue @@ -74,6 +74,7 @@ export default { display: block !important; overflow: hidden; border-radius: 3px; + margin-bottom: 10px; } diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index cf0b3bf9c..497d0db33 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -21,7 +21,9 @@ --> - From f51d0b67166ccbe9982838263c5a2cb92ad67eae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 26 Apr 2019 15:35:06 +0200 Subject: [PATCH 080/334] Fix card styling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/components/board/Board.vue | 18 ++++++- src/components/cards/CardBadges.vue | 44 +++++++++++---- src/components/cards/CardItem.vue | 54 +++++++++++++++---- .../navigation/AppNavigationAddBoard.vue | 1 + 4 files changed, 95 insertions(+), 22 deletions(-) diff --git a/src/components/board/Board.vue b/src/components/board/Board.vue index 944eaf2ff..8f5d11cd5 100644 --- a/src/components/board/Board.vue +++ b/src/components/board/Board.vue @@ -23,7 +23,7 @@