mirror of https://github.com/nextcloud/bookmarks
Implement sorting by URL
fixes #1183 Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
parent
4f15f05ac8
commit
ecd123c393
|
@ -92,7 +92,7 @@ class SettingsController extends ApiController {
|
|||
* @NoAdminRequired
|
||||
*/
|
||||
public function setSorting($sorting = ""): JSONResponse {
|
||||
$legalArguments = ['title', 'added', 'clickcount', 'lastmodified', 'index'];
|
||||
$legalArguments = ['title', 'added', 'clickcount', 'lastmodified', 'index', 'url'];
|
||||
if (!in_array($sorting, $legalArguments)) {
|
||||
return new JSONResponse(['status' => 'error'], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
|
|
|
@ -355,6 +355,8 @@ class BookmarkMapper extends QBMapper {
|
|||
} elseif ($sqlSortColumn === 'index') {
|
||||
$qb->addOrderBy('tree.idx', 'ASC');
|
||||
$qb->addGroupBy('tree.idx');
|
||||
} elseif ($sqlSortColumn === 'url') {
|
||||
$qb->addOrderBy('b.url', 'ASC');
|
||||
} else {
|
||||
$qb->addOrderBy('b.'.$sqlSortColumn, 'DESC');
|
||||
}
|
||||
|
|
|
@ -125,6 +125,7 @@ import SortAlphabeticalAscendingIcon from 'vue-material-design-icons/SortAlphabe
|
|||
import SortBoolAscendingIcon from 'vue-material-design-icons/SortBoolAscending.vue'
|
||||
import SortClockAscendingOutlineIcon from 'vue-material-design-icons/SortClockAscendingOutline.vue'
|
||||
import SortCalendarAscendingIcon from 'vue-material-design-icons/SortCalendarAscending.vue'
|
||||
import SortNumericAscendingIcon from 'vue-material-design-icons/SortNumericAscending.vue'
|
||||
import SortAscendingIcon from 'vue-material-design-icons/SortAscending.vue'
|
||||
import ShareVariantIcon from 'vue-material-design-icons/ShareVariant.vue'
|
||||
import TagIcon from 'vue-material-design-icons/Tag.vue'
|
||||
|
@ -148,6 +149,7 @@ export default {
|
|||
SortAlphabeticalAscendingIcon,
|
||||
SortClockAscendingOutlineIcon,
|
||||
SortBoolAscendingIcon,
|
||||
SortNumericAscendingIcon,
|
||||
FolderIcon,
|
||||
ArrowLeftIcon,
|
||||
PlusIcon,
|
||||
|
@ -170,6 +172,7 @@ export default {
|
|||
title: { icon: 'SortAlphabeticalAscendingIcon', description: this.t('bookmarks', 'Sort by title') },
|
||||
clickcount: { icon: 'SortBoolAscendingIcon', description: this.t('bookmarks', 'Sort by click count') },
|
||||
index: { icon: 'SortAscendingIcon', description: this.t('bookmarks', 'Sort by manual order') },
|
||||
url: { icon: 'SortNumericAscendingIcon', description: this.t('bookmarks', 'Sort by URL') },
|
||||
},
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue