mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Improved js minification
This commit is contained in:
parent
8884adcb72
commit
b31bf3d7f5
16 changed files with 99 additions and 150 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import ko from 'External/Admin/ko';
|
||||
import 'External/Admin/ko';
|
||||
import ko from 'ko';
|
||||
|
||||
import { StorageResultType } from 'Common/Enums';
|
||||
|
||||
|
|
@ -93,10 +94,8 @@ class AdminApp extends AbstractApp {
|
|||
}
|
||||
|
||||
bootend() {
|
||||
if (window.progressJs) {
|
||||
progressJs.end();
|
||||
}
|
||||
}
|
||||
|
||||
bootstart() {
|
||||
super.bootstart();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import ko from 'External/User/ko'; // eslint-disable-line no-unused-vars
|
||||
import 'External/User/ko';
|
||||
|
||||
import { pInt, pString } from 'Common/Utils';
|
||||
import { isPosNumeric, delegateRunOnDestroy, mailToHelper } from 'Common/UtilsUser';
|
||||
|
|
@ -892,9 +892,7 @@ class AppUser extends AbstractApp {
|
|||
}
|
||||
|
||||
bootend() {
|
||||
if (window.progressJs) {
|
||||
progressJs.end();
|
||||
}
|
||||
this.hideLoading();
|
||||
}
|
||||
|
||||
|
|
@ -911,9 +909,7 @@ class AppUser extends AbstractApp {
|
|||
|
||||
const startupUrl = pString(Settings.get('StartupUrl'));
|
||||
|
||||
if (window.progressJs) {
|
||||
progressJs.set(90);
|
||||
}
|
||||
|
||||
rl.setWindowTitle();
|
||||
if (Settings.get('Auth')) {
|
||||
|
|
|
|||
|
|
@ -9,12 +9,6 @@ export const $htmlCL = $html.classList;
|
|||
*/
|
||||
export const dropdownVisibility = ko.observable(false).extend({ rateLimit: 0 });
|
||||
|
||||
export const VIEW_MODELS = {
|
||||
settings: [],
|
||||
'settings-removed': [],
|
||||
'settings-disabled': []
|
||||
};
|
||||
|
||||
export const moveAction = ko.observable(false);
|
||||
export const leftPanelDisabled = ko.observable(false);
|
||||
export const leftPanelType = ko.observable('');
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import * as Knoin from 'Knoin/Knoin';
|
||||
import { settingsAddViewModel } from 'Screen/AbstractSettings';
|
||||
|
||||
const USER_VIEW_MODELS_HOOKS = [],
|
||||
ADMIN_VIEW_MODELS_HOOKS = [];
|
||||
|
|
@ -48,7 +48,7 @@ export function addSettingsViewModelForAdmin(SettingsViewModelClass, template, l
|
|||
*/
|
||||
export function runSettingsViewModelHooks(admin) {
|
||||
(admin ? ADMIN_VIEW_MODELS_HOOKS : USER_VIEW_MODELS_HOOKS).forEach(view => {
|
||||
Knoin.settingsAddViewModel(view[0], view[1], view[2], view[3]);
|
||||
settingsAddViewModel(view[0], view[1], view[2], view[3]);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
5
dev/External/Admin/ko.js
vendored
5
dev/External/Admin/ko.js
vendored
|
|
@ -1,6 +1,7 @@
|
|||
import 'External/ko';
|
||||
import ko from 'ko';
|
||||
import { SaveSettingsStep } from 'Common/Enums';
|
||||
import { pInt } from 'Common/Utils';
|
||||
import ko from 'External/ko';
|
||||
|
||||
ko.bindingHandlers.saveTrigger = {
|
||||
init: (element) => {
|
||||
|
|
@ -63,5 +64,3 @@ ko.extenders.posInterer = (target, defaultVal) => {
|
|||
ko.observable.fn.idleTrigger = function() {
|
||||
return this.extend({ 'idleTrigger': true });
|
||||
};
|
||||
|
||||
export default ko;
|
||||
|
|
|
|||
5
dev/External/User/ko.js
vendored
5
dev/External/User/ko.js
vendored
|
|
@ -1,4 +1,5 @@
|
|||
import ko from 'External/ko';
|
||||
import 'External/ko';
|
||||
import ko from 'ko';
|
||||
import { HtmlEditor } from 'Common/Html';
|
||||
import { timeToNode } from 'Common/Momentor';
|
||||
import { EmailModel } from 'Model/Email';
|
||||
|
|
@ -287,5 +288,3 @@ ko.extenders.specialThrottle = (target, timeout) => {
|
|||
|
||||
return target;
|
||||
};
|
||||
|
||||
export default ko;
|
||||
|
|
|
|||
2
dev/External/ko.js
vendored
2
dev/External/ko.js
vendored
|
|
@ -273,5 +273,3 @@ ko.addComputablesTo = (target, computables) =>
|
|||
|
||||
ko.addSubscribablesTo = (target, subscribables) =>
|
||||
Object.entries(subscribables).forEach(([key, fn]) => target[key].subscribe(fn));
|
||||
|
||||
export default ko;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { $htmlCL, VIEW_MODELS } from 'Common/Globals';
|
||||
import { $htmlCL } from 'Common/Globals';
|
||||
|
||||
let currentScreen = null,
|
||||
defaultScreenName = '',
|
||||
|
|
@ -50,25 +50,6 @@ export function createCommand(fExecute, fCanExecute = true) {
|
|||
return fResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Function} SettingsViewModelClass
|
||||
* @param {string} template
|
||||
* @param {string} labelName
|
||||
* @param {string} route
|
||||
* @param {boolean=} isDefault = false
|
||||
* @returns {void}
|
||||
*/
|
||||
export function settingsAddViewModel(SettingsViewModelClass, template, labelName, route, isDefault = false) {
|
||||
SettingsViewModelClass.__rlSettingsData = {
|
||||
Label: labelName,
|
||||
Template: template,
|
||||
Route: route,
|
||||
IsDefault: !!isDefault
|
||||
};
|
||||
|
||||
VIEW_MODELS.settings.push(SettingsViewModelClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} screenName
|
||||
* @returns {?Object}
|
||||
|
|
@ -77,22 +58,13 @@ export function screen(screenName) {
|
|||
return screenName && null != SCREENS[screenName] ? SCREENS[screenName] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Function} ViewModelClassToShow
|
||||
* @returns {Function|null}
|
||||
*/
|
||||
function getScreenPopup(PopuViewModelClass) {
|
||||
return PopuViewModelClass ? PopuViewModelClass.default || PopuViewModelClass : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Function} ViewModelClassToHide
|
||||
* @returns {void}
|
||||
*/
|
||||
export function hideScreenPopup(ViewModelClassToHide) {
|
||||
const ModalView = getScreenPopup(ViewModelClassToHide);
|
||||
if (ModalView && ModalView.__vm && ModalView.__dom) {
|
||||
ModalView.__vm.modalVisibility(false);
|
||||
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom) {
|
||||
ViewModelClassToHide.__vm.modalVisibility(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -184,8 +156,7 @@ function buildViewModel(ViewModelClass, vmScreen) {
|
|||
}
|
||||
|
||||
function getScreenPopupViewModel(ViewModelClassToShow) {
|
||||
const ModalView = getScreenPopup(ViewModelClassToShow);
|
||||
return (buildViewModel(ModalView) && ModalView.__dom) && ModalView.__vm;
|
||||
return (buildViewModel(ViewModelClassToShow) && ViewModelClassToShow.__dom) && ViewModelClassToShow.__vm;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -220,8 +191,7 @@ export function warmUpScreenPopup(ViewModelClassToShow) {
|
|||
* @returns {boolean}
|
||||
*/
|
||||
export function isPopupVisible(ViewModelClassToShow) {
|
||||
const ModalView = getScreenPopup(ViewModelClassToShow);
|
||||
return ModalView && ModalView.__vm && ModalView.__vm.modalVisibility();
|
||||
return ViewModelClassToShow && ViewModelClassToShow.__vm && ViewModelClassToShow.__vm.modalVisibility();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { VIEW_MODELS } from 'Common/Globals';
|
||||
import { pString } from 'Common/Utils';
|
||||
import { settings } from 'Common/Links';
|
||||
|
||||
import { AbstractScreen } from 'Knoin/AbstractScreen';
|
||||
|
||||
const VIEW_MODELS = [];
|
||||
|
||||
export class AbstractSettingsScreen extends AbstractScreen {
|
||||
/**
|
||||
* @param {Array} viewModels
|
||||
|
|
@ -34,32 +35,11 @@ export class AbstractSettingsScreen extends AbstractScreen {
|
|||
RoutedSettingsViewModel = null,
|
||||
viewModelDom = null;
|
||||
|
||||
RoutedSettingsViewModel = VIEW_MODELS.settings.find(
|
||||
RoutedSettingsViewModel = VIEW_MODELS.find(
|
||||
SettingsViewModel =>
|
||||
SettingsViewModel && SettingsViewModel.__rlSettingsData && subName === SettingsViewModel.__rlSettingsData.Route
|
||||
);
|
||||
|
||||
if (RoutedSettingsViewModel) {
|
||||
if (
|
||||
VIEW_MODELS['settings-removed'].find(
|
||||
DisabledSettingsViewModel =>
|
||||
DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel
|
||||
)
|
||||
) {
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
|
||||
if (
|
||||
RoutedSettingsViewModel &&
|
||||
VIEW_MODELS['settings-disabled'].find(
|
||||
DisabledSettingsViewModel =>
|
||||
DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel
|
||||
)
|
||||
) {
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (RoutedSettingsViewModel) {
|
||||
if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm) {
|
||||
settingsScreen = RoutedSettingsViewModel.__vm;
|
||||
|
|
@ -139,28 +119,23 @@ export class AbstractSettingsScreen extends AbstractScreen {
|
|||
}
|
||||
|
||||
onBuild() {
|
||||
VIEW_MODELS.settings.forEach(SettingsViewModel => {
|
||||
VIEW_MODELS.forEach(SettingsViewModel => {
|
||||
if (
|
||||
SettingsViewModel &&
|
||||
SettingsViewModel.__rlSettingsData &&
|
||||
!VIEW_MODELS['settings-removed'].find(
|
||||
RemoveSettingsViewModel => RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel
|
||||
)
|
||||
SettingsViewModel.__rlSettingsData
|
||||
) {
|
||||
this.menu.push({
|
||||
route: SettingsViewModel.__rlSettingsData.Route,
|
||||
label: SettingsViewModel.__rlSettingsData.Label,
|
||||
selected: ko.observable(false),
|
||||
disabled: !!VIEW_MODELS['settings-disabled'].find(
|
||||
DisabledSettingsViewModel => DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel
|
||||
)
|
||||
disabled: false
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
routes() {
|
||||
const DefaultViewModel = VIEW_MODELS.settings.find(
|
||||
const DefaultViewModel = VIEW_MODELS.find(
|
||||
SettingsViewModel =>
|
||||
SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData.IsDefault
|
||||
),
|
||||
|
|
@ -181,3 +156,22 @@ export class AbstractSettingsScreen extends AbstractScreen {
|
|||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Function} SettingsViewModelClass
|
||||
* @param {string} template
|
||||
* @param {string} labelName
|
||||
* @param {string} route
|
||||
* @param {boolean=} isDefault = false
|
||||
* @returns {void}
|
||||
*/
|
||||
export function settingsAddViewModel(SettingsViewModelClass, template, labelName, route, isDefault = false) {
|
||||
SettingsViewModelClass.__rlSettingsData = {
|
||||
Label: labelName,
|
||||
Template: template,
|
||||
Route: route,
|
||||
IsDefault: !!isDefault
|
||||
};
|
||||
|
||||
VIEW_MODELS.push(SettingsViewModelClass);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { settingsAddViewModel } from 'Knoin/Knoin';
|
||||
import { runSettingsViewModelHooks } from 'Common/Plugins';
|
||||
|
||||
import { AbstractSettingsScreen } from 'Screen/AbstractSettings';
|
||||
import { AbstractSettingsScreen, settingsAddViewModel } from 'Screen/AbstractSettings';
|
||||
|
||||
import { GeneralAdminSettings } from 'Settings/Admin/General';
|
||||
import { DomainsAdminSettings } from 'Settings/Admin/Domains';
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@ import { initOnStartOrLangChange, i18n } from 'Common/Translator';
|
|||
import AppStore from 'Stores/User/App';
|
||||
import AccountStore from 'Stores/User/Account';
|
||||
|
||||
import { settingsAddViewModel } from 'Knoin/Knoin';
|
||||
|
||||
import { AbstractSettingsScreen } from 'Screen/AbstractSettings';
|
||||
import { AbstractSettingsScreen, settingsAddViewModel } from 'Screen/AbstractSettings';
|
||||
|
||||
import { GeneralUserSettings } from 'Settings/User/General';
|
||||
import { ContactsUserSettings } from 'Settings/User/Contacts';
|
||||
|
|
|
|||
|
|
@ -20,17 +20,18 @@ export class SecurityUserSettings {
|
|||
this.autoLogout = SettinsStore.autoLogout;
|
||||
this.autoLogout.trigger = ko.observable(SaveSettingsStep.Idle);
|
||||
|
||||
let i18nLogout = (key, params) => i18n('SETTINGS_SECURITY/AUTOLOGIN_' + key, params);
|
||||
this.autoLogoutOptions = ko.computed(() => {
|
||||
translatorTrigger();
|
||||
return [
|
||||
{ 'id': 0, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_NEVER_OPTION_NAME') },
|
||||
{ 'id': 5, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', { 'MINUTES': 5 }) },
|
||||
{ 'id': 10, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', { 'MINUTES': 10 }) },
|
||||
{ 'id': 30, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', { 'MINUTES': 30 }) },
|
||||
{ 'id': 60, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', { 'MINUTES': 60 }) },
|
||||
{ 'id': 60 * 2, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', { 'HOURS': 2 }) },
|
||||
{ 'id': 60 * 5, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', { 'HOURS': 5 }) },
|
||||
{ 'id': 60 * 10, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', { 'HOURS': 10 }) }
|
||||
{ 'id': 0, 'name': i18nLogout('NEVER_OPTION_NAME') },
|
||||
{ 'id': 5, 'name': i18nLogout('MINUTES_OPTION_NAME', { 'MINUTES': 5 }) },
|
||||
{ 'id': 10, 'name': i18nLogout('MINUTES_OPTION_NAME', { 'MINUTES': 10 }) },
|
||||
{ 'id': 30, 'name': i18nLogout('MINUTES_OPTION_NAME', { 'MINUTES': 30 }) },
|
||||
{ 'id': 60, 'name': i18nLogout('MINUTES_OPTION_NAME', { 'MINUTES': 60 }) },
|
||||
{ 'id': 60 * 2, 'name': i18nLogout('HOURS_OPTION_NAME', { 'HOURS': 2 }) },
|
||||
{ 'id': 60 * 5, 'name': i18nLogout('HOURS_OPTION_NAME', { 'HOURS': 5 }) },
|
||||
{ 'id': 60 * 10, 'name': i18nLogout('HOURS_OPTION_NAME', { 'HOURS': 10 }) }
|
||||
];
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,16 +25,17 @@ class AdvancedSearchPopupView extends AbstractViewPopup {
|
|||
unseen: false
|
||||
});
|
||||
|
||||
let prefix = 'SEARCH/LABEL_ADV_DATE_';
|
||||
this.selectedDates = ko.computed(() => {
|
||||
translatorTrigger();
|
||||
return [
|
||||
{ id: -1, name: i18n('SEARCH/LABEL_ADV_DATE_ALL') },
|
||||
{ id: 3, name: i18n('SEARCH/LABEL_ADV_DATE_3_DAYS') },
|
||||
{ id: 7, name: i18n('SEARCH/LABEL_ADV_DATE_7_DAYS') },
|
||||
{ id: 30, name: i18n('SEARCH/LABEL_ADV_DATE_MONTH') },
|
||||
{ id: 90, name: i18n('SEARCH/LABEL_ADV_DATE_3_MONTHS') },
|
||||
{ id: 180, name: i18n('SEARCH/LABEL_ADV_DATE_6_MONTHS') },
|
||||
{ id: 365, name: i18n('SEARCH/LABEL_ADV_DATE_YEAR') }
|
||||
{ id: -1, name: i18n(prefix + 'ALL') },
|
||||
{ id: 3, name: i18n(prefix + '3_DAYS') },
|
||||
{ id: 7, name: i18n(prefix + '7_DAYS') },
|
||||
{ id: 30, name: i18n(prefix + 'MONTH') },
|
||||
{ id: 90, name: i18n(prefix + '3_MONTHS') },
|
||||
{ id: 180, name: i18n(prefix + '6_MONTHS') },
|
||||
{ id: 365, name: i18n(prefix + 'YEAR') }
|
||||
];
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,14 +12,15 @@ import { EmailModel } from 'Model/Email';
|
|||
import { command } from 'Knoin/Knoin';
|
||||
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
||||
|
||||
const KEY_NAME_SUBSTR = -8;
|
||||
const KEY_NAME_SUBSTR = -8,
|
||||
i18nPGP = (key, params) => i18n('PGP_NOTIFICATIONS/' + key, params);
|
||||
|
||||
class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
||||
constructor() {
|
||||
super('ComposeOpenPgp');
|
||||
|
||||
this.publicKeysOptionsCaption = i18n('PGP_NOTIFICATIONS/ADD_A_PUBLICK_KEY');
|
||||
this.privateKeysOptionsCaption = i18n('PGP_NOTIFICATIONS/SELECT_A_PRIVATE_KEY');
|
||||
this.publicKeysOptionsCaption = i18nPGP('ADD_A_PUBLICK_KEY');
|
||||
this.privateKeysOptionsCaption = i18nPGP('SELECT_A_PRIVATE_KEY');
|
||||
|
||||
this.addObservables({
|
||||
notification: '',
|
||||
|
|
@ -114,11 +115,11 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
|||
|
||||
if (result && this.sign()) {
|
||||
if (!this.signKey()) {
|
||||
this.notification(i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND'));
|
||||
this.notification(i18nPGP('NO_PRIVATE_KEY_FOUND'));
|
||||
result = false;
|
||||
} else if (!this.signKey().key) {
|
||||
this.notification(
|
||||
i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR', {
|
||||
i18nPGP('NO_PRIVATE_KEY_FOUND_FOR', {
|
||||
'EMAIL': this.signKey().email
|
||||
})
|
||||
);
|
||||
|
|
@ -139,7 +140,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
|||
}
|
||||
|
||||
if (!privateKey) {
|
||||
this.notification(i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND'));
|
||||
this.notification(i18nPGP('NO_PRIVATE_KEY_FOUND'));
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -154,7 +155,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
|||
aPublicKeys = aPublicKeys.concat(oKey.key.getNativeKeys().flat(Infinity).filter(v => v));
|
||||
} else if (oKey && oKey.email) {
|
||||
this.notification(
|
||||
i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR', {
|
||||
i18nPGP('NO_PUBLIC_KEYS_FOUND_FOR', {
|
||||
'EMAIL': oKey.email
|
||||
})
|
||||
);
|
||||
|
|
@ -167,7 +168,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
|||
result = false;
|
||||
}
|
||||
} else {
|
||||
this.notification(i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND'));
|
||||
this.notification(i18nPGP('NO_PUBLIC_KEYS_FOUND'));
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -200,7 +201,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
|||
console.log(e);
|
||||
|
||||
this.notification(
|
||||
i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
||||
i18nPGP('PGP_ERROR', {
|
||||
'ERROR': '' + e
|
||||
})
|
||||
);
|
||||
|
|
@ -215,16 +216,14 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
|
|||
})
|
||||
.catch((e) => {
|
||||
this.notification(
|
||||
i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
||||
i18nPGP('PGP_ERROR', {
|
||||
'ERROR': '' + e
|
||||
})
|
||||
);
|
||||
});
|
||||
} catch (e) {
|
||||
this.notification(
|
||||
i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
||||
'ERROR': '' + e
|
||||
})
|
||||
i18nPGP('PGP_ERROR', {'ERROR': '' + e})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,19 +60,21 @@ class FilterPopupView extends AbstractViewPopup {
|
|||
populateOptions() {
|
||||
this.actionTypeOptions([]);
|
||||
|
||||
let i18nFilter = key => i18n('POPUPS_FILTER/SELECT_' + key);
|
||||
|
||||
this.fieldOptions([
|
||||
{ 'id': FilterConditionField.From, 'name': i18n('GLOBAL/FROM') },
|
||||
{ 'id': FilterConditionField.Recipient, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_RECIPIENTS') },
|
||||
{ 'id': FilterConditionField.Recipient, 'name': i18nFilter('FIELD_RECIPIENTS') },
|
||||
{ 'id': FilterConditionField.Subject, 'name': i18n('GLOBAL/SUBJECT') },
|
||||
{ 'id': FilterConditionField.Size, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_SIZE') },
|
||||
{ 'id': FilterConditionField.Header, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_HEADER') }
|
||||
{ 'id': FilterConditionField.Size, 'name': i18nFilter('FIELD_SIZE') },
|
||||
{ 'id': FilterConditionField.Header, 'name': i18nFilter('FIELD_HEADER') }
|
||||
]);
|
||||
|
||||
this.typeOptions([
|
||||
{ 'id': FilterConditionType.Contains, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_CONTAINS') },
|
||||
{ 'id': FilterConditionType.NotContains, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_NOT_CONTAINS') },
|
||||
{ 'id': FilterConditionType.EqualTo, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_EQUAL_TO') },
|
||||
{ 'id': FilterConditionType.NotEqualTo, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_NOT_EQUAL_TO') }
|
||||
{ 'id': FilterConditionType.Contains, 'name': i18nFilter('TYPE_CONTAINS') },
|
||||
{ 'id': FilterConditionType.NotContains, 'name': i18nFilter('TYPE_NOT_CONTAINS') },
|
||||
{ 'id': FilterConditionType.EqualTo, 'name': i18nFilter('TYPE_EQUAL_TO') },
|
||||
{ 'id': FilterConditionType.NotEqualTo, 'name': i18nFilter('TYPE_NOT_EQUAL_TO') }
|
||||
]);
|
||||
|
||||
// this.actionTypeOptions.push({'id': FilterAction.None,
|
||||
|
|
@ -86,27 +88,27 @@ class FilterPopupView extends AbstractViewPopup {
|
|||
if (modules.includes('fileinto')) {
|
||||
this.actionTypeOptions.push({
|
||||
'id': FilterAction.MoveTo,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_MOVE_TO')
|
||||
'name': i18nFilter('ACTION_MOVE_TO')
|
||||
});
|
||||
this.actionTypeOptions.push({
|
||||
'id': FilterAction.Forward,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_FORWARD_TO')
|
||||
'name': i18nFilter('ACTION_FORWARD_TO')
|
||||
});
|
||||
}
|
||||
|
||||
if (modules.includes('reject')) {
|
||||
this.actionTypeOptions.push({ 'id': FilterAction.Reject, 'name': i18n('POPUPS_FILTER/SELECT_ACTION_REJECT') });
|
||||
this.actionTypeOptions.push({ 'id': FilterAction.Reject, 'name': i18nFilter('ACTION_REJECT') });
|
||||
}
|
||||
|
||||
if (modules.includes('vacation')) {
|
||||
this.actionTypeOptions.push({
|
||||
'id': FilterAction.Vacation,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_VACATION_MESSAGE')
|
||||
'name': i18nFilter('ACTION_VACATION_MESSAGE')
|
||||
});
|
||||
}
|
||||
|
||||
if (modules.includes('body')) {
|
||||
this.fieldOptions.push({ 'id': FilterConditionField.Body, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_BODY') });
|
||||
this.fieldOptions.push({ 'id': FilterConditionField.Body, 'name': i18nFilter('FIELD_BODY') });
|
||||
}
|
||||
|
||||
if (modules.includes('regex')) {
|
||||
|
|
@ -114,16 +116,16 @@ class FilterPopupView extends AbstractViewPopup {
|
|||
}
|
||||
}
|
||||
|
||||
this.actionTypeOptions.push({ 'id': FilterAction.Discard, 'name': i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD') });
|
||||
this.actionTypeOptions.push({ 'id': FilterAction.Discard, 'name': i18nFilter('ACTION_DISCARD') });
|
||||
|
||||
this.typeOptionsSize([
|
||||
{ 'id': FilterConditionType.Over, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_OVER') },
|
||||
{ 'id': FilterConditionType.Under, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_UNDER') }
|
||||
{ 'id': FilterConditionType.Over, 'name': i18nFilter('TYPE_OVER') },
|
||||
{ 'id': FilterConditionType.Under, 'name': i18nFilter('TYPE_UNDER') }
|
||||
]);
|
||||
|
||||
this.typeOptionsBody([
|
||||
{ 'id': FilterConditionType.Text, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_TEXT') },
|
||||
{ 'id': FilterConditionType.Raw, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_RAW') }
|
||||
{ 'id': FilterConditionType.Text, 'name': i18nFilter('TYPE_TEXT') },
|
||||
{ 'id': FilterConditionType.Raw, 'name': i18nFilter('TYPE_RAW') }
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,22 +89,22 @@ class FolderSystemPopupView extends AbstractViewPopup {
|
|||
* @param {number=} notificationType = SetSystemFoldersNotification.None
|
||||
*/
|
||||
onShow(notificationType = SetSystemFoldersNotification.None) {
|
||||
let notification = '';
|
||||
let notification = '', prefix = 'POPUPS_SYSTEM_FOLDERS/NOTIFICATION_';
|
||||
switch (notificationType) {
|
||||
case SetSystemFoldersNotification.Sent:
|
||||
notification = i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT');
|
||||
notification = i18n(prefix + 'SENT');
|
||||
break;
|
||||
case SetSystemFoldersNotification.Draft:
|
||||
notification = i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS');
|
||||
notification = i18n(prefix + 'DRAFTS');
|
||||
break;
|
||||
case SetSystemFoldersNotification.Spam:
|
||||
notification = i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM');
|
||||
notification = i18n(prefix + 'SPAM');
|
||||
break;
|
||||
case SetSystemFoldersNotification.Trash:
|
||||
notification = i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH');
|
||||
notification = i18n(prefix + 'TRASH');
|
||||
break;
|
||||
case SetSystemFoldersNotification.Archive:
|
||||
notification = i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE');
|
||||
notification = i18n(prefix + 'ARCHIVE');
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue