diff --git a/apps/files_sharing/.babelrc b/apps/files_sharing/.babelrc new file mode 100644 index 0000000000000..a9b68d19ead8f --- /dev/null +++ b/apps/files_sharing/.babelrc @@ -0,0 +1,3 @@ +{ + "plugins": ["@babel/plugin-syntax-dynamic-import"] +} diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index 13705718a04a8..4755d4c6bdc08 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -43,7 +43,6 @@ 'OCA\Files::loadAdditionalScripts', function() { \OCP\Util::addStyle('files_sharing', 'mergedAdditionalStyles'); - \OCP\Util::addScript('files_sharing', 'additionalScripts'); } ); diff --git a/apps/files_sharing/js/sharetabview.js b/apps/files_sharing/js/sharetabview.js index 3944293d5c1ea..815d1147fdd73 100644 --- a/apps/files_sharing/js/sharetabview.js +++ b/apps/files_sharing/js/sharetabview.js @@ -14,6 +14,7 @@ var TEMPLATE = '
' + '
' + + '
' + '
'; /** @@ -76,6 +77,19 @@ this._dialog.model.on('change', function() { self.trigger('sharesChanged', shareModel); }); + + import('./../src/collaborationresources').then((Resources) => { + var vm = new Resources.Vue({ + el: '#collaborationResources', + render: h => h(Resources.View), + data: { + model: this.model.toJSON() + }, + }); + this.model.on('change', () => { vm.data = this.model.toJSON() }) + + }) + } else { this.$el.empty(); // TODO: render placeholder text? diff --git a/apps/files_sharing/list.php b/apps/files_sharing/list.php index 9eed10f8d26a8..1866c73b68cfa 100644 --- a/apps/files_sharing/list.php +++ b/apps/files_sharing/list.php @@ -32,7 +32,6 @@ // gridview not available for ie $tmpl->assign('showgridview', $showgridview && !$isIE); -OCP\Util::addScript('files_sharing', 'app'); -OCP\Util::addScript('files_sharing', 'sharedfilelist'); +OCP\Util::addScript('files_sharing', 'dist/files_sharing'); $tmpl->printPage(); diff --git a/apps/files_sharing/package.json b/apps/files_sharing/package.json new file mode 100644 index 0000000000000..9aa194cbaeddf --- /dev/null +++ b/apps/files_sharing/package.json @@ -0,0 +1,35 @@ +{ + "name": "files_sharing", + "version": "1.0.0", + "description": "File sharing in Nextcloud", + "main": "files_sharing.js", + "directories": { + "lib": "lib", + "test": "tests" + }, + "scripts": { + "build": "webpack --progress --hide-modules --config webpack.prod.js", + "dev": "webpack --progress --watch --config webpack.dev.js", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "AGPL-3.0-or-later", + "dependencies": { + "nextcloud-axios": "^0.1.3", + "nextcloud-vue": "^0.5.0", + "vue": "^2.5.17" + }, + "devDependencies": { + "@babel/core": "^7.1.0", + "@babel/plugin-syntax-dynamic-import": "^7.2.0", + "babel-loader": "^8.0.2", + "css-loader": "^2.1.0", + "node-sass": "^4.11.0", + "sass-loader": "^7.1.0", + "vue-loader": "^15.4.2", + "vue-template-compiler": "^2.5.17", + "webpack": "^4.20.0", + "webpack-cli": "^3.1.1", + "webpack-merge": "^4.1.4" + } +} diff --git a/apps/files_sharing/src/collaborationresources.js b/apps/files_sharing/src/collaborationresources.js new file mode 100644 index 0000000000000..c532510ab9934 --- /dev/null +++ b/apps/files_sharing/src/collaborationresources.js @@ -0,0 +1,36 @@ +/* + * @copyright Copyright (c) 2019 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 { PopoverMenu } from 'nextcloud-vue' +import ClickOutside from 'vue-click-outside' +import { VTooltip } from 'v-tooltip' + +Vue.prototype.t = t; + +Vue.component('PopoverMenu', PopoverMenu) +Vue.directive('ClickOutside', ClickOutside) +Vue.directive('Tooltip', VTooltip) + +import View from './views/CollaborationView' + +export { Vue, View } diff --git a/apps/files_sharing/src/components/ResourceListItem.vue b/apps/files_sharing/src/components/ResourceListItem.vue new file mode 100644 index 0000000000000..dd3ae70800c93 --- /dev/null +++ b/apps/files_sharing/src/components/ResourceListItem.vue @@ -0,0 +1,98 @@ + + + + + + + diff --git a/apps/files_sharing/src/files_sharing.js b/apps/files_sharing/src/files_sharing.js new file mode 100644 index 0000000000000..c31c8c6e205d8 --- /dev/null +++ b/apps/files_sharing/src/files_sharing.js @@ -0,0 +1,16 @@ +// CSP config for webpack dynamic chunk loading +// eslint-disable-next-line +__webpack_nonce__ = btoa(OC.requestToken) + +// Correct the root of the app for chunk loading +// OC.linkTo matches the apps folders +// eslint-disable-next-line +__webpack_public_path__ = OC.linkTo('files_sharing', 'js/dist/') + +import '../js/app' +import '../js/sharedfilelist' +import '../js/sharetabview' +import '../js/share' +import '../js/sharebreadcrumbview' + +window.OCA.Sharing = OCA.Sharing diff --git a/apps/files_sharing/src/views/CollaborationView.vue b/apps/files_sharing/src/views/CollaborationView.vue new file mode 100644 index 0000000000000..23c92f0514ef5 --- /dev/null +++ b/apps/files_sharing/src/views/CollaborationView.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/apps/files_sharing/webpack.common.js b/apps/files_sharing/webpack.common.js new file mode 100644 index 0000000000000..9479459286ffb --- /dev/null +++ b/apps/files_sharing/webpack.common.js @@ -0,0 +1,47 @@ +const path = require('path'); +const { VueLoaderPlugin } = require('vue-loader'); + +module.exports = { + entry: path.join(__dirname, 'src', 'files_sharing.js'), + output: { + path: path.resolve(__dirname, 'js/dist'), + publicPath: '/js/dist/', + filename: 'files_sharing.js', + chunkFilename: 'files_sharing.[name].js' +}, + module: { + rules: [ + { + test: /\.css$/, + use: ['vue-style-loader', 'css-loader'] + }, + { + test: /\.scss$/, + use: ['vue-style-loader', 'css-loader', 'sass-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.runtime.esm.js', + }, + extensions: ['*', '.js', '.vue', '.json'] + } +}; diff --git a/apps/files_sharing/webpack.dev.js b/apps/files_sharing/webpack.dev.js new file mode 100644 index 0000000000000..0c569e7f61ec2 --- /dev/null +++ b/apps/files_sharing/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/apps/files_sharing/webpack.prod.js b/apps/files_sharing/webpack.prod.js new file mode 100644 index 0000000000000..f081567bd63ca --- /dev/null +++ b/apps/files_sharing/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' +})