mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 15:07:02 +03:00
Added knockoutjs components
Added material design checkbox component Added lang changing animation
This commit is contained in:
parent
c2b7632c13
commit
1423b88839
48 changed files with 1213 additions and 256 deletions
65
dev/Component/AbstracRadio.js
Normal file
65
dev/Component/AbstracRadio.js
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
AbstractComponent = require('Component/Abstract')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {Object} oParams
|
||||
*
|
||||
* @extends AbstractComponent
|
||||
*/
|
||||
function AbstracRadio(oParams) {
|
||||
|
||||
AbstractComponent.call(this);
|
||||
|
||||
this.values = ko.observableArray([]);
|
||||
|
||||
this.value = oParams.value;
|
||||
if (Utils.isUnd(this.value) || !this.value.subscribe)
|
||||
{
|
||||
this.value = ko.observable('');
|
||||
}
|
||||
|
||||
this.inline = Utils.isUnd(oParams.inline) ? false : oParams.inline;
|
||||
this.readOnly = Utils.isUnd(oParams.readOnly) ? false : !!oParams.readOnly;
|
||||
|
||||
if (oParams.values)
|
||||
{
|
||||
var aValues = _.map(oParams.values, function (sLabel, sValue) {
|
||||
return {
|
||||
'label': sLabel,
|
||||
'value': sValue
|
||||
};
|
||||
});
|
||||
|
||||
this.values(aValues);
|
||||
}
|
||||
|
||||
this.click = _.bind(this.click, this);
|
||||
};
|
||||
|
||||
AbstracRadio.prototype.click = function(oValue) {
|
||||
if (!this.readOnly && oValue)
|
||||
{
|
||||
this.value(oValue.value);
|
||||
}
|
||||
};
|
||||
|
||||
_.extend(AbstracRadio.prototype, AbstractComponent.prototype);
|
||||
|
||||
AbstracRadio.componentExportHelper = AbstractComponent.componentExportHelper;
|
||||
|
||||
module.exports = AbstracRadio;
|
||||
|
||||
}());
|
||||
Loading…
Add table
Add a link
Reference in a new issue