mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 19:49:20 +03:00
Sieve Filters (Interface first look)
Code refactoring Small fixes
This commit is contained in:
parent
409e9fbdc2
commit
1027f319ed
43 changed files with 466 additions and 427 deletions
61
dev/ViewModels/Popups/PopupsLanguagesViewModel.js
Normal file
61
dev/ViewModels/Popups/PopupsLanguagesViewModel.js
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractViewModel
|
||||
*/
|
||||
function PopupsLanguagesViewModel()
|
||||
{
|
||||
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsLanguages');
|
||||
|
||||
this.exp = ko.observable(false);
|
||||
|
||||
this.languages = ko.computed(function () {
|
||||
return _.map(RL.data().languages(), function (sLanguage) {
|
||||
return {
|
||||
'key': sLanguage,
|
||||
'selected': ko.observable(false),
|
||||
'fullName': Utils.convertLangName(sLanguage)
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
RL.data().mainLanguage.subscribe(function () {
|
||||
this.resetMainLanguage();
|
||||
}, this);
|
||||
|
||||
Knoin.constructorEnd(this);
|
||||
}
|
||||
|
||||
Utils.extendAsViewModel('PopupsLanguagesViewModel', PopupsLanguagesViewModel);
|
||||
|
||||
PopupsLanguagesViewModel.prototype.languageEnName = function (sLanguage)
|
||||
{
|
||||
return Utils.convertLangName(sLanguage, true);
|
||||
};
|
||||
|
||||
PopupsLanguagesViewModel.prototype.resetMainLanguage = function ()
|
||||
{
|
||||
var sCurrent = RL.data().mainLanguage();
|
||||
_.each(this.languages(), function (oItem) {
|
||||
oItem['selected'](oItem['key'] === sCurrent);
|
||||
});
|
||||
};
|
||||
|
||||
PopupsLanguagesViewModel.prototype.onShow = function ()
|
||||
{
|
||||
this.exp(true);
|
||||
|
||||
this.resetMainLanguage();
|
||||
};
|
||||
|
||||
PopupsLanguagesViewModel.prototype.onHide = function ()
|
||||
{
|
||||
this.exp(false);
|
||||
};
|
||||
|
||||
PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
|
||||
{
|
||||
RL.data().mainLanguage(sLang);
|
||||
this.cancelCommand();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue