snappymail/dev/Model/Account.js

48 lines
841 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
*/
function AccountModel(sEmail, bCanBeDelete)
{
2014-10-04 19:58:01 +08:00
AbstractModel.call(this, 'AccountModel');
2014-08-20 23:03:12 +08:00
this.email = sEmail;
2014-08-20 23:03:12 +08:00
this.deleteAccess = ko.observable(false);
2014-08-29 23:30:52 +08:00
this.canBeDalete = ko.observable(Utils.isUnd(bCanBeDelete) ? true : !!bCanBeDelete);
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-09-05 06:49:03 +08:00
return require('Common/LinkBuilder').change(this.email);
2014-08-20 23:03:12 +08:00
};
module.exports = AccountModel;
2014-09-05 06:49:03 +08:00
}());