Dispatch event to allow apps to load their script for collections
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
3022ef687a
commit
e8fe00003b
5 changed files with 26 additions and 17 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
20
apps/files_sharing/src/collaborationresourceshandler.js
Normal file
20
apps/files_sharing/src/collaborationresourceshandler.js
Normal file
|
@ -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'
|
||||
});
|
|
@ -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/'),
|
||||
|
|
Loading…
Reference in a new issue