aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-05-23 17:03:04 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2019-10-29 12:56:00 +0100
commitfd90af50d910e659aa8df0d380424383c6c09620 (patch)
tree76d8ddcc7cf44ba6852f31b0a2323d23d6b1c258 /apps/files/js
parentea6f423e2c8e50cf1357a0e2182dc4c9a9bf981e (diff)
downloadnextcloud-server-fd90af50d910e659aa8df0d380424383c6c09620.tar.gz
nextcloud-server-fd90af50d910e659aa8df0d380424383c6c09620.zip
Add OCA.Files.Sidebar
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/fileactions.js6
-rw-r--r--apps/files/js/filelist.js69
-rw-r--r--apps/files/js/merged-index.json47
3 files changed, 57 insertions, 65 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index d800f2b8eb5..571cdcf6c38 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -704,6 +704,12 @@
}
context.fileList.do_delete(fileName, context.dir);
$('.tipsy').remove();
+
+ // close sidebar on delete
+ const path = context.dir + '/' + fileName
+ if (OCA.Files.Sidebar && OCA.Files.Sidebar.file === path) {
+ OCA.Files.Sidebar.file = undefined
+ }
}
});
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 58e2bfae7ff..8cca43d5749 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -610,11 +610,11 @@
* @param {string} [tabId] optional tab id to select
*/
showDetailsView: function(fileName, tabId) {
+ console.warn('showDetailsView is deprecated! Use OCA.Files.Sidebar.activeTab. It will be removed in nextcloud 20.');
this._updateDetailsView(fileName);
if (tabId) {
- this._detailsView.selectTab(tabId);
+ OCA.Files.Sidebar.activeTab = tabId;
}
- OC.Apps.showAppSidebar(this._detailsView.$el);
},
/**
@@ -623,48 +623,23 @@
* @param {string|OCA.Files.FileInfoModel} fileName file name from the current list or a FileInfoModel object
* @param {boolean} [show=true] whether to open the sidebar if it was closed
*/
- _updateDetailsView: function(fileName, show) {
- if (!this._detailsView) {
+ _updateDetailsView: function(fileName) {
+ if (!(OCA.Files && OCA.Files.Sidebar)) {
+ console.error('No sidebar available');
return;
}
- // show defaults to true
- show = _.isUndefined(show) || !!show;
- var oldFileInfo = this._detailsView.getFileInfo();
- if (oldFileInfo) {
- // TODO: use more efficient way, maybe track the highlight
- this.$fileList.children().filterAttr('data-id', '' + oldFileInfo.get('id')).removeClass('highlighted');
- oldFileInfo.off('change', this._onSelectedModelChanged, this);
- }
-
if (!fileName) {
- this._detailsView.setFileInfo(null);
- if (this._currentFileModel) {
- this._currentFileModel.off();
- }
- this._currentFileModel = null;
- OC.Apps.hideAppSidebar(this._detailsView.$el);
- return;
+ OCA.Files.Sidebar.file = null
+ return
+ } else if (typeof fileName !== 'string') {
+ fileName = ''
}
- if (show && this._detailsView.$el.hasClass('disappear')) {
- OC.Apps.showAppSidebar(this._detailsView.$el);
- }
-
- if (fileName instanceof OCA.Files.FileInfoModel) {
- var model = fileName;
- } else {
- var $tr = this.findFileEl(fileName);
- var model = this.getModelForFile($tr);
- $tr.addClass('highlighted');
- }
-
- this._currentFileModel = model;
-
- this._replaceDetailsViewElementIfNeeded();
-
- this._detailsView.setFileInfo(model);
- this._detailsView.$el.scrollTop(0);
+ // open sidebar and set file
+ const dir = `${this.dirInfo.path}/${this.dirInfo.name}`
+ const path = `${dir}/${fileName}`
+ OCA.Files.Sidebar.file = path.replace('//', '/')
},
/**
@@ -1404,6 +1379,13 @@
return OC.MimeType.getIconUrl('dir-external');
} else if (fileInfo.mountType !== undefined && fileInfo.mountType !== '') {
return OC.MimeType.getIconUrl('dir-' + fileInfo.mountType);
+ } else if (fileInfo.shareTypes && (
+ fileInfo.shareTypes.indexOf(OC.Share.SHARE_TYPE_LINK) > -1
+ || fileInfo.shareTypes.indexOf(OC.Share.SHARE_TYPE_EMAIL) > -1)
+ ) {
+ return OC.MimeType.getIconUrl('dir-public')
+ } else if (fileInfo.shareTypes && fileInfo.shareTypes.length > 0) {
+ return OC.MimeType.getIconUrl('dir-shared')
}
return OC.MimeType.getIconUrl('dir');
}
@@ -3654,8 +3636,10 @@
* Register a tab view to be added to all views
*/
registerTabView: function(tabView) {
- if (this._detailsView) {
- this._detailsView.addTabView(tabView);
+ console.warn('registerTabView is deprecated! It will be removed in nextcloud 20.');
+ const name = tabView.getLabel()
+ if (name) {
+ OCA.Files.Sidebar.registerTab(new OCA.Files.Sidebar.Tab(name, tabView, true))
}
},
@@ -3663,8 +3647,9 @@
* Register a detail view to be added to all views
*/
registerDetailView: function(detailView) {
- if (this._detailsView) {
- this._detailsView.addDetailView(detailView);
+ console.warn('registerDetailView is deprecated! It will be removed in nextcloud 20.');
+ if (detailView.el) {
+ OCA.Files.Sidebar.registerSecondaryView(detailView)
}
},
diff --git a/apps/files/js/merged-index.json b/apps/files/js/merged-index.json
index 8d25daa6b3c..b673da858cb 100644
--- a/apps/files/js/merged-index.json
+++ b/apps/files/js/merged-index.json
@@ -1,33 +1,34 @@
[
+ "dist/sidebar.js",
"app.js",
- "templates.js",
- "file-upload.js",
- "newfilemenu.js",
- "jquery.fileupload.js",
- "jquery-visibility.js",
- "fileinfomodel.js",
- "filesummary.js",
- "filemultiselectmenu.js",
"breadcrumb.js",
- "filelist.js",
- "search.js",
- "favoritesfilelist.js",
- "recentfilelist.js",
- "tagsplugin.js",
- "gotoplugin.js",
- "favoritesplugin.js",
- "recentplugin.js",
"detailfileinfoview.js",
- "sidebarpreviewmanager.js",
- "sidebarpreviewtext.js",
- "detailtabview.js",
- "semaphore.js",
- "mainfileinfodetailview.js",
- "operationprogressbar.js",
"detailsview.js",
+ "detailtabview.js",
+ "favoritesfilelist.js",
+ "favoritesplugin.js",
+ "file-upload.js",
"fileactions.js",
"fileactionsmenu.js",
+ "fileinfomodel.js",
+ "filelist.js",
+ "filemultiselectmenu.js",
"files.js",
+ "filesummary.js",
+ "gotoplugin.js",
+ "jquery-visibility.js",
+ "jquery.fileupload.js",
"keyboardshortcuts.js",
- "navigation.js"
+ "mainfileinfodetailview.js",
+ "navigation.js",
+ "newfilemenu.js",
+ "operationprogressbar.js",
+ "recentfilelist.js",
+ "recentplugin.js",
+ "search.js",
+ "semaphore.js",
+ "sidebarpreviewmanager.js",
+ "sidebarpreviewtext.js",
+ "tagsplugin.js",
+ "templates.js"
]