summaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2016-04-12 11:51:50 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2016-04-13 14:25:23 +0200
commit576f7244e6b3b4d5568bebbe17966eb6490210f2 (patch)
tree585ebe3d58ef3beb5221e2167092a56b03f89b5e /apps/files/js
parenta4683bcfa9d2670a5284b7b27f0a475de8be44b7 (diff)
downloadnextcloud-server-576f7244e6b3b4d5568bebbe17966eb6490210f2.tar.gz
nextcloud-server-576f7244e6b3b4d5568bebbe17966eb6490210f2.zip
fix default value, update js/php tests
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/filelist.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index fef371b8479..78c014e431e 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -240,9 +240,9 @@
this.fileSummary = this._createSummary();
if (options.sorting) {
- this.setSort(options.sorting.mode, options.sorting.direction);
+ this.setSort(options.sorting.mode, options.sorting.direction, false, false);
} else {
- this.setSort('name', 'asc');
+ this.setSort('name', 'asc', false, false);
}
var breadcrumbOptions = {
@@ -694,14 +694,14 @@
sort = $target.attr('data-sort');
if (sort) {
if (this._sort === sort) {
- this.setSort(sort, (this._sortDirection === 'desc')?'asc':'desc', true);
+ this.setSort(sort, (this._sortDirection === 'desc')?'asc':'desc', true, true);
}
else {
if ( sort === 'name' ) { //default sorting of name is opposite to size and mtime
- this.setSort(sort, 'asc', true);
+ this.setSort(sort, 'asc', true, true);
}
else {
- this.setSort(sort, 'desc', true);
+ this.setSort(sort, 'desc', true, true);
}
}
}
@@ -1369,8 +1369,9 @@
* @param sort sort attribute name
* @param direction sort direction, one of "asc" or "desc"
* @param update true to update the list, false otherwise (default)
+ * @param persist true to save changes in the database (default)
*/
- setSort: function(sort, direction, update) {
+ setSort: function(sort, direction, update, persist) {
var comparator = FileList.Comparators[sort] || FileList.Comparators.name;
this._sort = sort;
this._sortDirection = (direction === 'desc')?'desc':'asc';
@@ -1402,10 +1403,12 @@
}
}
- $.post(OC.generateUrl('/apps/files/api/v1/sorting'), {
- mode: sort,
- direction: direction
- });
+ if (persist) {
+ $.post(OC.generateUrl('/apps/files/api/v1/sorting'), {
+ mode: sort,
+ direction: direction
+ });
+ }
},
/**