mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 13:09:21 +03:00
Improved js minification
This commit is contained in:
parent
8884adcb72
commit
b31bf3d7f5
16 changed files with 99 additions and 150 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue