mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49: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
|
|
@ -7,19 +7,38 @@ function FilterModel()
|
|||
{
|
||||
this.enabled = ko.observable(true);
|
||||
|
||||
this.name = ko.observable('');
|
||||
|
||||
this.conditionsType = ko.observable(Enums.FilterRulesType.And);
|
||||
|
||||
this.conditions = ko.observableArray([]);
|
||||
this.actions = ko.observableArray([]);
|
||||
|
||||
this.action = ko.observable(Enums.FiltersAction.None);
|
||||
this.conditions.subscribe(function () {
|
||||
Utils.windowResize();
|
||||
});
|
||||
|
||||
this.actions.subscribe(function () {
|
||||
Utils.windowResize();
|
||||
});
|
||||
|
||||
this.conditionsCanBeDeleted = ko.computed(function () {
|
||||
return 1 < this.conditions().length;
|
||||
}, this);
|
||||
|
||||
this.actionsCanBeDeleted = ko.computed(function () {
|
||||
return 1 < this.actions().length;
|
||||
}, this);
|
||||
}
|
||||
|
||||
FilterModel.prototype.deleteCondition = function (oCondition)
|
||||
{
|
||||
this.conditions.remove(oCondition);
|
||||
};
|
||||
|
||||
FilterModel.prototype.addCondition = function ()
|
||||
{
|
||||
this.conditions.push(new FilterConditionModel());
|
||||
this.conditions.push(new FilterConditionModel(this.conditions, this.conditionsCanBeDeleted));
|
||||
};
|
||||
|
||||
FilterModel.prototype.addAction = function ()
|
||||
{
|
||||
this.actions.push(new FilterActionModel(this.actions, this.actionsCanBeDeleted));
|
||||
};
|
||||
|
||||
FilterModel.prototype.parse = function (oItem)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue