mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 12:39:20 +03:00
Filters / Interface (part 2)
This commit is contained in:
parent
333c063cf1
commit
b1327c933b
20 changed files with 456 additions and 127 deletions
|
|
@ -3,6 +3,48 @@
|
|||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function FilterConditionModel()
|
||||
function FilterConditionModel(oKoList, oKoCanBeDeleted)
|
||||
{
|
||||
this.parentList = oKoList;
|
||||
this.canBeDeleted = oKoCanBeDeleted;
|
||||
|
||||
this.field = ko.observable(Enums.FilterConditionField.Subject);
|
||||
this.fieldOptions = [ // TODO i18n
|
||||
{'id': Enums.FilterConditionField.Subject, 'name': 'Subject'},
|
||||
{'id': Enums.FilterConditionField.Recipient, 'name': 'Recipient (To or CC)'},
|
||||
{'id': Enums.FilterConditionField.From, 'name': 'From'},
|
||||
{'id': Enums.FilterConditionField.To, 'name': 'To'}
|
||||
];
|
||||
|
||||
this.type = ko.observable(Enums.FilterConditionType.Contains);
|
||||
this.typeOptions = [ // TODO i18n
|
||||
{'id': Enums.FilterConditionType.Contains, 'name': 'Contains'},
|
||||
{'id': Enums.FilterConditionType.NotContains, 'name': 'Not Contains'},
|
||||
{'id': Enums.FilterConditionType.EqualTo, 'name': 'Equal To'},
|
||||
{'id': Enums.FilterConditionType.NotEqualTo, 'name': 'Not Equal To'}
|
||||
];
|
||||
|
||||
this.value = ko.observable('');
|
||||
|
||||
this.template = ko.computed(function () {
|
||||
|
||||
var sTemplate = '';
|
||||
switch (this.type())
|
||||
{
|
||||
default:
|
||||
sTemplate = 'SettingsFiltersConditionDefault';
|
||||
break;
|
||||
}
|
||||
|
||||
return sTemplate;
|
||||
|
||||
}, this);
|
||||
}
|
||||
|
||||
FilterConditionModel.prototype.removeSelf = function ()
|
||||
{
|
||||
if (this.canBeDeleted())
|
||||
{
|
||||
this.parentList.remove(this);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue