Fix search builder

This commit is contained in:
RainLoop Team 2016-06-24 21:34:11 +03:00
parent 68890f8083
commit 3217303a65
3 changed files with 26 additions and 3 deletions

View file

@ -31,7 +31,7 @@ export function momentNowUnix()
*/
export function searchSubtractFormatDateHelper(date)
{
momentNow().clone().subtract('days', date).format('YYYY.MM.DD');
return momentNow().clone().subtract('days', date).format('YYYY.MM.DD');
}
/**

View file

@ -66,6 +66,28 @@
kn.extendAsViewModel(['View/Popup/AdvancedSearch', 'PopupsAdvancedSearchViewModel'], AdvancedSearchPopupView);
_.extend(AdvancedSearchPopupView.prototype, AbstractView.prototype);
AdvancedSearchPopupView.prototype.parseSearchStringValue = function (search)
{
var
self = this,
parts = (search || '').split(/[\s]+/g)
;
_.each(parts, function(part){
switch (part)
{
case 'has:attachment':
self.hasAttachment(true);
break;
case 'is:unseen,flagged':
self.starred(true);
case 'is:unseen':
self.unseen(true);
break;
}
});
};
AdvancedSearchPopupView.prototype.buildSearchStringValue = function (sValue)
{
if (-1 < sValue.indexOf(' '))
@ -156,9 +178,10 @@
this.fromFocus(true);
};
AdvancedSearchPopupView.prototype.onShow = function ()
AdvancedSearchPopupView.prototype.onShow = function (search)
{
this.clearPopup();
this.parseSearchStringValue(search);
};
AdvancedSearchPopupView.prototype.onShowWithDelay = function ()

View file

@ -1005,7 +1005,7 @@
{
if (Settings.capa(Enums.Capa.SearchAdv))
{
kn.showScreenPopup(require('View/Popup/AdvancedSearch'));
kn.showScreenPopup(require('View/Popup/AdvancedSearch'), [this.mainMessageListSearch()]);
}
};