mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 03:59:21 +03:00
ES2015 first look / babeljs
This commit is contained in:
parent
5dcceaaca5
commit
445cd155e5
123 changed files with 3214 additions and 3680 deletions
|
|
@ -1,94 +0,0 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
AbstractComponent = require('Component/Abstract')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {Object} oParams
|
||||
*
|
||||
* @extends AbstractComponent
|
||||
*/
|
||||
function SaveTriggerComponent(oParams)
|
||||
{
|
||||
AbstractComponent.call(this);
|
||||
|
||||
this.element = oParams.element || null;
|
||||
this.value = oParams.value && oParams.value.subscribe ? oParams.value : null;
|
||||
|
||||
if (this.element)
|
||||
{
|
||||
if (this.value)
|
||||
{
|
||||
this.element.css('display', 'inline-block');
|
||||
|
||||
if (oParams.verticalAlign)
|
||||
{
|
||||
this.element.css('vertical-align', oParams.verticalAlign);
|
||||
}
|
||||
|
||||
this.setState(this.value());
|
||||
|
||||
this.disposable.push(
|
||||
this.value.subscribe(this.setState, this)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.element.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SaveTriggerComponent.prototype.setState = function (nValue)
|
||||
{
|
||||
switch (Utils.pInt(nValue))
|
||||
{
|
||||
case Enums.SaveSettingsStep.TrueResult:
|
||||
this.element
|
||||
.find('.animated,.error').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.success').show().addClass('visible')
|
||||
;
|
||||
break;
|
||||
case Enums.SaveSettingsStep.FalseResult:
|
||||
this.element
|
||||
.find('.animated,.success').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.error').show().addClass('visible')
|
||||
;
|
||||
break;
|
||||
case Enums.SaveSettingsStep.Animate:
|
||||
this.element
|
||||
.find('.error,.success').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.animated').show().addClass('visible')
|
||||
;
|
||||
break;
|
||||
default:
|
||||
case Enums.SaveSettingsStep.Idle:
|
||||
this.element
|
||||
.find('.animated').hide()
|
||||
.end()
|
||||
.find('.error,.success').removeClass('visible')
|
||||
;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
_.extend(SaveTriggerComponent.prototype, AbstractComponent.prototype);
|
||||
|
||||
module.exports = AbstractComponent.componentExportHelper(
|
||||
SaveTriggerComponent, 'SaveTriggerComponent');
|
||||
|
||||
}());
|
||||
Loading…
Add table
Add a link
Reference in a new issue