mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
Cleanup some JavaScript
This commit is contained in:
parent
18fbf332c2
commit
24b638cd82
16 changed files with 64 additions and 88 deletions
|
|
@ -4,7 +4,6 @@ import { i18n, trigger as translatorTrigger } from 'Common/Translator';
|
|||
|
||||
import { MessageUserStore } from 'Stores/User/Message';
|
||||
|
||||
import { decorateKoCommands } from 'Knoin/Knoin';
|
||||
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
||||
import { FolderUserStore } from 'Stores/User/Folder';
|
||||
|
||||
|
|
@ -50,13 +49,9 @@ class AdvancedSearchPopupView extends AbstractViewPopup {
|
|||
{ id: 'subtree', name: i18n(prefix + 'SUBTREE') }
|
||||
];
|
||||
});
|
||||
|
||||
decorateKoCommands(this, {
|
||||
searchCommand: 1
|
||||
});
|
||||
}
|
||||
|
||||
searchCommand() {
|
||||
submitForm() {
|
||||
const search = this.buildSearchString();
|
||||
if (search) {
|
||||
MessageUserStore.mainMessageListSearch(search);
|
||||
|
|
|
|||
|
|
@ -136,17 +136,15 @@ class ContactsPopupView extends AbstractViewPopup {
|
|||
});
|
||||
|
||||
decorateKoCommands(this, {
|
||||
newCommand: 1,
|
||||
deleteCommand: self => 0 < self.contactsCheckedOrSelected().length,
|
||||
newMessageCommand: self => 0 < self.contactsCheckedOrSelected().length,
|
||||
clearCommand: 1,
|
||||
saveCommand: self => !self.viewSaving() && !self.viewReadOnly()
|
||||
&& (self.contactHasValidName() || self.viewProperties.find(prop => propertyIsMail(prop) && prop.isValid())),
|
||||
syncCommand: self => !self.contacts.syncing() && !self.contacts.importing()
|
||||
});
|
||||
}
|
||||
|
||||
newCommand() {
|
||||
newContact() {
|
||||
this.populateViewContact(null);
|
||||
this.currentContact(null);
|
||||
}
|
||||
|
|
@ -207,7 +205,7 @@ class ContactsPopupView extends AbstractViewPopup {
|
|||
return true;
|
||||
}
|
||||
|
||||
clearCommand() {
|
||||
clearSearch() {
|
||||
this.search('');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import { i18n, initOnStartOrLangChange } from 'Common/Translator';
|
|||
|
||||
import { SieveUserStore } from 'Stores/User/Sieve';
|
||||
|
||||
import { decorateKoCommands } from 'Knoin/Knoin';
|
||||
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
||||
|
||||
import { folderListOptionsBuilder } from 'Common/UtilsUser';
|
||||
|
|
@ -45,13 +44,9 @@ class FilterPopupView extends AbstractViewPopup {
|
|||
initOnStartOrLangChange(this.populateOptions.bind(this));
|
||||
|
||||
SieveUserStore.capa.subscribe(this.populateOptions, this);
|
||||
|
||||
decorateKoCommands(this, {
|
||||
saveFilterCommand: 1
|
||||
});
|
||||
}
|
||||
|
||||
saveFilterCommand() {
|
||||
saveFilter() {
|
||||
if (this.filter()) {
|
||||
if (FilterAction.MoveTo === this.filter().actionType()) {
|
||||
this.filter().actionValue(this.selectedFolderValue());
|
||||
|
|
|
|||
|
|
@ -19,17 +19,11 @@ class FolderClearPopupView extends AbstractViewPopup {
|
|||
});
|
||||
|
||||
this.addComputables({
|
||||
folderFullNameForClear: () => {
|
||||
dangerDescHtml: () => {
|
||||
const folder = this.selectedFolder();
|
||||
return folder ? folder.printableFullName() : '';
|
||||
},
|
||||
|
||||
folderNameForClear: () => {
|
||||
const folder = this.selectedFolder();
|
||||
return folder ? folder.localName() : '';
|
||||
},
|
||||
|
||||
dangerDescHtml: () => i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', { FOLDER: this.folderNameForClear() })
|
||||
// return i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', { FOLDER: folder ? folder.fullName.replace(folder.delimiter, ' / ') : '' });
|
||||
return i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', { FOLDER: folder ? folder.localName() : '' });
|
||||
}
|
||||
});
|
||||
|
||||
decorateKoCommands(this, {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import Remote from 'Remote/User/Fetch';
|
|||
import { FilterModel } from 'Model/Filter';
|
||||
import { SieveUserStore } from 'Stores/User/Sieve';
|
||||
|
||||
import { showScreenPopup/*, decorateKoCommands*/ } from 'Knoin/Knoin';
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
||||
|
||||
import { FilterPopupView } from 'View/Popup/Filter';
|
||||
|
|
@ -28,14 +28,9 @@ class SieveScriptPopupView extends AbstractViewPopup {
|
|||
this.saving = false;
|
||||
|
||||
this.filterForDeletion = ko.observable(null).askDeleteHelper();
|
||||
/*
|
||||
decorateKoCommands(this, {
|
||||
saveScriptCommand: 1
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
saveScriptCommand() {
|
||||
saveScript() {
|
||||
let self = this,
|
||||
script = self.script();
|
||||
if (!self.saving/* && script.hasChanges()*/) {
|
||||
|
|
|
|||
|
|
@ -237,8 +237,6 @@ export class MailMessageList extends AbstractViewRight {
|
|||
).throttle(50));
|
||||
|
||||
decorateKoCommands(this, {
|
||||
clearCommand: 1,
|
||||
reloadCommand: 1,
|
||||
multyForwardCommand: canBeMovedHelper,
|
||||
deleteWithoutMoveCommand: canBeMovedHelper,
|
||||
deleteCommand: canBeMovedHelper,
|
||||
|
|
@ -252,16 +250,16 @@ export class MailMessageList extends AbstractViewRight {
|
|||
|
||||
changeSort(self, event) {
|
||||
FolderUserStore.sortMode(event.target.closest('li').dataset.sort);
|
||||
this.reloadCommand();
|
||||
this.reload();
|
||||
}
|
||||
|
||||
clearCommand() {
|
||||
clear() {
|
||||
if (SettingsCapa(Capa.DangerousActions)) {
|
||||
showScreenPopup(FolderClearPopupView, [FolderUserStore.currentFolder()]);
|
||||
}
|
||||
}
|
||||
|
||||
reloadCommand() {
|
||||
reload() {
|
||||
if (!MessageUserStore.listIsLoading()) {
|
||||
rl.app.reloadMessageList(false, true);
|
||||
}
|
||||
|
|
@ -707,7 +705,7 @@ export class MailMessageList extends AbstractViewRight {
|
|||
|
||||
// check mail
|
||||
shortcuts.add('r', 'meta', [Scope.FolderList, Scope.MessageList, Scope.MessageView], () => {
|
||||
this.reloadCommand();
|
||||
this.reload();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -231,14 +231,13 @@ export class MailMessageView extends AbstractViewRight {
|
|||
addEventListener('mailbox.message-view.toggle-full-screen', () => this.toggleFullScreen());
|
||||
|
||||
decorateKoCommands(this, {
|
||||
closeMessageCommand: 1,
|
||||
messageEditCommand: self => self.messageVisibility(),
|
||||
goUpCommand: self => !self.messageListOrViewLoading(),
|
||||
goDownCommand: self => !self.messageListOrViewLoading()
|
||||
});
|
||||
}
|
||||
|
||||
closeMessageCommand() {
|
||||
closeMessage() {
|
||||
MessageUserStore.message(null);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue