diff options
author | Guillaume AMAT <guillaume.amat@informatique-libre.com> | 2014-02-12 00:54:35 +0100 |
---|---|---|
committer | Guillaume AMAT <guillaume.amat@informatique-libre.com> | 2014-02-12 00:54:35 +0100 |
commit | a62b393d02fdfc49334b5ad4b1e847a711de741d (patch) | |
tree | 66d323815e1d4e44332f2e28ad1c0af4126d66db /apps/files | |
parent | 3699728a3a02dd17ea617a7e8f781c09e837f360 (diff) | |
download | nextcloud-server-a62b393d02fdfc49334b5ad4b1e847a711de741d.tar.gz nextcloud-server-a62b393d02fdfc49334b5ad4b1e847a711de741d.zip |
Update page title when navigating through directories
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/js/filelist.js | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index a855d6cbe59..7691135e620 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -19,6 +19,15 @@ window.FileList={ }); }, /** + * Sets a new page title + */ + setPageTitle: function(title){ + // Sets the page title with the " - ownCloud" suffix as in templates + window.document.title = title + ' - ownCloud'; + + return true; + }, + /** * Returns the tr element for a given file name */ findFileEl: function(fileName){ @@ -186,12 +195,22 @@ window.FileList={ changeDirectory: function(targetDir, changeUrl, force) { var $dir = $('#dir'), url, - currentDir = $dir.val() || '/'; + currentDir = $dir.val() || '/', + baseDir = targetDir.split('/').pop(), targetDir = targetDir || '/'; if (!force && currentDir === targetDir) { return; } + + if (baseDir !== '') { + FileList.setPageTitle(baseDir); + } + else { + FileList.setPageTitle(t('files', 'Files')); + } + FileList.setCurrentDir(targetDir, changeUrl); + $('#fileList').trigger( jQuery.Event('changeDirectory', { dir: targetDir, @@ -811,7 +830,8 @@ window.FileList={ }; $(document).ready(function() { - var isPublic = !!$('#isPublic').val(); + var baseDir, + isPublic = !!$('#isPublic').val(); // handle upload events var file_upload_start = $('#file_upload_start'); @@ -1095,6 +1115,14 @@ $(document).ready(function() { FileList.changeDirectory(parseCurrentDirFromUrl(), false, true); } } - + + + baseDir = parseCurrentDirFromUrl().split('/').pop(); + + if (baseDir !== '') { + FileList.setPageTitle(baseDir); + } + + FileList.createFileSummary(); }); |