aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-03-14 14:42:42 +0100
committerJulius Härtl <jus@bitgrid.net>2019-03-19 13:06:55 +0100
commite8fe00003b326867de480d919fdfe78ced9e7857 (patch)
tree4b69f488a3b1529e473a3f1448d32cbbfa6db32c /apps
parent3022ef687a7bef87fc8eff7e29a68d8cf64542e9 (diff)
downloadnextcloud-server-e8fe00003b326867de480d919fdfe78ced9e7857.tar.gz
nextcloud-server-e8fe00003b326867de480d919fdfe78ced9e7857.zip
Dispatch event to allow apps to load their script for collections
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/appinfo/app.php3
-rw-r--r--apps/files_sharing/list.php1
-rw-r--r--apps/files_sharing/src/additionalScripts.js18
-rw-r--r--apps/files_sharing/src/collaborationresourceshandler.js20
-rw-r--r--apps/files_sharing/webpack.js1
5 files changed, 26 insertions, 17 deletions
diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php
index b50cc99dca7..747c2020746 100644
--- a/apps/files_sharing/appinfo/app.php
+++ b/apps/files_sharing/appinfo/app.php
@@ -45,6 +45,9 @@ $eventDispatcher->addListener(
\OCP\Util::addScript('files_sharing', 'dist/additionalScripts');
}
);
+\OC::$server->getEventDispatcher()->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function () {
+ \OCP\Util::addScript('files_sharing', 'dist/collaboration');
+});
$config = \OC::$server->getConfig();
$shareManager = \OC::$server->getShareManager();
diff --git a/apps/files_sharing/list.php b/apps/files_sharing/list.php
index 1866c73b68c..219fe2863ed 100644
--- a/apps/files_sharing/list.php
+++ b/apps/files_sharing/list.php
@@ -33,5 +33,6 @@ $tmpl = new OCP\Template('files_sharing', 'list', '');
$tmpl->assign('showgridview', $showgridview && !$isIE);
OCP\Util::addScript('files_sharing', 'dist/files_sharing');
+\OC::$server->getEventDispatcher()->dispatch('\OCP\Collaboration\Resources::loadAdditionalScripts');
$tmpl->printPage();
diff --git a/apps/files_sharing/src/additionalScripts.js b/apps/files_sharing/src/additionalScripts.js
index 94c0f232ce3..b0525a64a12 100644
--- a/apps/files_sharing/src/additionalScripts.js
+++ b/apps/files_sharing/src/additionalScripts.js
@@ -8,22 +8,6 @@ import './sharebreadcrumbview'
import './style/sharetabview.scss'
import './style/sharebreadcrumb.scss'
-window.OCP.Collaboration.registerType('files', {
- action: () => {
- return new Promise((resolve, reject) => {
- OC.dialogs.filepicker('Link to a file', function (f) {
- const client = OC.Files.getClient();
- client.getFileInfo(f).then((status, fileInfo) => {
- resolve(fileInfo.id);
- }, () => {
- reject();
- });
- }, false);
- });
- },
- /** used in "Link to a {typeString}" */
- typeString: t('files_sharing', 'file'),
- typeIconClass: 'icon-files-dark'
-});
+import './collaborationresourceshandler.js'
window.OCA.Sharing = OCA.Sharing;
diff --git a/apps/files_sharing/src/collaborationresourceshandler.js b/apps/files_sharing/src/collaborationresourceshandler.js
new file mode 100644
index 00000000000..fe27bd7fca0
--- /dev/null
+++ b/apps/files_sharing/src/collaborationresourceshandler.js
@@ -0,0 +1,20 @@
+__webpack_public_path__ = OC.linkTo('files_sharing', 'js/dist/');
+__webpack_nonce__ = btoa(OC.requestToken);
+
+window.OCP.Collaboration.registerType('files', {
+ action: () => {
+ return new Promise((resolve, reject) => {
+ OC.dialogs.filepicker('Link to a file', function (f) {
+ const client = OC.Files.getClient();
+ client.getFileInfo(f).then((status, fileInfo) => {
+ resolve(fileInfo.id);
+ }, () => {
+ reject();
+ });
+ }, false);
+ });
+ },
+ /** used in "Link to a {typeString}" */
+ typeString: t('files_sharing', 'file'),
+ typeIconClass: 'icon-files-dark'
+});
diff --git a/apps/files_sharing/webpack.js b/apps/files_sharing/webpack.js
index 4b641329ec6..fb82797d804 100644
--- a/apps/files_sharing/webpack.js
+++ b/apps/files_sharing/webpack.js
@@ -5,6 +5,7 @@ module.exports = {
entry: {
'additionalScripts': path.join(__dirname, 'src', 'additionalScripts.js'),
'files_sharing': path.join(__dirname, 'src', 'files_sharing.js'),
+ 'collaboration': path.join(__dirname, 'src', 'collaborationresourceshandler.js'),
},
output: {
path: path.resolve(__dirname, './js/dist/'),