[PLT-2407] Improve ordering of uploaded attachments (#7022)

* improve ordering of uploaded attachments

* use LocalizationStore.getLocale() when comparing file names
Этот коммит содержится в:
Saturnino Abril
2017-08-05 02:00:23 +08:00
коммит произвёл Christopher Speller
родитель c973608ccb
Коммит 2c8a5ffd97
4 изменённых файлов: 21 добавлений и 11 удалений

Просмотреть файл

@@ -475,6 +475,11 @@ export function splitFileLocation(fileLocation) {
return {ext, name: filename, path: filePath};
}
export function sortFilesByName(files) {
const locale = LocalizationStore.getLocale();
return Array.from(files).sort((a, b) => a.name.localeCompare(b.name, locale, {numeric: true}));
}
export function toTitleCase(str) {
function doTitleCase(txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();