mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 00:14:50 +03:00
Implementation of share contacts (begin)
This commit is contained in:
parent
5198dcfa20
commit
026839d864
17 changed files with 469 additions and 50 deletions
|
|
@ -46,6 +46,9 @@ function PopupsContactsViewModel()
|
|||
this.viewClearSearch = ko.observable(false);
|
||||
|
||||
this.viewID = ko.observable('');
|
||||
this.viewReadOnly = ko.observable(false);
|
||||
this.viewScopeType = ko.observable(Enums.ContactScopeType.Default);
|
||||
this.viewScopeValue = ko.observable('');
|
||||
this.viewProperties = ko.observableArray([]);
|
||||
|
||||
this.viewPropertiesNames = this.viewProperties.filter(function(oProperty) {
|
||||
|
|
@ -56,6 +59,24 @@ function PopupsContactsViewModel()
|
|||
return -1 < Utils.inArray(oProperty.type(), aEmailTypes);
|
||||
});
|
||||
|
||||
this.shareToNone = ko.computed(function() {
|
||||
return -1 === Utils.inArray(this.viewScopeType(), [
|
||||
Enums.ContactScopeType.ShareAll, Enums.ContactScopeType.ShareDomain, Enums.ContactScopeType.ShareEmail
|
||||
]);
|
||||
}, this);
|
||||
|
||||
this.shareToAll = ko.computed(function() {
|
||||
return Enums.ContactScopeType.ShareAll === this.viewScopeType();
|
||||
}, this);
|
||||
|
||||
this.shareToDomain = ko.computed(function() {
|
||||
return Enums.ContactScopeType.ShareDomain === this.viewScopeType();
|
||||
}, this);
|
||||
|
||||
this.shareToEmail = ko.computed(function() {
|
||||
return Enums.ContactScopeType.ShareEmail === this.viewScopeType();
|
||||
}, this);
|
||||
|
||||
this.viewHasNonEmptyRequaredProperties = ko.computed(function() {
|
||||
|
||||
var
|
||||
|
|
@ -236,8 +257,11 @@ function PopupsContactsViewModel()
|
|||
}, sRequestUid, this.viewID(), aProperties);
|
||||
|
||||
}, function () {
|
||||
var bV = this.viewHasNonEmptyRequaredProperties();
|
||||
return !this.viewSaving() && bV;
|
||||
var
|
||||
bV = this.viewHasNonEmptyRequaredProperties(),
|
||||
bReadOnly = this.viewReadOnly()
|
||||
;
|
||||
return !this.viewSaving() && bV && !bReadOnly;
|
||||
});
|
||||
|
||||
this.bDropPageAfterDelete = false;
|
||||
|
|
@ -354,6 +378,9 @@ PopupsContactsViewModel.prototype.populateViewContact = function (oContact)
|
|||
;
|
||||
|
||||
this.emptySelection(false);
|
||||
this.viewReadOnly(false);
|
||||
this.viewScopeType(Enums.ContactScopeType.Default);
|
||||
this.viewScopeValue('');
|
||||
|
||||
if (oContact)
|
||||
{
|
||||
|
|
@ -372,6 +399,10 @@ PopupsContactsViewModel.prototype.populateViewContact = function (oContact)
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.viewReadOnly(!!oContact.readOnly);
|
||||
this.viewScopeType(oContact.scopeType);
|
||||
this.viewScopeValue(oContact.scopeValue);
|
||||
}
|
||||
|
||||
if (!bHasName)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue