mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 12:39:20 +03:00
Filter improvements
This commit is contained in:
parent
f91f74fe7c
commit
05b1c1dfe5
14 changed files with 222 additions and 68 deletions
|
|
@ -25,11 +25,20 @@
|
|||
this.value = ko.observable('');
|
||||
this.value.error = ko.observable(false);
|
||||
|
||||
this.valueSecond = ko.observable('');
|
||||
this.valueSecond.error = ko.observable(false);
|
||||
|
||||
this.template = ko.computed(function () {
|
||||
|
||||
var sTemplate = '';
|
||||
switch (this.type())
|
||||
switch (this.field())
|
||||
{
|
||||
case Enums.FilterConditionField.Size:
|
||||
sTemplate = 'SettingsFiltersConditionSize';
|
||||
break;
|
||||
case Enums.FilterConditionField.Header:
|
||||
sTemplate = 'SettingsFiltersConditionMore';
|
||||
break;
|
||||
default:
|
||||
sTemplate = 'SettingsFiltersConditionDefault';
|
||||
break;
|
||||
|
|
@ -39,6 +48,11 @@
|
|||
|
||||
}, this);
|
||||
|
||||
this.field.subscribe(function () {
|
||||
this.value('');
|
||||
this.valueSecond('');
|
||||
}, this);
|
||||
|
||||
this.regDisposables([this.template]);
|
||||
}
|
||||
|
||||
|
|
@ -52,6 +66,12 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
if (Enums.FilterConditionField.Header === this.field() && '' === this.valueSecond())
|
||||
{
|
||||
this.valueSecond.error(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
@ -62,6 +82,7 @@
|
|||
this.field(Utils.pString(oItem['Field']));
|
||||
this.type(Utils.pString(oItem['Type']));
|
||||
this.value(Utils.pString(oItem['Value']));
|
||||
this.valueSecond(Utils.pString(oItem['ValueSecond']));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -74,7 +95,8 @@
|
|||
return {
|
||||
'Field': this.field(),
|
||||
'Type': this.type(),
|
||||
'Value': this.value()
|
||||
'Value': this.value(),
|
||||
'ValueSecond': this.valueSecond()
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -85,6 +107,7 @@
|
|||
oClone.field(this.field());
|
||||
oClone.type(this.type());
|
||||
oClone.value(this.value());
|
||||
oClone.valueSecond(this.valueSecond());
|
||||
|
||||
return oClone;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue