Code refactoring

Flow first look
This commit is contained in:
RainLoop Team 2016-09-10 01:38:16 +03:00
parent 2f841524cb
commit e6e0b02849
71 changed files with 2092 additions and 1836 deletions

View file

@ -2,18 +2,17 @@
import _ from '_';
import ko from 'ko';
import {trim, createCommand} from 'Common/Utils';
import {trim} from 'Common/Utils';
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
import {searchSubtractFormatDateHelper} from 'Common/Momentor';
import MessageStore from 'Stores/User/Message';
import {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/AdvancedSearch',
type: ViewType.Popup,
templateID: 'PopupsAdvancedSearch'
})
class AdvancedSearchPopupView extends AbstractViewNext
@ -33,16 +32,6 @@ class AdvancedSearchPopupView extends AbstractViewNext
this.starred = ko.observable(false);
this.unseen = ko.observable(false);
this.searchCommand = createCommand(() => {
const search = this.buildSearchString();
if ('' !== search)
{
MessageStore.mainMessageListSearch(search);
}
this.cancelCommand();
});
this.selectedDates = ko.computed(() => {
translatorTrigger();
return [
@ -57,6 +46,17 @@ class AdvancedSearchPopupView extends AbstractViewNext
});
}
@command()
searchCommand() {
const search = this.buildSearchString();
if ('' !== search)
{
MessageStore.mainMessageListSearch(search);
}
this.cancelCommand();
}
parseSearchStringValue(search) {
const parts = (search || '').split(/[\s]+/g);
_.each(parts, (part) => {
@ -171,4 +171,4 @@ class AdvancedSearchPopupView extends AbstractViewNext
}
}
module.exports = AdvancedSearchPopupView;
export {AdvancedSearchPopupView, AdvancedSearchPopupView as default};