Finish the sort feature

This commit is contained in:
djmaze 2021-03-27 16:02:48 +01:00
parent 7eeed62b09
commit 64cf19746d
14 changed files with 82 additions and 16 deletions

View file

@ -17,7 +17,7 @@ export const FolderType = {
/**
* @enum {string}
*/
export const FolderSortType = {
export const FolderSortMode = {
DateDesc: '', // default 'REVERSE DATE'
DateAsc: 'DATE',
FromDesc: 'REVERSE FROM',

View file

@ -1,6 +1,6 @@
import ko from 'ko';
import { FolderType, FolderSortType } from 'Common/EnumsUser';
import { FolderType, FolderSortMode } from 'Common/EnumsUser';
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { addObservablesTo, addSubscribablesTo } from 'Common/Utils';
import { folderListOptionsBuilder } from 'Common/UtilsUser';
@ -42,7 +42,7 @@ export const FolderUserStore = new class {
foldersInboxUnreadCount: 0
});
this.sortMode = ko.observable('').extend({ limitedList: Object.values(FolderSortType) });
this.sortMode = ko.observable('').extend({ limitedList: Object.values(FolderSortMode) });
this.namespace = '';

View file

@ -179,13 +179,15 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
messageListFocused: () => Scope.MessageList === AppUserStore.focusedState(),
sortText: () => {
let mode = FolderUserStore.sortMode().split(/\s+/);
if ('' === mode[0]) {
let mode = FolderUserStore.sortMode();
if ('' === mode) {
return '📅⬇';
}
mode = mode.split(/\s+/);
return (mode.includes('SIZE') ? '✉'
: (mode.includes('FROM') ? '@'
: (mode.includes('SUBJECT') ? '𝐒' : '📅')))
: (mode.includes('SUBJECT') ? '𝐒'
: '📅')))
+ (mode.includes('REVERSE') ? '⬇' : '⬆');
}
});

View file

@ -101,14 +101,15 @@ en:
YESTERDAY_AT: "yesterday at %TIME%"
NEW_MESSAGE_NOTIFICATION: "You have %COUNT% new messages!"
QUOTA_SIZE: "Using <strong>%SIZE% (%PROC%%)</strong> of your <strong>%LIMIT%</strong>"
SORT_DATE_DESC: "Date descending"
SORT: "Sort"
SORT_DATE_ASC: "Date ascending"
SORT_SIZE_DESC: "Size descending"
SORT_DATE_DESC: "Date descending"
SORT_SIZE_ASC: "Size ascending"
SORT_SUBJECT_DESC: "Subject descending"
SORT_SUBJECT_ASC: "Subject ascending"
SORT_FROM_DESC: "From descending"
SORT_FROM_ASC: "From ascending"
SORT_SIZE_DESC: "Size descending"
SORT_SUBJECT_ASC: "Subject A-Z"
SORT_SUBJECT_DESC: "Subject Z-A"
SORT_FROM_ASC: "From A-Z"
SORT_FROM_DESC: "From Z-A"
MESSAGE:
BUTTON_EDIT: "Edit"
BUTTON_UNSUBSCRIBE: "Unsubscribe from this list"

View file

@ -101,6 +101,15 @@ de_DE:
YESTERDAY_AT: "Gestern um %TIME%"
NEW_MESSAGE_NOTIFICATION: "Sie haben %COUNT% neue Nachrichten!"
QUOTA_SIZE: "Sie nutzen <strong>%SIZE% (%PROC%%)</strong> von <strong>%LIMIT%</strong>."
SORT: "Sortieren"
SORT_DATE_ASC: "Datum aufsteigend"
SORT_DATE_DESC: "Datum absteigend"
SORT_SIZE_ASC: "Größe aufsteigend"
SORT_SIZE_DESC: "Größe absteigend"
SORT_SUBJECT_ASC: "Betreff A-Z"
SORT_SUBJECT_DESC: "Betreff Z-A"
SORT_FROM_ASC: "Von A-Z"
SORT_FROM_DESC: "Von Z-A"
MESSAGE:
BUTTON_EDIT: "Bearbeiten"
BUTTON_UNSUBSCRIBE: "Diese Liste abbestellen"

View file

@ -101,6 +101,15 @@ en_GB:
YESTERDAY_AT: "yesterday at %TIME%"
NEW_MESSAGE_NOTIFICATION: "You have %COUNT% new messages!"
QUOTA_SIZE: "Using <strong>%SIZE% (%PROC%%)</strong> of your <strong>%LIMIT%</strong>"
SORT: "Sort"
SORT_DATE_ASC: "Date ascending"
SORT_DATE_DESC: "Date descending"
SORT_SIZE_ASC: "Size ascending"
SORT_SIZE_DESC: "Size descending"
SORT_SUBJECT_ASC: "Subject A-Z"
SORT_SUBJECT_DESC: "Subject Z-A"
SORT_FROM_ASC: "From A-Z"
SORT_FROM_DESC: "From Z-A"
MESSAGE:
BUTTON_EDIT: "Edit"
BUTTON_UNSUBSCRIBE: "Unsubscribe from this list"

View file

@ -101,6 +101,15 @@ en_US:
YESTERDAY_AT: "yesterday at %TIME%"
NEW_MESSAGE_NOTIFICATION: "You have %COUNT% new messages!"
QUOTA_SIZE: "Using <strong>%SIZE% (%PROC%%)</strong> of your <strong>%LIMIT%</strong>"
SORT: "Sort"
SORT_DATE_ASC: "Date ascending"
SORT_DATE_DESC: "Date descending"
SORT_SIZE_ASC: "Size ascending"
SORT_SIZE_DESC: "Size descending"
SORT_SUBJECT_ASC: "Subject A-Z"
SORT_SUBJECT_DESC: "Subject Z-A"
SORT_FROM_ASC: "From A-Z"
SORT_FROM_DESC: "From Z-A"
MESSAGE:
BUTTON_EDIT: "Edit"
BUTTON_UNSUBSCRIBE: "Unsubscribe from this list"

View file

@ -101,6 +101,15 @@ es_ES:
YESTERDAY_AT: "ayer a las %TIME%"
NEW_MESSAGE_NOTIFICATION: "Tiene %COUNT% nuevos mensajes."
QUOTA_SIZE: "Usando <strong>%SIZE% (%PROC%%)</strong> de sus <strong>%LIMIT%</strong>"
SORT: "Ordenar"
SORT_DATE_ASC: "Fecha ascendente"
SORT_DATE_DESC: "Fecha descendente"
SORT_SIZE_ASC: "Tamaño ascendente"
SORT_SIZE_DESC: "Tamaño descendente"
SORT_SUBJECT_ASC: "Asunto A-Z"
SORT_SUBJECT_DESC: "Asunto Z-A"
SORT_FROM_ASC: "Desde A-Z"
SORT_FROM_DESC: "Desde Z-A"
MESSAGE:
BUTTON_EDIT: "Editar"
BUTTON_UNSUBSCRIBE: "Eliminar suscripción de esta lista"

View file

@ -101,6 +101,15 @@ fr_FR:
YESTERDAY_AT: "hier à %TIME%"
NEW_MESSAGE_NOTIFICATION: "Vous avez %COUNT% nouveaux messages !"
QUOTA_SIZE: "Vous utilisez <strong>%SIZE% (%PROC%%)</strong> sur <strong>%LIMIT%</strong>"
SORT: "Trier"
SORT_DATE_ASC: "Date ascendante"
SORT_DATE_DESC: "Date décroissante"
SORT_SIZE_ASC: "Taille ascendante"
SORT_SIZE_DESC: "Taille décroissante"
SORT_SUBJECT_ASC: "Sujet A-Z"
SORT_SUBJECT_DESC: "Sujet Z-A"
SORT_FROM_ASC: "De A-Z"
SORT_FROM_DESC: "De Z-A"
MESSAGE:
BUTTON_EDIT: "Modifier"
BUTTON_UNSUBSCRIBE: "Se désinscrire de cette liste"

View file

@ -101,6 +101,15 @@ nl_NL:
YESTERDAY_AT: "gisteren om %TIME%"
NEW_MESSAGE_NOTIFICATION: "U heeft %COUNT% nieuwe berichten!"
QUOTA_SIZE: "U gebruikt <strong>%SIZE% (%PROC%%)</strong> van <strong>%LIMIT%</strong>"
SORT: "Sorteren"
SORT_DATE_ASC: "Datum oplopend"
SORT_DATE_DESC: "Datum aflopend"
SORT_SIZE_ASC: "Grootte oplopend"
SORT_SIZE_DESC: "Grootte aflopend"
SORT_SUBJECT_ASC: "Onderwerp A-Z"
SORT_SUBJECT_DESC: "Onderwerp Z-A"
SORT_FROM_ASC: "Van A-Z"
SORT_FROM_DESC: "Van Z-A"
MESSAGE:
BUTTON_EDIT: "Aanpassen"
BUTTON_UNSUBSCRIBE: "Abonnement op deze e-mail lijst opzeggen"

View file

@ -101,6 +101,15 @@ zh_CN:
YESTERDAY_AT: "昨天 %TIME%"
NEW_MESSAGE_NOTIFICATION: "您有 %COUNT% 封新邮件!"
QUOTA_SIZE: "使用了 <strong>%LIMIT%</strong> 存储空间中的<strong>%SIZE% (%PROC%%)</strong>"
SORT: "排序"
SORT_DATE_ASC: "日期升序"
SORT_DATE_DESC: "日期降序"
SORT_SIZE_ASC: "大小递增"
SORT_SIZE_DESC: "大小递减"
SORT_SUBJECT_ASC: "主题 A-Z"
SORT_SUBJECT_DESC: "主题 Z-A"
SORT_FROM_ASC: "发送自 A-Z"
SORT_FROM_DESC: "发送自 Z-A"
MESSAGE:
BUTTON_EDIT: "编辑"
BUTTON_UNSUBSCRIBE: "从此列表中取消订阅"

View file

@ -101,8 +101,8 @@
</li>
</ul>
</div>
<div class="btn-group dropdown sortFolder" data-bind="visible: sortSupported, registerBootstrapDropdown: true, openDropdownTrigger: sortDropdownTrigger">
<a id="sort-list-dropdown-id" class="btn dropdown-toggle fontastic" href="#" tabindex="-1" data-toggle="dropdown" data-i18n="[title]GLOBAL/SORT" data-bind="text: sortText"></a>
<div class="btn-group dropdown sortFolder" data-bind="visible: sortSupported() && mobileCheckedStateHide(), registerBootstrapDropdown: true, openDropdownTrigger: sortDropdownTrigger">
<a id="sort-list-dropdown-id" class="btn dropdown-toggle fontastic" href="#" tabindex="-1" data-toggle="dropdown" data-i18n="[title]MESSAGE_LIST/SORT" data-bind="text: sortText"></a>
<ul class="dropdown-menu g-ui-menu" role="menu" aria-labelledby="sort-list-dropdown-id">
<li class="e-item" role="presentation" data-sort="DATE" data-bind="click: changeSort">
<a class="e-link menuitem" href="#" tabindex="-1">
@ -130,13 +130,13 @@
</li>
<li class="e-item dividerbar" role="presentation" data-sort="SUBJECT" data-bind="click: changeSort">
<a class="e-link menuitem" href="#" tabindex="-1">
<i class="fontastic">S</i>
<i class="fontastic">𝐒</i>
<span data-i18n="MESSAGE_LIST/SORT_SUBJECT_ASC"></span>
</a>
</li>
<li class="e-item" role="presentation" data-sort="REVERSE SUBJECT" data-bind="click: changeSort">
<a class="e-link menuitem" href="#" tabindex="-1">
<i class="fontastic">S</i>
<i class="fontastic">𝐒</i>
<span data-i18n="MESSAGE_LIST/SORT_SUBJECT_DESC"></span>
</a>
</li>

Binary file not shown.

Binary file not shown.