diff options
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r-- | apps/files/js/filelist.js | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 61e73b7bebc..4fa8ca65e39 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -18,8 +18,8 @@ this.initialize($el, options); }; FileList.prototype = { - SORT_INDICATOR_ASC_CLASS: 'icon-triangle-s', - SORT_INDICATOR_DESC_CLASS: 'icon-triangle-n', + SORT_INDICATOR_ASC_CLASS: 'icon-triangle-n', + SORT_INDICATOR_DESC_CLASS: 'icon-triangle-s', id: 'files', appName: t('files', 'Files'), @@ -371,7 +371,12 @@ this.setSort(sort, (this._sortDirection === 'desc')?'asc':'desc'); } else { - this.setSort(sort, 'asc'); + if ( sort === 'name' ) { //default sorting of name is opposite to size and mtime + this.setSort(sort, 'asc'); + } + else { + this.setSort(sort, 'desc'); + } } this.reload(); } @@ -707,6 +712,7 @@ * @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) * @return new tr element (not appended to the table) */ add: function(fileData, options) { @@ -714,7 +720,7 @@ var $tr; var $rows; var $insertionPoint; - options = options || {}; + options = _.extend({animate: true}, options || {}); // there are three situations to cover: // 1) insertion point is visible on the current page @@ -772,6 +778,7 @@ * @param options map of attributes: * - "index" optional index at which to insert the element * - "updateSummary" true to update the summary after adding (default), false otherwise + * - "animate" true to animate the preview rendering * @return new tr element (not appended to the table) */ _renderRow: function(fileData, options) { @@ -813,7 +820,7 @@ if (fileData.isPreviewAvailable) { // lazy load / newly inserted td ? - if (!fileData.icon) { + if (options.animate) { this.lazyLoadPreview({ path: path + '/' + fileData.name, mime: mime, @@ -914,16 +921,25 @@ this._sort = sort; this._sortDirection = (direction === 'desc')?'desc':'asc'; this._sortComparator = comparator; + if (direction === 'desc') { this._sortComparator = function(fileInfo1, fileInfo2) { return -comparator(fileInfo1, fileInfo2); }; } this.$el.find('thead th .sort-indicator') - .removeClass(this.SORT_INDICATOR_ASC_CLASS + ' ' + this.SORT_INDICATOR_DESC_CLASS); + .removeClass(this.SORT_INDICATOR_ASC_CLASS) + .removeClass(this.SORT_INDICATOR_DESC_CLASS) + .toggleClass('hidden', true) + .addClass(this.SORT_INDICATOR_DESC_CLASS); + this.$el.find('thead th.column-' + sort + ' .sort-indicator') + .removeClass(this.SORT_INDICATOR_ASC_CLASS) + .removeClass(this.SORT_INDICATOR_DESC_CLASS) + .toggleClass('hidden', false) .addClass(direction === 'desc' ? this.SORT_INDICATOR_DESC_CLASS : this.SORT_INDICATOR_ASC_CLASS); }, + /** * Reloads the file list using ajax call * |