mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Merged from sub repository (filters - step 4)
This commit is contained in:
parent
67e45a6a6f
commit
e4b286e257
58 changed files with 1176 additions and 236 deletions
|
|
@ -16,29 +16,12 @@
|
|||
* @param {*} oKoList
|
||||
* @constructor
|
||||
*/
|
||||
function FilterConditionModel(oKoList)
|
||||
function FilterConditionModel()
|
||||
{
|
||||
AbstractModel.call(this, 'FilterConditionModel');
|
||||
|
||||
this.parentList = oKoList;
|
||||
|
||||
this.field = ko.observable(Enums.FilterConditionField.From);
|
||||
|
||||
this.fieldOptions = [ // TODO i18n
|
||||
{'id': Enums.FilterConditionField.From, 'name': 'From'},
|
||||
{'id': Enums.FilterConditionField.Recipient, 'name': 'Recipient (To or CC)'},
|
||||
{'id': Enums.FilterConditionField.Subject, 'name': 'Subject'}
|
||||
];
|
||||
|
||||
this.type = ko.observable(Enums.FilterConditionType.EqualTo);
|
||||
|
||||
this.typeOptions = [ // TODO i18n
|
||||
{'id': Enums.FilterConditionType.EqualTo, 'name': 'Equal To'},
|
||||
{'id': Enums.FilterConditionType.NotEqualTo, 'name': 'Not Equal To'},
|
||||
{'id': Enums.FilterConditionType.Contains, 'name': 'Contains'},
|
||||
{'id': Enums.FilterConditionType.NotContains, 'name': 'Not Contains'}
|
||||
];
|
||||
|
||||
this.value = ko.observable('');
|
||||
|
||||
this.template = ko.computed(function () {
|
||||
|
|
@ -60,9 +43,24 @@
|
|||
|
||||
_.extend(FilterConditionModel.prototype, AbstractModel.prototype);
|
||||
|
||||
FilterConditionModel.prototype.removeSelf = function ()
|
||||
FilterConditionModel.prototype.toJson = function ()
|
||||
{
|
||||
this.parentList.remove(this);
|
||||
return {
|
||||
'Field': this.field(),
|
||||
'Type': this.type(),
|
||||
'Value': this.value()
|
||||
};
|
||||
};
|
||||
|
||||
FilterConditionModel.prototype.cloneSelf = function ()
|
||||
{
|
||||
var oClone = new FilterConditionModel();
|
||||
|
||||
oClone.field(this.field());
|
||||
oClone.type(this.type());
|
||||
oClone.value(this.value());
|
||||
|
||||
return oClone;
|
||||
};
|
||||
|
||||
module.exports = FilterConditionModel;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue