snappymail/dev/Model/Account.js

52 lines
958 B
JavaScript
Raw Normal View History

2014-09-05 06:49:03 +08:00
(function () {
2014-08-25 23:49:01 +08:00
'use strict';
2014-08-20 23:03:12 +08:00
var
2014-10-04 19:58:01 +08:00
_ = require('_'),
2014-08-29 23:30:52 +08:00
ko = require('ko'),
2014-10-04 19:58:01 +08:00
Utils = require('Common/Utils'),
AbstractModel = require('Knoin/AbstractModel')
2014-08-20 23:03:12 +08:00
;
/**
2014-08-29 23:30:52 +08:00
* @constructor
*
2014-08-20 23:03:12 +08:00
* @param {string} sEmail
* @param {boolean=} bCanBeDelete = true
* @param {number=} iCount = 0
2014-08-20 23:03:12 +08:00
*/
function AccountModel(sEmail, bCanBeDelete, iCount)
2014-08-20 23:03:12 +08:00
{
2014-10-04 19:58:01 +08:00
AbstractModel.call(this, 'AccountModel');
2014-08-20 23:03:12 +08:00
this.email = sEmail;
this.count = ko.observable(iCount || 0);
2014-08-20 23:03:12 +08:00
this.deleteAccess = ko.observable(false);
this.canBeDeleted = ko.observable(Utils.isUnd(bCanBeDelete) ? true : !!bCanBeDelete);
this.canBeEdit = this.canBeDeleted;
2014-08-20 23:03:12 +08:00
}
2014-10-04 19:58:01 +08:00
_.extend(AccountModel.prototype, AbstractModel.prototype);
2014-08-29 23:30:52 +08:00
/**
* @type {string}
*/
2014-08-20 23:03:12 +08:00
AccountModel.prototype.email = '';
/**
* @return {string}
*/
AccountModel.prototype.changeAccountLink = function ()
{
2014-10-06 02:37:31 +08:00
return require('Common/Links').change(this.email);
2014-08-20 23:03:12 +08:00
};
module.exports = AccountModel;
2014-09-05 06:49:03 +08:00
}());