mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Code refactoring (es5 -> es2015)
This commit is contained in:
parent
fb2e492ce8
commit
38a1041a73
42 changed files with 3081 additions and 3690 deletions
|
|
@ -1,45 +0,0 @@
|
|||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {number=} iType = Enums.ContactPropertyType.Unknown
|
||||
* @param {string=} sTypeStr = ''
|
||||
* @param {string=} sValue = ''
|
||||
* @param {boolean=} bFocused = false
|
||||
* @param {string=} sPlaceholder = ''
|
||||
*/
|
||||
function ContactPropertyModel(iType, sTypeStr, sValue, bFocused, sPlaceholder)
|
||||
{
|
||||
AbstractModel.call(this, 'ContactPropertyModel');
|
||||
|
||||
this.type = ko.observable(Utils.isUnd(iType) ? Enums.ContactPropertyType.Unknown : iType);
|
||||
this.typeStr = ko.observable(Utils.isUnd(sTypeStr) ? '' : sTypeStr);
|
||||
this.focused = ko.observable(Utils.isUnd(bFocused) ? false : !!bFocused);
|
||||
this.value = ko.observable(Utils.pString(sValue));
|
||||
|
||||
this.placeholder = ko.observable(sPlaceholder || '');
|
||||
|
||||
this.placeholderValue = ko.computed(function() {
|
||||
var value = this.placeholder();
|
||||
return value ? Translator.i18n(value) : '';
|
||||
}, this);
|
||||
|
||||
this.largeValue = ko.computed(function() {
|
||||
return Enums.ContactPropertyType.Note === this.type();
|
||||
}, this);
|
||||
|
||||
this.regDisposables([this.placeholderValue, this.largeValue]);
|
||||
}
|
||||
|
||||
_.extend(ContactPropertyModel.prototype, AbstractModel.prototype);
|
||||
|
||||
module.exports = ContactPropertyModel;
|
||||
Loading…
Add table
Add a link
Reference in a new issue