Start update process for Vue 3

This commit is contained in:
Ramon Wenger 2021-12-13 20:54:09 +01:00
parent 92c34ca80d
commit bdb06be67c
17 changed files with 2901 additions and 2715 deletions

View File

@ -43,7 +43,18 @@ module.exports = {
'@': resolve('src'), '@': resolve('src'),
styles: resolve('src/styles'), styles: resolve('src/styles'),
gql: resolve('src/graphql/gql'), gql: resolve('src/graphql/gql'),
vue: '@vue/compat',
}, },
// we probably don't need this anymore
// fallback: {
// // used to be in node: {setImmediate: false,...}
// setImmediate: false,
// dgram: false,
// fs: false,
// net: false,
// tls: false,
// child_process: false,
// },
}, },
module: { module: {
rules: [ rules: [
@ -58,6 +69,11 @@ module.exports = {
img: 'src', img: 'src',
image: 'xlink:href', image: 'xlink:href',
}, },
compilerOptions: {
compatConfig: {
MODE: 2,
},
},
}, },
}, },
{ {
@ -112,16 +128,17 @@ module.exports = {
plugins: [ plugins: [
new VueLoaderPlugin(), new VueLoaderPlugin(),
], ],
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue // node: {
// source contains it (although only uses it if it's native). // // prevent webpack from injecting useless setImmediate polyfill because Vue
setImmediate: false, // // source contains it (although only uses it if it's native).
// prevent webpack from injecting mocks to Node native modules // setImmediate: false,
// that does not make sense for the client // // prevent webpack from injecting mocks to Node native modules
dgram: 'empty', // // that does not make sense for the client
fs: 'empty', // dgram: 'empty',
net: 'empty', // fs: 'empty',
tls: 'empty', // net: 'empty',
child_process: 'empty', // tls: 'empty',
}, // child_process: 'empty',
// },
}; };

View File

@ -1,93 +1,94 @@
'use strict' 'use strict';
const utils = require('./utils') const utils = require('./utils');
const webpack = require('webpack') const webpack = require('webpack');
const config = require('../config') const config = require('../config');
const merge = require('webpack-merge') const path = require('path');
const path = require('path') const baseWebpackConfig = require('./webpack.base.conf');
const baseWebpackConfig = require('./webpack.base.conf') const CopyPlugin = require('copy-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin') const portfinder = require('portfinder');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') const {merge} = require('webpack-merge');
const portfinder = require('portfinder')
const HOST = process.env.HOST const HOST = process.env.HOST;
const PORT = process.env.PORT && Number(process.env.PORT) const PORT = process.env.PORT && Number(process.env.PORT);
const devWebpackConfig = merge(baseWebpackConfig, { const devWebpackConfig = merge(baseWebpackConfig, {
// cheap-module-eval-source-map is faster for development // cheap-module-eval-source-map is faster for development
devtool: config.dev.devtool, devtool: config.dev.devtool,
mode: 'development',
// these devServer options should be customized in /config/index.js // these devServer options should be customized in /config/index.js
devServer: { devServer: {
clientLogLevel: 'warning', client: {
logging: 'warn',
overlay: config.dev.errorOverlay,
progress: true,
},
historyApiFallback: { historyApiFallback: {
rewrites: [ rewrites: [
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, {from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html')},
], ],
}, },
hot: true, hot: true,
contentBase: false, // since we use CopyWebpackPlugin.
compress: true, compress: true,
host: HOST || config.dev.host, host: HOST || config.dev.host,
port: PORT || config.dev.port, port: PORT || config.dev.port,
open: config.dev.autoOpenBrowser, open: config.dev.autoOpenBrowser,
overlay: config.dev.errorOverlay // publicPath: config.dev.assetsPublicPath,
? { warnings: false, errors: true }
: false,
publicPath: config.dev.assetsPublicPath,
proxy: config.dev.proxyTable, proxy: config.dev.proxyTable,
quiet: true, // necessary for FriendlyErrorsPlugin // quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
poll: config.dev.poll,
}
}, },
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': require('../config/dev.env') 'process.env': require('../config/dev.env'),
}), }),
new webpack.HotModuleReplacementPlugin(), new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin // https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
filename: 'index.html', filename: 'index.html',
template: 'index.html', template: 'index.html',
inject: true, inject: true,
...require('../config/dev.env') ...require('../config/dev.env'),
}), }),
// copy custom static assets // copy custom static assets
new CopyWebpackPlugin([ new CopyPlugin({
patterns: [
{ {
from: path.resolve(__dirname, '../static'), from: path.resolve(__dirname, '../static'),
to: config.dev.assetsSubDirectory, to: config.dev.assetsSubDirectory,
ignore: ['.*'] globOptions: {
} ignore: ['.*'],
]) },
] },
}) ],
}),
],
});
module.exports = new Promise((resolve, reject) => { module.exports = new Promise((resolve, reject) => {
portfinder.basePort = process.env.PORT || config.dev.port portfinder.basePort = process.env.PORT || config.dev.port;
portfinder.getPort((err, port) => { portfinder.getPort((err, port) => {
if (err) { if (err) {
reject(err) reject(err);
} else { } else {
// publish the new Port, necessary for e2e tests // publish the new Port, necessary for e2e tests
process.env.PORT = port process.env.PORT = port;
// add port to devServer config // add port to devServer config
devWebpackConfig.devServer.port = port devWebpackConfig.devServer.port = port;
// Add FriendlyErrorsPlugin // Add FriendlyErrorsPlugin
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ // todo: seems to not be maintained anymore, disable for now
compilationSuccessInfo: { // devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], // compilationSuccessInfo: {
}, // messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
onErrors: config.dev.notifyOnErrors // },
? utils.createNotifierCallback() // onErrors: config.dev.notifyOnErrors
: undefined // ? utils.createNotifierCallback()
})) // : undefined,
// }));
resolve(devWebpackConfig) resolve(devWebpackConfig);
} }
}) });
}) });

View File

@ -9,12 +9,12 @@ const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin') const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const env = require('../config/prod.env') const env = require('../config/prod.env')
const webpackConfig = merge(baseWebpackConfig, { const webpackConfig = merge(baseWebpackConfig, {
devtool: config.build.productionSourceMap ? config.build.devtool : false, devtool: config.build.productionSourceMap ? config.build.devtool : false,
mode: 'production',
output: { output: {
path: config.build.assetsRoot, path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'), filename: utils.assetsPath('js/[name].[chunkhash].js'),
@ -25,15 +25,6 @@ const webpackConfig = merge(baseWebpackConfig, {
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': env 'process.env': env
}), }),
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
}),
// extract css into its own file // extract css into its own file
new ExtractTextPlugin({ new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css'), filename: utils.assetsPath('css/[name].[contenthash].css'),
@ -70,37 +61,37 @@ const webpackConfig = merge(baseWebpackConfig, {
}), }),
// keep module.id stable when vendor modules does not change // keep module.id stable when vendor modules does not change
new webpack.HashedModuleIdsPlugin(), new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
// split vendor js into its own file // split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({ // todo: https://gist.github.com/sokra/1522d586b8e5c0f5072d7565c2bee693
name: 'vendor', // todo: do we need this? probably default is fine
minChunks (module) { // new webpack.optimize.CommonsChunkPlugin({
// any required modules inside node_modules are extracted to vendor // name: 'vendor',
return ( // minChunks (module) {
module.resource && // // any required modules inside node_modules are extracted to vendor
/\.js$/.test(module.resource) && // return (
module.resource.indexOf( // module.resource &&
path.join(__dirname, '../node_modules') // /\.js$/.test(module.resource) &&
) === 0 // module.resource.indexOf(
) // path.join(__dirname, '../node_modules')
} // ) === 0
}), // )
// }
// }),
// extract webpack runtime and module manifest to its own file in order to // extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated // prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({ // new webpack.optimize.CommonsChunkPlugin({
name: 'manifest', // name: 'manifest',
minChunks: Infinity // minChunks: Infinity
}), // }),
// This instance extracts shared chunks from code splitted chunks and bundles them // This instance extracts shared chunks from code splitted chunks and bundles them
// in a separate chunk, similar to the vendor chunk // in a separate chunk, similar to the vendor chunk
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
new webpack.optimize.CommonsChunkPlugin({ // new webpack.optimize.CommonsChunkPlugin({
name: 'app', // name: 'app',
async: 'vendor-async', // async: 'vendor-async',
children: true, // children: true,
minChunks: 3 // minChunks: 3
}), // }),
// copy custom static assets // copy custom static assets
new CopyWebpackPlugin([ new CopyWebpackPlugin([

View File

@ -1,5 +1,5 @@
'use strict' 'use strict'
const merge = require('webpack-merge') const {merge} = require('webpack-merge')
const prodEnv = require('./prod.env') const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, { module.exports = merge(prodEnv, {

View File

@ -33,7 +33,8 @@ module.exports = {
*/ */
// https://webpack.js.org/configuration/devtool/#development // https://webpack.js.org/configuration/devtool/#development
devtool: 'cheap-module-eval-source-map', // devtool: 'cheap-module-eval-source-map',
devtool: 'eval-cheap-module-source-map',
// If you have problems debugging vue-files in devtools, // If you have problems debugging vue-files in devtools,
// set this to false - it *may* help // set this to false - it *may* help

5080
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
"author": "ramon / chrigu", "author": "ramon / chrigu",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", "dev": "webpack serve --progress --config build/webpack.dev.conf.js",
"start": ". ../server/.env && npm run dev", "start": ". ../server/.env && npm run dev",
"lint": "eslint --ext .js,.vue src", "lint": "eslint --ext .js,.vue src",
"fix-lint": "eslint --ext .js,.vue --fix src", "fix-lint": "eslint --ext .js,.vue --fix src",
@ -44,7 +44,7 @@
"babel-plugin-syntax-jsx": "^6.18.0", "babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-vue-jsx": "^3.5.0", "babel-plugin-transform-vue-jsx": "^3.5.0",
"chalk": "^2.0.1", "chalk": "^2.0.1",
"copy-webpack-plugin": "^4.0.1", "copy-webpack-plugin": "^10.1.0",
"css-loader": "^0.28.0", "css-loader": "^0.28.0",
"cy2": "^1.2.1", "cy2": "^1.2.1",
"dayjs": "^1.10.4", "dayjs": "^1.10.4",
@ -52,24 +52,24 @@
"eslint": "^4.15.0", "eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1", "eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0", "eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1", "eslint-loader": "^4.0.2",
"eslint-plugin-cypress": "^2.11.2", "eslint-plugin-cypress": "^2.11.2",
"eslint-plugin-import": "^2.7.0", "eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.2.0", "eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0", "eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1", "eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0", "eslint-plugin-vue": "^4.0.0",
"extract-text-webpack-plugin": "^3.0.0", "extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.4", "file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1", "friendly-errors-webpack-plugin": "^1.7.0",
"graphql": "^0.13.2", "graphql": "^16.1.0",
"graphql-tag": "^2.10.1", "graphql-tag": "^2.10.1",
"html-webpack-plugin": "^2.30.1", "html-webpack-plugin": "^5.5.0",
"lodash": "^4.17.10", "lodash": "^4.17.10",
"moment": "^2.24.0", "moment": "^2.24.0",
"node-notifier": "^5.1.2", "node-notifier": "^5.1.2",
"node-sass": "^4.13.1", "node-sass": "^4.13.1",
"optimize-css-assets-webpack-plugin": "^3.2.0", "optimize-css-assets-webpack-plugin": "^6.0.1",
"ora": "^1.2.0", "ora": "^1.2.0",
"portfinder": "^1.0.13", "portfinder": "^1.0.13",
"postcss-import": "^11.0.0", "postcss-import": "^11.0.0",
@ -80,30 +80,29 @@
"semver": "^5.3.0", "semver": "^5.3.0",
"shelljs": "^0.7.6", "shelljs": "^0.7.6",
"survey-vue": "^1.8.77", "survey-vue": "^1.8.77",
"uglifyjs-webpack-plugin": "^1.1.1",
"unfetch": "^3.1.1", "unfetch": "^3.1.1",
"uploadcare-widget": "^3.6.0", "uploadcare-widget": "^3.6.0",
"url-loader": "^1.0.1", "url-loader": "^1.0.1",
"uuid": "^3.2.1", "uuid": "^3.2.1",
"vee-validate": "^2.2.0", "vee-validate": "^2.2.0",
"vue": "^2.5.17", "vue": "^3.1.5",
"@vue/compat": "^3.1.5",
"vue-analytics": "^5.16.2", "vue-analytics": "^5.16.2",
"vue-apollo": "^3.0.0-beta.16", "vue-apollo": "^3.0.0-beta.16",
"vue-loader": "^15.9.6", "vue-loader": "^16.8.3",
"vue-matomo": "^3.13.4-0", "vue-matomo": "^3.13.4-0",
"vue-router": "^3.0.1", "vue-router": "^3.0.1",
"vue-scrollto": "^2.11.0", "vue-scrollto": "^2.11.0",
"vue-style-loader": "^3.0.1", "vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.17",
"vue-toast-notification": "^0.4.1", "vue-toast-notification": "^0.4.1",
"vue-vimeo-player": "0.0.6", "vue-vimeo-player": "0.0.6",
"vuejs-logger": "1.5.5", "vuejs-logger": "1.5.5",
"vuetify": "^1.1.8", "vuetify": "^1.1.8",
"vuex": "^3.0.1", "vuex": "^3.0.1",
"webpack": "^3.6.0", "webpack": "^5.65.0",
"webpack-bundle-analyzer": "^2.9.0", "webpack-bundle-analyzer": "^4.5.0",
"webpack-dev-server": "^2.9.1", "webpack-dev-server": "^4.6.0",
"webpack-merge": "^4.1.0", "webpack-merge": "^5.8.0",
"whatwg-fetch": "^3.0.0" "whatwg-fetch": "^3.0.0"
}, },
"engines": { "engines": {
@ -116,6 +115,7 @@
"not ie <= 8" "not ie <= 8"
], ],
"devDependencies": { "devDependencies": {
"@vue/compiler-sfc": "^3.1.5",
"@vue/test-utils": "^1.0.0-beta.29", "@vue/test-utils": "^1.0.0-beta.29",
"babel-bridge": "^1.12.11", "babel-bridge": "^1.12.11",
"babel-core": "^7.0.0-bridge.0", "babel-core": "^7.0.0-bridge.0",
@ -131,6 +131,7 @@
"mock-apollo-client": "^0.7.0", "mock-apollo-client": "^0.7.0",
"ts-loader": "^8.3.0", "ts-loader": "^8.3.0",
"typescript": "^4.4.3", "typescript": "^4.4.3",
"vue-jest": "^3.0.4" "vue-jest": "^3.0.4",
"webpack-cli": "^4.9.1"
} }
} }

View File

@ -1,6 +1,6 @@
<template> <template>
<modal> <modal>
<template slot="header"> <template v-slot:header>
<modal-input <modal-input
:placeholder="titlePlaceholder" :placeholder="titlePlaceholder"
:value="localContentBlock.title" :value="localContentBlock.title"
@ -66,7 +66,8 @@
/> />
</div> </div>
<div slot="footer"> <template v-slot:footer>
<div>
<a <a
:class="{'button--disabled': disableSave}" :class="{'button--disabled': disableSave}"
class="button button--primary" class="button button--primary"
@ -76,6 +77,7 @@
class="button" class="button"
@click="$emit('hide')">Abbrechen</a> @click="$emit('hide')">Abbrechen</a>
</div> </div>
</template>
</modal> </modal>
</template> </template>
@ -100,16 +102,16 @@
'content-block': Object, 'content-block': Object,
'block-type': { 'block-type': {
type: String, type: String,
default: 'ContentBlock' default: 'ContentBlock',
}, },
'show-task-selection': { 'show-task-selection': {
type: Boolean, type: Boolean,
default: false default: false,
}, },
'disable-save': { 'disable-save': {
type: Boolean, type: Boolean,
default: false default: false,
} },
}, },
components: { components: {
@ -124,7 +126,7 @@
AssignmentForm, AssignmentForm,
TextForm, TextForm,
TrashIcon, TrashIcon,
Checkbox Checkbox,
}, },
data() { data() {
@ -134,14 +136,14 @@
title: this.contentBlock.title, title: this.contentBlock.title,
contents: [...this.contentBlock.contents], contents: [...this.contentBlock.contents],
id: this.contentBlock.id || undefined, id: this.contentBlock.id || undefined,
isAssignment: this.contentBlock.type && this.contentBlock.type.toLowerCase() === 'task' isAssignment: this.contentBlock.type && this.contentBlock.type.toLowerCase() === 'task',
}), }),
me: {} me: {},
}; };
}, },
apollo: { apollo: {
me: meQuery me: meQuery,
}, },
computed: { computed: {
@ -150,7 +152,7 @@
}, },
taskSelection() { taskSelection() {
return this.showTaskSelection && this.me.permissions.includes('users.can_manage_school_class_content'); return this.showTaskSelection && this.me.permissions.includes('users.can_manage_school_class_content');
} },
}, },
methods: { methods: {
@ -177,8 +179,8 @@
...content, ...content,
value: { value: {
...content.value, ...content.value,
[key]: value [key]: value,
} },
}); });
}, },
changeLinkUrl(value, index) { changeLinkUrl(value, index) {
@ -210,7 +212,7 @@
}, },
addElement(index) { addElement(index) {
this.localContentBlock.contents.splice(index + 1, 0, { this.localContentBlock.contents.splice(index + 1, 0, {
hideAssignment: this.blockType !== 'ContentBlock' hideAssignment: this.blockType !== 'ContentBlock',
}); });
}, },
updateTitle(title) { updateTitle(title) {
@ -220,15 +222,15 @@
changeType(index, type, value) { changeType(index, type, value) {
let el = { let el = {
type: type, type: type,
value: Object.assign({}, value) value: Object.assign({}, value),
}; };
switch (type) { switch (type) {
case 'text_block': case 'text_block':
el = { el = {
...el, ...el,
value: { value: {
text: '' text: '',
} },
}; };
break; break;
case 'link_block': case 'link_block':
@ -236,32 +238,32 @@
...el, ...el,
value: { value: {
text: '', text: '',
url: '' url: '',
} },
}; };
break; break;
case 'video_block': case 'video_block':
el = { el = {
...el, ...el,
value: { value: {
url: '' url: '',
} },
}; };
break; break;
case 'document_block': case 'document_block':
el = { el = {
...el, ...el,
value: Object.assign({ value: Object.assign({
url: '' url: '',
}, value) }, value),
}; };
break; break;
case 'image_url_block': case 'image_url_block':
el = { el = {
...el, ...el,
value: { value: {
url: '' url: '',
} },
}; };
break; break;
} }
@ -282,8 +284,8 @@
}, },
switchToDocument(index, value) { switchToDocument(index, value) {
this.changeType(index, 'document_block', value); this.changeType(index, 'document_block', value);
} },
} },
}; };
</script> </script>

View File

@ -3,16 +3,17 @@
:hide-header="false" :hide-header="false"
:small="true" :small="true"
class="snapshot-created"> class="snapshot-created">
<div slot="header"> <template v-slot:header>
<h1 class="snapshot-created__heading">Ein neuer Snapshot wurde erstellt</h1> <h1 class="snapshot-created__heading">Ein neuer Snapshot wurde erstellt</h1>
</div> </template>
<div class="snapshot-created__content"> <div class="snapshot-created__content">
<div class="snapshot-created__entry"> <div class="snapshot-created__entry">
<span class="snapshot-created__title">{{ snapshot.title }}</span> <span class="snapshot-created__title">{{ snapshot.title }}</span>
<span class="snapshot-created__meta">{{ created }} - {{ snapshot.creator }}</span> <span class="snapshot-created__meta">{{ created }} - {{ snapshot.creator }}</span>
</div> </div>
</div> </div>
<div slot="footer"> <template v-slot:footer>
<div>
<a <a
class="button button--primary" class="button button--primary"
data-cy="show-all-snapshots-button" data-cy="show-all-snapshots-button"
@ -21,6 +22,7 @@
class="button" class="button"
@click="close">Zurück zum Modul</a> @click="close">Zurück zum Modul</a>
</div> </div>
</template>
</modal> </modal>
</template> </template>
@ -48,7 +50,7 @@
}, },
created() { created() {
return dateformat(this.snapshot.created); return dateformat(this.snapshot.created);
} },
}, },
methods: { methods: {

View File

@ -8,7 +8,8 @@
data-cy="bookmark-note" data-cy="bookmark-note"
@input="localNote.text = $event" @input="localNote.text = $event"
/> />
<div slot="footer"> <template v-slot:footer>
<div>
<a <a
class="button button--primary" class="button button--primary"
data-cy="modal-save-button" data-cy="modal-save-button"
@ -17,6 +18,7 @@
class="button" class="button"
@click="$emit('hide')">Abbrechen</a> @click="$emit('hide')">Abbrechen</a>
</div> </div>
</template>
</modal> </modal>
</template> </template>

View File

@ -6,7 +6,8 @@
@input="text = $event" @input="text = $event"
/> />
<div slot="footer"> <template v-slot:footer>
<div>
<a <a
:class="{'button--disabled': disableSave}" :class="{'button--disabled': disableSave}"
class="button button--primary" class="button button--primary"
@ -16,6 +17,7 @@
class="button" class="button"
@click="hide()">Abbrechen</a> @click="hide()">Abbrechen</a>
</div> </div>
</template>
</modal> </modal>
</template> </template>
@ -31,23 +33,23 @@
export default { export default {
components: { components: {
Modal, Modal,
ModalInput ModalInput,
}, },
data() { data() {
return { return {
text: '', text: '',
saving: false saving: false,
}; };
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
objectiveGroup: 'currentObjectiveGroup' objectiveGroup: 'currentObjectiveGroup',
}), }),
disableSave() { disableSave() {
return this.saving; return this.saving;
} },
}, },
methods: { methods: {
@ -59,9 +61,9 @@
input: { input: {
objective: Object.assign({}, { objective: Object.assign({}, {
objectiveGroup: this.objectiveGroup, objectiveGroup: this.objectiveGroup,
text: entry text: entry,
}) }),
} },
}, },
update: (store, {data: {addObjective: {objective}}}) => { update: (store, {data: {addObjective: {objective}}}) => {
try { try {
@ -71,14 +73,14 @@
if (data.objectiveGroup && data.objectiveGroup.objectives) { if (data.objectiveGroup && data.objectiveGroup.objectives) {
data.objectiveGroup.objectives.push({ data.objectiveGroup.objectives.push({
...objective, ...objective,
__typename: 'ObjectiveNode' __typename: 'ObjectiveNode',
}); });
store.writeQuery({query, variables, data}); store.writeQuery({query, variables, data});
} }
} catch (e) { } catch (e) {
// Query did not exist in the cache, and apollo throws a generic Error. Do nothing // Query did not exist in the cache, and apollo throws a generic Error. Do nothing
} }
} },
}).then(() => { }).then(() => {
this.saving = false; this.saving = false;
this.hide(); this.hide();
@ -86,7 +88,7 @@
}, },
hide() { hide() {
this.$store.dispatch('hideModal'); this.$store.dispatch('hideModal');
} },
} },
}; };
</script> </script>

View File

@ -1,11 +1,13 @@
<template> <template>
<modal :hide-header="false"> <modal :hide-header="false">
<template v-slot:header>
<h2 <h2
class="project-entry-modal__heading" class="project-entry-modal__heading"
data-cy="modal-title" data-cy="modal-title">
slot="header">
Beitrag erfassen Beitrag erfassen
</h2> </h2>
</template>
<div class="project-entry-modal"> <div class="project-entry-modal">
<div class="project-entry-modal__form-field"> <div class="project-entry-modal__form-field">
<textarea <textarea
@ -20,13 +22,13 @@
icon="document-with-lines-icon" icon="document-with-lines-icon"
data-cy="use-template-button" data-cy="use-template-button"
text="Vorlage nutzen" text="Vorlage nutzen"
@click.native="useTemplate" /> @click.native="useTemplate"/>
<file-upload <file-upload
:with-text="true" :with-text="true"
:document="localProjectEntry.documentUrl" :document="localProjectEntry.documentUrl"
data-cy="upload-document-button" data-cy="upload-document-button"
@change-document-url="setDocumentUrl" /> @change-document-url="setDocumentUrl"/>
</div> </div>
</div> </div>
</div> </div>

View File

@ -54,7 +54,8 @@
</template> </template>
</li> </li>
</ul> </ul>
<div slot="footer"> <template v-slot:footer>
<div>
<a <a
class="button button--primary" class="button button--primary"
data-cy="modal-save-button" data-cy="modal-save-button"
@ -63,6 +64,7 @@
class="button" class="button"
@click="cancel">Abbrechen</a> @click="cancel">Abbrechen</a>
</div> </div>
</template>
</modal> </modal>
</template> </template>

View File

@ -2,13 +2,17 @@
<modal <modal
:hide-header="false" :hide-header="false"
:small="true"> :small="true">
<h4 slot="header">{{ type }} bearbeiten</h4> <template v-slot:header>
<h4>{{ type }} bearbeiten</h4>
</template>
<modal-input <modal-input
:value="name" :value="name"
placeholder="Klassenname" placeholder="Klassenname"
data-cy="edit-name-input" data-cy="edit-name-input"
@input="$emit('input', $event)" @input="$emit('input', $event)"
/> />
<template v-slot:footer>
<div slot="footer"> <div slot="footer">
<a <a
class="button button--primary" class="button button--primary"
@ -18,7 +22,7 @@
class="button" class="button"
@click="$emit('cancel')">Abbrechen</a> @click="$emit('cancel')">Abbrechen</a>
</div> </div>
</template>
</modal> </modal>
</template> </template>
@ -30,16 +34,16 @@
props: { props: {
name: { name: {
type: String, type: String,
default: '' default: '',
}, },
type: { type: {
type: String, type: String,
default: '' default: '',
} },
}, },
components: { components: {
Modal, Modal,
ModalInput ModalInput,
}, },
}; };

View File

@ -3,10 +3,11 @@
:hide-header="false" :hide-header="false"
:small="true" :small="true"
class="change-visibility"> class="change-visibility">
<template v-slot:header>
<h1 <h1
class="change-visibility__heading" class="change-visibility__heading"
data-cy="modal-title" data-cy="modal-title">Sichtbarkeit anpassen</h1>
slot="header">Sichtbarkeit anpassen</h1> </template>
<div class="change-visibility__content"> <div class="change-visibility__content">
<radiobutton <radiobutton
:checked="!restricted" :checked="!restricted"
@ -23,7 +24,8 @@
label="Lernende sehen nur die eigenen Beiträge" label="Lernende sehen nur die eigenen Beiträge"
@input="restrict(true)"/> @input="restrict(true)"/>
</div> </div>
<div slot="footer"> <template v-slot:footer>
<div>
<a <a
class="button button--primary" class="button button--primary"
data-cy="modal-save-button" data-cy="modal-save-button"
@ -32,6 +34,7 @@
class="button" class="button"
@click="cancel">Abbrechen</a> @click="cancel">Abbrechen</a>
</div> </div>
</template>
</modal> </modal>
</template> </template>
@ -48,7 +51,7 @@
data() { data() {
return { return {
restricted: false restricted: false,
}; };
}, },
@ -65,8 +68,8 @@
}, },
cancel() { cancel() {
this.$modal.cancel(); this.$modal.cancel();
} },
} },
}; };
</script> </script>

View File

@ -17,7 +17,7 @@
:selected-color="localRoom.appearance" :selected-color="localRoom.appearance"
@input="updateColor" @input="updateColor"
/> />
<template slot="footer"> <template v-slot:footer>
<button <button
type="submit" type="submit"
data-cy="room-form-save" data-cy="room-form-save"

View File

@ -14,7 +14,7 @@
}, },
"types": [ "types": [
"cypress" "cypress"
] ],
}, },
"include": [ "include": [
"**/*.*" "**/*.*"