summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-09-25 18:19:42 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-10-01 17:16:09 +0200
commitb9bc2417e7a8dc81feb0abe20359bedaf864f790 (patch)
tree61b47fbf37c1d168da8625224debde9e6a985348 /apps/files_sharing/src
parent7fb651235128dcbca8a6683b5cdafdf835f46300 (diff)
downloadnextcloud-server-b9bc2417e7a8dc81feb0abe20359bedaf864f790.tar.gz
nextcloud-server-b9bc2417e7a8dc81feb0abe20359bedaf864f790.zip
Comply to eslint
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing/src')
-rw-r--r--apps/files_sharing/src/additionalScripts.js10
-rw-r--r--apps/files_sharing/src/collaborationresources.js26
-rw-r--r--apps/files_sharing/src/collaborationresourceshandler.js22
-rw-r--r--apps/files_sharing/src/files_sharing.js10
-rw-r--r--apps/files_sharing/src/share.js219
-rw-r--r--apps/files_sharing/src/sharebreadcrumbview.js64
-rw-r--r--apps/files_sharing/src/sharetabview.js129
-rw-r--r--apps/files_sharing/src/views/CollaborationView.vue19
8 files changed, 253 insertions, 246 deletions
diff --git a/apps/files_sharing/src/additionalScripts.js b/apps/files_sharing/src/additionalScripts.js
index b0525a64a12..db65a2d2085 100644
--- a/apps/files_sharing/src/additionalScripts.js
+++ b/apps/files_sharing/src/additionalScripts.js
@@ -1,6 +1,3 @@
-__webpack_public_path__ = OC.linkTo('files_sharing', 'js/dist/');
-__webpack_nonce__ = btoa(OC.requestToken);
-
import './share'
import './sharetabview'
import './sharebreadcrumbview'
@@ -10,4 +7,9 @@ import './style/sharebreadcrumb.scss'
import './collaborationresourceshandler.js'
-window.OCA.Sharing = OCA.Sharing;
+// eslint-disable-next-line camelcase
+__webpack_public_path__ = OC.linkTo('files_sharing', 'js/dist/')
+// eslint-disable-next-line camelcase
+__webpack_nonce__ = btoa(OC.requestToken)
+
+window.OCA.Sharing = OCA.Sharing
diff --git a/apps/files_sharing/src/collaborationresources.js b/apps/files_sharing/src/collaborationresources.js
index 27f268be852..9c31f21bee5 100644
--- a/apps/files_sharing/src/collaborationresources.js
+++ b/apps/files_sharing/src/collaborationresources.js
@@ -1,4 +1,4 @@
-/*
+/**
* @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net>
*
* @author Julius Härtl <jus@bitgrid.net>
@@ -20,21 +20,23 @@
*
*/
-import Vue from 'vue';
-import Vuex from 'vuex';
-import { Tooltip, PopoverMenu } from 'nextcloud-vue';
-import ClickOutside from 'vue-click-outside';
+import Vue from 'vue'
+import Vuex from 'vuex'
+import { Tooltip, PopoverMenu } from 'nextcloud-vue'
+import ClickOutside from 'vue-click-outside'
-Vue.prototype.t = t;
-Vue.component('PopoverMenu', PopoverMenu);
-Vue.directive('ClickOutside', ClickOutside);
+import View from './views/CollaborationView'
+
+Vue.prototype.t = t
Tooltip.options.defaultHtml = false
-Vue.directive('Tooltip', Tooltip);
-Vue.use(Vuex);
-import View from './views/CollaborationView';
+// eslint-disable-next-line vue/match-component-file-name
+Vue.component('PopoverMenu', PopoverMenu)
+Vue.directive('ClickOutside', ClickOutside)
+Vue.directive('Tooltip', Tooltip)
+Vue.use(Vuex)
export {
Vue,
View
-};
+}
diff --git a/apps/files_sharing/src/collaborationresourceshandler.js b/apps/files_sharing/src/collaborationresourceshandler.js
index 32e9f17ad77..1e1ebe5b541 100644
--- a/apps/files_sharing/src/collaborationresourceshandler.js
+++ b/apps/files_sharing/src/collaborationresourceshandler.js
@@ -1,19 +1,21 @@
-__webpack_public_path__ = OC.linkTo('files_sharing', 'js/dist/');
-__webpack_nonce__ = btoa(OC.requestToken);
+// eslint-disable-next-line camelcase
+__webpack_public_path__ = OC.linkTo('files_sharing', 'js/dist/')
+// eslint-disable-next-line camelcase
+__webpack_nonce__ = btoa(OC.requestToken)
window.OCP.Collaboration.registerType('file', {
action: () => {
return new Promise((resolve, reject) => {
- OC.dialogs.filepicker(t('files_sharing', 'Link to a file'), function (f) {
- const client = OC.Files.getClient();
+ OC.dialogs.filepicker(t('files_sharing', 'Link to a file'), function(f) {
+ const client = OC.Files.getClient()
client.getFileInfo(f).then((status, fileInfo) => {
- resolve(fileInfo.id);
+ resolve(fileInfo.id)
}).fail(() => {
- reject();
- });
- }, false, null, false, OC.dialogs.FILEPICKER_TYPE_CHOOSE, '', { allowDirectoryChooser: true });
- });
+ reject(new Error('Cannot get fileinfo'))
+ })
+ }, false, null, false, OC.dialogs.FILEPICKER_TYPE_CHOOSE, '', { allowDirectoryChooser: true })
+ })
},
typeString: t('files_sharing', 'Link to a file'),
typeIconClass: 'icon-files-dark'
-});
+})
diff --git a/apps/files_sharing/src/files_sharing.js b/apps/files_sharing/src/files_sharing.js
index 0bf695a72c9..c521bb11414 100644
--- a/apps/files_sharing/src/files_sharing.js
+++ b/apps/files_sharing/src/files_sharing.js
@@ -1,5 +1,7 @@
-__webpack_nonce__ = btoa(OC.requestToken);
-__webpack_public_path__ = OC.linkTo('files_sharing', 'js/dist/');
+import '../js/app'
+import '../js/sharedfilelist'
-import '../js/app';
-import '../js/sharedfilelist';
+// eslint-disable-next-line camelcase
+__webpack_nonce__ = btoa(OC.requestToken)
+// eslint-disable-next-line camelcase
+__webpack_public_path__ = OC.linkTo('files_sharing', 'js/dist/')
diff --git a/apps/files_sharing/src/share.js b/apps/files_sharing/src/share.js
index 32ca20f3e62..a66f166759f 100644
--- a/apps/files_sharing/src/share.js
+++ b/apps/files_sharing/src/share.js
@@ -1,3 +1,4 @@
+/* eslint-disable */
/*
* Copyright (c) 2014
*
@@ -14,10 +15,10 @@
PROPERTY_SHARE_TYPES: '{' + OC.Files.Client.NS_OWNCLOUD + '}share-types',
PROPERTY_OWNER_ID: '{' + OC.Files.Client.NS_OWNCLOUD + '}owner-id',
PROPERTY_OWNER_DISPLAY_NAME: '{' + OC.Files.Client.NS_OWNCLOUD + '}owner-display-name'
- });
+ })
if (!OCA.Sharing) {
- OCA.Sharing = {};
+ OCA.Sharing = {}
}
/**
* @namespace
@@ -34,131 +35,130 @@
attach: function(fileList) {
// core sharing is disabled/not loaded
if (!OC.Share) {
- return;
+ return
}
if (fileList.id === 'trashbin' || fileList.id === 'files.public') {
- return;
+ return
}
- var fileActions = fileList.fileActions;
- var oldCreateRow = fileList._createRow;
+ var fileActions = fileList.fileActions
+ var oldCreateRow = fileList._createRow
fileList._createRow = function(fileData) {
- var tr = oldCreateRow.apply(this, arguments);
- var sharePermissions = OCA.Sharing.Util.getSharePermissions(fileData);
-
+ var tr = oldCreateRow.apply(this, arguments)
+ var sharePermissions = OCA.Sharing.Util.getSharePermissions(fileData)
+
if (fileData.permissions === 0) {
// no permission, disabling sidebar
- delete fileActions.actions.all.Comment;
- delete fileActions.actions.all.Details;
- delete fileActions.actions.all.Goto;
+ delete fileActions.actions.all.Comment
+ delete fileActions.actions.all.Details
+ delete fileActions.actions.all.Goto
}
- tr.attr('data-share-permissions', sharePermissions);
+ tr.attr('data-share-permissions', sharePermissions)
if (fileData.shareOwner) {
- tr.attr('data-share-owner', fileData.shareOwner);
- tr.attr('data-share-owner-id', fileData.shareOwnerId);
+ tr.attr('data-share-owner', fileData.shareOwner)
+ tr.attr('data-share-owner-id', fileData.shareOwnerId)
// user should always be able to rename a mount point
if (fileData.mountType === 'shared-root') {
- tr.attr('data-permissions', fileData.permissions | OC.PERMISSION_UPDATE);
+ tr.attr('data-permissions', fileData.permissions | OC.PERMISSION_UPDATE)
}
}
if (fileData.recipientData && !_.isEmpty(fileData.recipientData)) {
- tr.attr('data-share-recipient-data', JSON.stringify(fileData.recipientData));
+ tr.attr('data-share-recipient-data', JSON.stringify(fileData.recipientData))
}
if (fileData.shareTypes) {
- tr.attr('data-share-types', fileData.shareTypes.join(','));
+ tr.attr('data-share-types', fileData.shareTypes.join(','))
}
- return tr;
- };
+ return tr
+ }
- var oldElementToFile = fileList.elementToFile;
+ var oldElementToFile = fileList.elementToFile
fileList.elementToFile = function($el) {
- var fileInfo = oldElementToFile.apply(this, arguments);
- fileInfo.sharePermissions = $el.attr('data-share-permissions') || undefined;
- fileInfo.shareOwner = $el.attr('data-share-owner') || undefined;
- fileInfo.shareOwnerId = $el.attr('data-share-owner-id') || undefined;
+ var fileInfo = oldElementToFile.apply(this, arguments)
+ fileInfo.sharePermissions = $el.attr('data-share-permissions') || undefined
+ fileInfo.shareOwner = $el.attr('data-share-owner') || undefined
+ fileInfo.shareOwnerId = $el.attr('data-share-owner-id') || undefined
- if( $el.attr('data-share-types')){
- fileInfo.shareTypes = $el.attr('data-share-types').split(',');
+ if ($el.attr('data-share-types')) {
+ fileInfo.shareTypes = $el.attr('data-share-types').split(',')
}
- if( $el.attr('data-expiration')){
- var expirationTimestamp = parseInt($el.attr('data-expiration'));
- fileInfo.shares = [];
- fileInfo.shares.push({expiration: expirationTimestamp});
+ if ($el.attr('data-expiration')) {
+ var expirationTimestamp = parseInt($el.attr('data-expiration'))
+ fileInfo.shares = []
+ fileInfo.shares.push({ expiration: expirationTimestamp })
}
- return fileInfo;
- };
+ return fileInfo
+ }
- var oldGetWebdavProperties = fileList._getWebdavProperties;
+ var oldGetWebdavProperties = fileList._getWebdavProperties
fileList._getWebdavProperties = function() {
- var props = oldGetWebdavProperties.apply(this, arguments);
- props.push(OC.Files.Client.PROPERTY_OWNER_ID);
- props.push(OC.Files.Client.PROPERTY_OWNER_DISPLAY_NAME);
- props.push(OC.Files.Client.PROPERTY_SHARE_TYPES);
- return props;
- };
+ var props = oldGetWebdavProperties.apply(this, arguments)
+ props.push(OC.Files.Client.PROPERTY_OWNER_ID)
+ props.push(OC.Files.Client.PROPERTY_OWNER_DISPLAY_NAME)
+ props.push(OC.Files.Client.PROPERTY_SHARE_TYPES)
+ return props
+ }
fileList.filesClient.addFileInfoParser(function(response) {
- var data = {};
- var props = response.propStat[0].properties;
- var permissionsProp = props[OC.Files.Client.PROPERTY_PERMISSIONS];
+ var data = {}
+ var props = response.propStat[0].properties
+ var permissionsProp = props[OC.Files.Client.PROPERTY_PERMISSIONS]
if (permissionsProp && permissionsProp.indexOf('S') >= 0) {
- data.shareOwner = props[OC.Files.Client.PROPERTY_OWNER_DISPLAY_NAME];
- data.shareOwnerId = props[OC.Files.Client.PROPERTY_OWNER_ID];
+ data.shareOwner = props[OC.Files.Client.PROPERTY_OWNER_DISPLAY_NAME]
+ data.shareOwnerId = props[OC.Files.Client.PROPERTY_OWNER_ID]
}
- var shareTypesProp = props[OC.Files.Client.PROPERTY_SHARE_TYPES];
+ var shareTypesProp = props[OC.Files.Client.PROPERTY_SHARE_TYPES]
if (shareTypesProp) {
data.shareTypes = _.chain(shareTypesProp).filter(function(xmlvalue) {
- return (xmlvalue.namespaceURI === OC.Files.Client.NS_OWNCLOUD && xmlvalue.nodeName.split(':')[1] === 'share-type');
+ return (xmlvalue.namespaceURI === OC.Files.Client.NS_OWNCLOUD && xmlvalue.nodeName.split(':')[1] === 'share-type')
}).map(function(xmlvalue) {
- return parseInt(xmlvalue.textContent || xmlvalue.text, 10);
- }).value();
+ return parseInt(xmlvalue.textContent || xmlvalue.text, 10)
+ }).value()
}
- return data;
- });
+ return data
+ })
// use delegate to catch the case with multiple file lists
- fileList.$el.on('fileActionsReady', function(ev){
- var $files = ev.$files;
+ fileList.$el.on('fileActionsReady', function(ev) {
+ var $files = ev.$files
_.each($files, function(file) {
- var $tr = $(file);
- var shareTypes = $tr.attr('data-share-types') || '';
- var shareOwner = $tr.attr('data-share-owner');
+ var $tr = $(file)
+ var shareTypes = $tr.attr('data-share-types') || ''
+ var shareOwner = $tr.attr('data-share-owner')
if (shareTypes || shareOwner) {
- var hasLink = false;
- var hasShares = false;
+ var hasLink = false
+ var hasShares = false
_.each(shareTypes.split(',') || [], function(shareType) {
- shareType = parseInt(shareType, 10);
+ shareType = parseInt(shareType, 10)
if (shareType === OC.Share.SHARE_TYPE_LINK) {
- hasLink = true;
+ hasLink = true
} else if (shareType === OC.Share.SHARE_TYPE_EMAIL) {
- hasLink = true;
+ hasLink = true
} else if (shareType === OC.Share.SHARE_TYPE_USER) {
- hasShares = true;
+ hasShares = true
} else if (shareType === OC.Share.SHARE_TYPE_GROUP) {
- hasShares = true;
+ hasShares = true
} else if (shareType === OC.Share.SHARE_TYPE_REMOTE) {
- hasShares = true;
+ hasShares = true
} else if (shareType === OC.Share.SHARE_TYPE_CIRCLE) {
- hasShares = true;
+ hasShares = true
} else if (shareType === OC.Share.SHARE_TYPE_ROOM) {
- hasShares = true;
+ hasShares = true
}
- });
- OCA.Sharing.Util._updateFileActionIcon($tr, hasShares, hasLink);
+ })
+ OCA.Sharing.Util._updateFileActionIcon($tr, hasShares, hasLink)
}
- });
- });
-
+ })
+ })
fileList.$el.on('changeDirectory', function() {
- OCA.Sharing.sharesLoaded = false;
- });
+ OCA.Sharing.sharesLoaded = false
+ })
fileActions.registerAction({
name: 'Share',
@@ -193,40 +193,40 @@
type: OCA.Files.FileActions.TYPE_INLINE,
actionHandler: function(fileName, context) {
// do not open sidebar if permission is set and equal to 0
- var permissions = parseInt(context.$file.data('share-permissions'), 10);
+ var permissions = parseInt(context.$file.data('share-permissions'), 10)
if (isNaN(permissions) || permissions > 0) {
- fileList.showDetailsView(fileName, 'shareTabView');
+ fileList.showDetailsView(fileName, 'shareTabView')
}
},
render: function(actionSpec, isDefault, context) {
- var permissions = parseInt(context.$file.data('permissions'), 10);
+ var permissions = parseInt(context.$file.data('permissions'), 10)
// if no share permissions but share owner exists, still show the link
if ((permissions & OC.PERMISSION_SHARE) !== 0 || context.$file.attr('data-share-owner')) {
- return fileActions._defaultRenderAction.call(fileActions, actionSpec, isDefault, context);
+ return fileActions._defaultRenderAction.call(fileActions, actionSpec, isDefault, context)
}
// don't render anything
- return null;
+ return null
}
- });
+ })
- var shareTab = new OCA.Sharing.ShareTabView('shareTabView', {order: -20});
+ var shareTab = new OCA.Sharing.ShareTabView('shareTabView', { order: -20 })
// detect changes and change the matching list entry
shareTab.on('sharesChanged', function(shareModel) {
- var fileInfoModel = shareModel.fileInfoModel;
- var $tr = fileList.findFileEl(fileInfoModel.get('name'));
+ var fileInfoModel = shareModel.fileInfoModel
+ var $tr = fileList.findFileEl(fileInfoModel.get('name'))
// We count email shares as link share
- var hasLinkShares = shareModel.hasLinkShares();
- shareModel.get('shares').forEach(function (share) {
+ var hasLinkShares = shareModel.hasLinkShares()
+ shareModel.get('shares').forEach(function(share) {
if (share.share_type === OC.Share.SHARE_TYPE_EMAIL) {
- hasLinkShares = true;
+ hasLinkShares = true
}
- });
+ })
- OCA.Sharing.Util._updateFileListDataAttributes(fileList, $tr, shareModel);
+ OCA.Sharing.Util._updateFileListDataAttributes(fileList, $tr, shareModel)
if (!OCA.Sharing.Util._updateFileActionIcon($tr, shareModel.hasUserShares(), hasLinkShares)) {
// remove icon, if applicable
- OC.Share.markFileAsShared($tr, false, false);
+ OC.Share.markFileAsShared($tr, false, false)
}
// FIXME: this is too convoluted. We need to get rid of the above updates
@@ -237,12 +237,12 @@
// we need to modify the model
// (FIXME: yes, this is hacky)
icon: $tr.attr('data-icon')
- });
- });
- fileList.registerTabView(shareTab);
+ })
+ })
+ fileList.registerTabView(shareTab)
- var breadCrumbSharingDetailView = new OCA.Sharing.ShareBreadCrumbView({shareTab: shareTab});
- fileList.registerBreadCrumbDetailView(breadCrumbSharingDetailView);
+ var breadCrumbSharingDetailView = new OCA.Sharing.ShareBreadCrumbView({ shareTab: shareTab })
+ fileList.registerBreadCrumbDetailView(breadCrumbSharingDetailView)
},
/**
@@ -252,18 +252,17 @@
// files app current cannot show recipients on load, so we don't update the
// icon when changed for consistency
if (fileList.id === 'files') {
- return;
+ return
}
- var recipients = _.pluck(shareModel.get('shares'), 'share_with_displayname');
+ var recipients = _.pluck(shareModel.get('shares'), 'share_with_displayname')
// note: we only update the data attribute because updateIcon()
if (recipients.length) {
- var recipientData = _.mapObject(shareModel.get('shares'), function (share) {
- return {shareWith: share.share_with, shareWithDisplayName: share.share_with_displayname};
- });
- $tr.attr('data-share-recipient-data', JSON.stringify(recipientData));
- }
- else {
- $tr.removeAttr('data-share-recipient-data');
+ var recipientData = _.mapObject(shareModel.get('shares'), function(share) {
+ return { shareWith: share.share_with, shareWithDisplayName: share.share_with_displayname }
+ })
+ $tr.attr('data-share-recipient-data', JSON.stringify(recipientData))
+ } else {
+ $tr.removeAttr('data-share-recipient-data')
}
},
@@ -274,16 +273,16 @@
* @param {boolean} hasUserShares true if a user share exists
* @param {boolean} hasLinkShares true if a link share exists
*
- * @return {boolean} true if the icon was set, false otherwise
+ * @returns {boolean} true if the icon was set, false otherwise
*/
_updateFileActionIcon: function($tr, hasUserShares, hasLinkShares) {
// if the statuses are loaded already, use them for the icon
// (needed when scrolling to the next page)
if (hasUserShares || hasLinkShares || $tr.attr('data-share-recipient-data') || $tr.attr('data-share-owner')) {
- OC.Share.markFileAsShared($tr, true, hasLinkShares);
- return true;
+ OC.Share.markFileAsShared($tr, true, hasLinkShares)
+ return true
}
- return false;
+ return false
},
/**
@@ -291,9 +290,9 @@
* @returns {String}
*/
getSharePermissions: function(fileData) {
- return fileData.sharePermissions;
+ return fileData.sharePermissions
}
- };
-})();
+ }
+})()
-OC.Plugins.register('OCA.Files.FileList', OCA.Sharing.Util);
+OC.Plugins.register('OCA.Files.FileList', OCA.Sharing.Util)
diff --git a/apps/files_sharing/src/sharebreadcrumbview.js b/apps/files_sharing/src/sharebreadcrumbview.js
index 17e3eae0bf5..a90c94b6d7d 100644
--- a/apps/files_sharing/src/sharebreadcrumbview.js
+++ b/apps/files_sharing/src/sharebreadcrumbview.js
@@ -1,5 +1,3 @@
-/* global Handlebars, OC */
-
/**
* @copyright 2016 Christoph Wurst <christoph@winzerhof-wurst.at>
*
@@ -23,7 +21,7 @@
*/
(function() {
- 'use strict';
+ 'use strict'
var BreadCrumbView = OC.Backbone.View.extend({
tagName: 'span',
@@ -36,68 +34,68 @@
_shareTab: undefined,
initialize: function(options) {
- this._shareTab = options.shareTab;
+ this._shareTab = options.shareTab
},
render: function(data) {
- this._dirInfo = data.dirInfo || null;
+ this._dirInfo = data.dirInfo || null
if (this._dirInfo !== null && (this._dirInfo.path !== '/' || this._dirInfo.name !== '')) {
- var isShared = data.dirInfo && data.dirInfo.shareTypes && data.dirInfo.shareTypes.length > 0;
- this.$el.removeClass('shared icon-public icon-shared');
+ var isShared = data.dirInfo && data.dirInfo.shareTypes && data.dirInfo.shareTypes.length > 0
+ this.$el.removeClass('shared icon-public icon-shared')
if (isShared) {
- this.$el.addClass('shared');
+ this.$el.addClass('shared')
if (data.dirInfo.shareTypes.indexOf(OC.Share.SHARE_TYPE_LINK) !== -1) {
- this.$el.addClass('icon-public');
+ this.$el.addClass('icon-public')
} else {
- this.$el.addClass('icon-shared');
+ this.$el.addClass('icon-shared')
}
} else {
- this.$el.addClass('icon-shared');
+ this.$el.addClass('icon-shared')
}
- this.$el.show();
- this.delegateEvents();
+ this.$el.show()
+ this.delegateEvents()
} else {
- this.$el.removeClass('shared icon-public icon-shared');
- this.$el.hide();
+ this.$el.removeClass('shared icon-public icon-shared')
+ this.$el.hide()
}
- return this;
+ return this
},
_onClick: function(e) {
- e.preventDefault();
+ e.preventDefault()
- var fileInfoModel = new OCA.Files.FileInfoModel(this._dirInfo);
- var self = this;
+ var fileInfoModel = new OCA.Files.FileInfoModel(this._dirInfo)
+ var self = this
fileInfoModel.on('change', function() {
self.render({
dirInfo: self._dirInfo
- });
- });
+ })
+ })
this._shareTab.on('sharesChanged', function(shareModel) {
- var shareTypes = [];
- var shares = shareModel.getSharesWithCurrentItem();
+ var shareTypes = []
+ var shares = shareModel.getSharesWithCurrentItem()
- for(var i = 0; i < shares.length; i++) {
+ for (var i = 0; i < shares.length; i++) {
if (shareTypes.indexOf(shares[i].share_type) === -1) {
- shareTypes.push(shares[i].share_type);
+ shareTypes.push(shares[i].share_type)
}
}
if (shareModel.hasLinkShares()) {
- shareTypes.push(OC.Share.SHARE_TYPE_LINK);
+ shareTypes.push(OC.Share.SHARE_TYPE_LINK)
}
// Since the dirInfo isn't updated we need to do this dark hackery
- self._dirInfo.shareTypes = shareTypes;
+ self._dirInfo.shareTypes = shareTypes
self.render({
dirInfo: self._dirInfo
- });
- });
- OCA.Files.App.fileList.showDetailsView(fileInfoModel, 'shareTabView');
+ })
+ })
+ OCA.Files.App.fileList.showDetailsView(fileInfoModel, 'shareTabView')
}
- });
+ })
- OCA.Sharing.ShareBreadCrumbView = BreadCrumbView;
-})();
+ OCA.Sharing.ShareBreadCrumbView = BreadCrumbView
+})()
diff --git a/apps/files_sharing/src/sharetabview.js b/apps/files_sharing/src/sharetabview.js
index 44c863fbe9e..da0708b85a6 100644
--- a/apps/files_sharing/src/sharetabview.js
+++ b/apps/files_sharing/src/sharetabview.js
@@ -11,77 +11,77 @@
/* @global Handlebars */
(function() {
- var TEMPLATE =
- '<div>' +
- '<div class="dialogContainer"></div>' +
- '<div id="collaborationResources"></div>' +
- '</div>';
+ var TEMPLATE
+ = '<div>'
+ + '<div class="dialogContainer"></div>'
+ + '<div id="collaborationResources"></div>'
+ + '</div>'
/**
* @memberof OCA.Sharing
*/
var ShareTabView = OCA.Files.DetailTabView.extend(
/** @lends OCA.Sharing.ShareTabView.prototype */ {
- id: 'shareTabView',
- className: 'tab shareTabView',
+ id: 'shareTabView',
+ className: 'tab shareTabView',
- initialize: function(name, options) {
- OCA.Files.DetailTabView.prototype.initialize.call(this, name, options);
- OC.Plugins.attach('OCA.Sharing.ShareTabView', this);
- },
+ initialize: function(name, options) {
+ OCA.Files.DetailTabView.prototype.initialize.call(this, name, options)
+ OC.Plugins.attach('OCA.Sharing.ShareTabView', this)
+ },
- template: function(params) {
- return TEMPLATE;
- },
+ template: function(params) {
+ return TEMPLATE
+ },
- getLabel: function() {
- return t('files_sharing', 'Sharing');
- },
+ getLabel: function() {
+ return t('files_sharing', 'Sharing')
+ },
- getIcon: function() {
- return 'icon-shared';
- },
+ getIcon: function() {
+ return 'icon-shared'
+ },
- /**
+ /**
* Renders this details view
*/
- render: function() {
- var self = this;
- if (this._dialog) {
+ render: function() {
+ var self = this
+ if (this._dialog) {
// remove/destroy older instance
- this._dialog.model.off();
- this._dialog.remove();
- this._dialog = null;
- }
-
- if (this.model) {
- this.$el.html(this.template());
-
- if (_.isUndefined(this.model.get('sharePermissions'))) {
- this.model.set('sharePermissions', OCA.Sharing.Util.getSharePermissions(this.model.attributes));
+ this._dialog.model.off()
+ this._dialog.remove()
+ this._dialog = null
}
- // TODO: the model should read these directly off the passed fileInfoModel
- var attributes = {
- itemType: this.model.isDirectory() ? 'folder' : 'file',
- itemSource: this.model.get('id'),
- possiblePermissions: this.model.get('sharePermissions')
- };
- var configModel = new OC.Share.ShareConfigModel();
- var shareModel = new OC.Share.ShareItemModel(attributes, {
- configModel: configModel,
- fileInfoModel: this.model
- });
- this._dialog = new OC.Share.ShareDialogView({
- configModel: configModel,
- model: shareModel
- });
- this.$el.find('.dialogContainer').append(this._dialog.$el);
- this._dialog.render();
- this._dialog.model.fetch();
- this._dialog.model.on('change', function() {
- self.trigger('sharesChanged', shareModel);
- });
+ if (this.model) {
+ this.$el.html(this.template())
+
+ if (_.isUndefined(this.model.get('sharePermissions'))) {
+ this.model.set('sharePermissions', OCA.Sharing.Util.getSharePermissions(this.model.attributes))
+ }
+
+ // TODO: the model should read these directly off the passed fileInfoModel
+ var attributes = {
+ itemType: this.model.isDirectory() ? 'folder' : 'file',
+ itemSource: this.model.get('id'),
+ possiblePermissions: this.model.get('sharePermissions')
+ }
+ var configModel = new OC.Share.ShareConfigModel()
+ var shareModel = new OC.Share.ShareItemModel(attributes, {
+ configModel: configModel,
+ fileInfoModel: this.model
+ })
+ this._dialog = new OC.Share.ShareDialogView({
+ configModel: configModel,
+ model: shareModel
+ })
+ this.$el.find('.dialogContainer').append(this._dialog.$el)
+ this._dialog.render()
+ this._dialog.model.fetch()
+ this._dialog.model.on('change', function() {
+ self.trigger('sharesChanged', shareModel)
+ })
import('./collaborationresources').then((Resources) => {
var vm = new Resources.Vue({
@@ -89,20 +89,19 @@
render: h => h(Resources.View),
data: {
model: this.model.toJSON()
- },
- });
+ }
+ })
this.model.on('change', () => { vm.data = this.model.toJSON() })
})
- } else {
- this.$el.empty();
+ } else {
+ this.$el.empty()
// TODO: render placeholder text?
+ }
+ this.trigger('rendered')
}
- this.trigger('rendered');
- }
- });
-
- OCA.Sharing.ShareTabView = ShareTabView;
-})();
+ })
+ OCA.Sharing.ShareTabView = ShareTabView
+})()
diff --git a/apps/files_sharing/src/views/CollaborationView.vue b/apps/files_sharing/src/views/CollaborationView.vue
index 0307488b5a9..5cfcd299cce 100644
--- a/apps/files_sharing/src/views/CollaborationView.vue
+++ b/apps/files_sharing/src/views/CollaborationView.vue
@@ -21,7 +21,10 @@
-->
<template>
- <collection-list v-if="fileId" type="file" :id="fileId" :name="filename"></collection-list>
+ <CollectionList v-if="fileId"
+ :id="fileId"
+ type="file"
+ :name="filename" />
</template>
<script>
@@ -29,22 +32,22 @@ import { CollectionList } from 'nextcloud-vue-collections'
export default {
name: 'CollaborationView',
+ components: {
+ CollectionList
+ },
computed: {
fileId() {
if (this.$root.model && this.$root.model.id) {
- return '' + this.$root.model.id;
+ return '' + this.$root.model.id
}
- return null;
+ return null
},
filename() {
if (this.$root.model && this.$root.model.name) {
- return '' + this.$root.model.name;
+ return '' + this.$root.model.name
}
- return '';
+ return ''
}
- },
- components: {
- CollectionList
}
}
</script>