aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-09-04 12:33:38 +0200
committerVincent Petry <pvince81@owncloud.com>2014-09-05 16:55:36 +0200
commitcfca88f20e0a246d08e7402efdde41695b44291a (patch)
treeb07afec4b96fa4c6961c77fd5641e9d4fdf11a01
parent8e77ca62012591953cbbfcdfeed076a490d0052c (diff)
downloadnextcloud-server-cfca88f20e0a246d08e7402efdde41695b44291a.tar.gz
nextcloud-server-cfca88f20e0a246d08e7402efdde41695b44291a.zip
Scroll to new file/folder after adding
When creating a new file from the menu, the list now scrolls to that file.
-rw-r--r--apps/files/js/file-upload.js4
-rw-r--r--apps/files/js/filelist.js11
2 files changed, 10 insertions, 5 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index 310799b9513..460c2435642 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -629,7 +629,7 @@ OC.Upload = {
},
function(result) {
if (result.status === 'success') {
- FileList.add(result.data, {hidden: hidden, animate: true});
+ FileList.add(result.data, {hidden: hidden, animate: true, scrollTo: true});
} else {
OC.dialogs.alert(result.data.message, t('core', 'Could not create file'));
}
@@ -645,7 +645,7 @@ OC.Upload = {
},
function(result) {
if (result.status === 'success') {
- FileList.add(result.data, {hidden: hidden, animate: true});
+ FileList.add(result.data, {hidden: hidden, animate: true, scrollTo: true});
} else {
OC.dialogs.alert(result.data.message, t('core', 'Could not create folder'));
}
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 402abbd16f2..34d4885cdce 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -716,9 +716,10 @@
*
* @param fileData map of file attributes
* @param options map of attributes:
- * - "updateSummary": true to update the summary after adding (default), false otherwise
- * - "silent": true to prevent firing events like "fileActionsReady"
- * - "animate": true to animate preview loading (defaults to true here)
+ * @param options.updateSummary true to update the summary after adding (default), false otherwise
+ * @param options.silent true to prevent firing events like "fileActionsReady"
+ * @param options.animate true to animate preview loading (defaults to true here)
+ * @param options.scrollTo true to automatically scroll to the file's location
* @return new tr element (not appended to the table)
*/
add: function(fileData, options) {
@@ -767,6 +768,10 @@
});
}
+ if (options.scrollTo) {
+ this.scrollTo(fileData.name);
+ }
+
// defaults to true if not defined
if (typeof(options.updateSummary) === 'undefined' || !!options.updateSummary) {
this.fileSummary.add(fileData, true);