summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-11-08 16:23:47 +0100
committerGitHub <noreply@github.com>2016-11-08 16:23:47 +0100
commit5f15020b9bcc4732d81176f2c8380bfdbd16a051 (patch)
tree5d69308879f296e65beff6e78d1873822e1580bc /apps/files
parentc591e29eb356ad2f5a0b7363fda7f08baff58e13 (diff)
parent742ece8b7a054ce16152d721f91936d04b5d22c2 (diff)
downloadnextcloud-server-5f15020b9bcc4732d81176f2c8380bfdbd16a051.tar.gz
nextcloud-server-5f15020b9bcc4732d81176f2c8380bfdbd16a051.zip
Merge pull request #1618 from nextcloud/show-folder-shared-status
make it possible to share the current folder
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/js/breadcrumb.js23
-rw-r--r--apps/files/js/filelist.js27
2 files changed, 43 insertions, 7 deletions
diff --git a/apps/files/js/breadcrumb.js b/apps/files/js/breadcrumb.js
index 98de7aa374c..ff9700456da 100644
--- a/apps/files/js/breadcrumb.js
+++ b/apps/files/js/breadcrumb.js
@@ -45,6 +45,7 @@
if (options.getCrumbUrl) {
this.getCrumbUrl = options.getCrumbUrl;
}
+ this._detailViews = [];
};
/**
* @memberof OCA.Files
@@ -52,6 +53,7 @@
BreadCrumb.prototype = {
$el: null,
dir: null,
+ dirInfo: null,
/**
* Total width of all breadcrumbs
@@ -79,6 +81,20 @@
}
},
+ setDirectoryInfo: function(dirInfo) {
+ if (dirInfo !== this.dirInfo) {
+ this.dirInfo = dirInfo;
+ this.render();
+ }
+ },
+
+ /**
+ * @param {Backbone.View} detailView
+ */
+ addDetailView: function(detailView) {
+ this._detailViews.push(detailView);
+ },
+
/**
* Returns the full URL to the given directory
*
@@ -122,6 +138,13 @@
}
$crumb.addClass('last');
+ _.each(this._detailViews, function(view) {
+ view.render({
+ dirInfo: this.dirInfo
+ });
+ $crumb.append(view.$el);
+ }, this);
+
// in case svg is not supported by the browser we need to execute the fallback mechanism
if (!OC.Util.hasSVGSupport()) {
OC.Util.replaceSVG(this.$el);
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 18534db3ee9..c53fa4f3d66 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -473,7 +473,7 @@
* Displays the details view for the given file and
* selects the given tab
*
- * @param {string} fileName file name for which to show details
+ * @param {string|OCA.Files.FileInfoModel} fileName file name or FileInfoModel for which to show details
* @param {string} [tabId] optional tab id to select
*/
showDetailsView: function(fileName, tabId) {
@@ -487,7 +487,7 @@
/**
* Update the details view to display the given file
*
- * @param {string} fileName file name from the current list
+ * @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) {
@@ -518,13 +518,16 @@
OC.Apps.showAppSidebar(this._detailsView.$el);
}
- var $tr = this.findFileEl(fileName);
- var model = this.getModelForFile($tr);
+ 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;
- $tr.addClass('highlighted');
-
this._detailsView.setFileInfo(model);
this._detailsView.$el.scrollTop(0);
},
@@ -1646,6 +1649,7 @@
// first entry is the root
this.dirInfo = result.shift();
+ this.breadcrumb.setDirectoryInfo(this.dirInfo);
if (this.dirInfo.permissions) {
this.setDirectoryPermissions(this.dirInfo.permissions);
@@ -2021,7 +2025,7 @@
function updateInList(fileInfo) {
self.updateRow(tr, fileInfo);
- self._updateDetailsView(fileInfo.name, false);
+ self._updateDetailsView(fileInfo, false);
}
// TODO: too many nested blocks, move parts into functions
@@ -2954,6 +2958,15 @@
if (this._detailsView) {
this._detailsView.addDetailView(detailView);
}
+ },
+
+ /**
+ * Register a view to be added to the breadcrumb view
+ */
+ registerBreadCrumbDetailView: function(detailView) {
+ if (this.breadcrumb) {
+ this.breadcrumb.addDetailView(detailView);
+ }
}
};