1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2025-04-25 20:15:47 +02:00

add locale-aware sorting for folders and feeds

Signed-off-by: anoy <anoymouserver+github@mailbox.org>
This commit is contained in:
anoy 2020-11-09 11:41:34 +01:00 committed by Benjamin Brahmer
parent 47ab9f38c4
commit 112cc727ea
4 changed files with 10 additions and 2 deletions

View File

@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
## Unreleased
- Remove deprecated YouTube playlist API
- Locale-aware sorting for folders and feeds
## 15.1.0-rc1

View File

@ -406,4 +406,11 @@ app.controller('NavigationController', function ($route, FEED_TYPE, FeedResource
setSelectedFolderForRoute();
});
$rootScope.localeComparator = function(v1, v2) {
if (v1.type === 'string' && v2.type === 'string') {
return v1.value.localeCompare(v2.value);
}
return (v1.value === v2.value) ? 0 : ((v1.value < v2.value) ? -1 : 1);
};
});

View File

@ -7,7 +7,7 @@
'icon-loading-small': !(feed.id || feed.error)
}"
ng-repeat="feed in Navigation.getFeedsOfFolder(<?php p($_['folderId']); ?>)
| orderBy:['-pinned', 'title.toLowerCase()'] track by feed.url"
| orderBy:['-pinned', 'title.toLowerCase()']:false:localeComparator track by feed.url"
ng-show="Navigation.isFeedUnread(feed.id)
|| Navigation.isShowAll()
|| Navigation.isFeedActive(feed.id)

View File

@ -5,7 +5,7 @@
deleted: folder.deleted,
editing: folder.editing
}"
ng-repeat="folder in Navigation.getFolders() | orderBy:'name.toLowerCase()'"
ng-repeat="folder in Navigation.getFolders() | orderBy:'name.toLowerCase()':false:localeComparator"
ng-show="Navigation.isFolderUnread(folder.id)
|| Navigation.isShowAll()
|| Navigation.isFolderActive(folder.id)