]> source.dussan.org Git - nextcloud-server.git/commitdiff
Scroll to new file/folder after adding
authorVincent Petry <pvince81@owncloud.com>
Thu, 4 Sep 2014 10:33:38 +0000 (12:33 +0200)
committerVincent Petry <pvince81@owncloud.com>
Thu, 4 Sep 2014 10:34:17 +0000 (12:34 +0200)
When creating a new file from the menu, the list now scrolls to that
file.

apps/files/js/file-upload.js
apps/files/js/filelist.js

index 310799b9513fe20e1adf721261aec164341d8564..460c2435642c76299282720bfead161b1e62ad70 100644 (file)
@@ -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'));
                                                                        }
index 7b9811d50bbbaa106654247a076fb12be7abe6f0..44f035fed1a9e26a5d7a73e352d1655cfb99fcfc 100644 (file)
                 *
                 * @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) {
                                });
                        }
 
+                       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);