mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 11:39:21 +03:00
Contacts tags support (unstable - step 1).
+ Small fixes
This commit is contained in:
parent
74fa12c000
commit
0ca00dec40
34 changed files with 1790 additions and 801 deletions
|
|
@ -8,6 +8,7 @@ function ContactModel()
|
|||
this.idContact = 0;
|
||||
this.display = '';
|
||||
this.properties = [];
|
||||
this.tags = '';
|
||||
this.readOnly = false;
|
||||
|
||||
this.focused = ko.observable(false);
|
||||
|
|
@ -21,11 +22,11 @@ function ContactModel()
|
|||
*/
|
||||
ContactModel.prototype.getNameAndEmailHelper = function ()
|
||||
{
|
||||
var
|
||||
var
|
||||
sName = '',
|
||||
sEmail = ''
|
||||
;
|
||||
|
||||
|
||||
if (Utils.isNonEmptyArray(this.properties))
|
||||
{
|
||||
_.each(this.properties, function (aProperty) {
|
||||
|
|
@ -58,6 +59,7 @@ ContactModel.prototype.parse = function (oItem)
|
|||
this.idContact = Utils.pInt(oItem['IdContact']);
|
||||
this.display = Utils.pString(oItem['Display']);
|
||||
this.readOnly = !!oItem['ReadOnly'];
|
||||
this.tags = '';
|
||||
|
||||
if (Utils.isNonEmptyArray(oItem['Properties']))
|
||||
{
|
||||
|
|
@ -69,6 +71,11 @@ ContactModel.prototype.parse = function (oItem)
|
|||
}, this);
|
||||
}
|
||||
|
||||
if (Utils.isNonEmptyArray(oItem['Tags']))
|
||||
{
|
||||
this.tags = oItem['Tags'].join(';');
|
||||
}
|
||||
|
||||
bResult = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
45
dev/Models/ContactTagModel.js
Normal file
45
dev/Models/ContactTagModel.js
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ContactTagModel()
|
||||
{
|
||||
this.idContactTag = 0;
|
||||
this.name = ko.observable('');
|
||||
this.readOnly = false;
|
||||
}
|
||||
|
||||
ContactTagModel.prototype.parse = function (oItem)
|
||||
{
|
||||
var bResult = false;
|
||||
if (oItem && 'Object/Tag' === oItem['@Object'])
|
||||
{
|
||||
this.idContact = Utils.pInt(oItem['IdContactTag']);
|
||||
this.name(Utils.pString(oItem['Name']));
|
||||
this.readOnly = !!oItem['ReadOnly'];
|
||||
|
||||
bResult = true;
|
||||
}
|
||||
|
||||
return bResult;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sSearch
|
||||
* @return {boolean}
|
||||
*/
|
||||
ContactTagModel.prototype.filterHelper = function (sSearch)
|
||||
{
|
||||
return this.name().toLowerCase().indexOf(sSearch.toLowerCase()) !== -1;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {boolean=} bEncodeHtml = false
|
||||
* @return {string}
|
||||
*/
|
||||
ContactTagModel.prototype.toLine = function (bEncodeHtml)
|
||||
{
|
||||
return (Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml) ?
|
||||
Utils.encodeHtml(this.name()) : this.name();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue