mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-27 19:19:21 +03:00
New Ask popup
Fix inputosaurus fake span width detection Add Esc trigger to all popups (#29) Many minor fixes
This commit is contained in:
parent
214d905f90
commit
dcc486a114
57 changed files with 1200 additions and 307 deletions
|
|
@ -108,8 +108,18 @@ PopupsAddAccountViewModel.prototype.onShow = function ()
|
|||
this.emailFocus(true);
|
||||
};
|
||||
|
||||
|
||||
PopupsAddAccountViewModel.prototype.onBuild = function ()
|
||||
{
|
||||
this.allowCustomLogin(!!RL.settingsGet('AllowCustomLogin'));
|
||||
|
||||
var self = this;
|
||||
$window.on('keydown', function (oEvent) {
|
||||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -105,3 +105,17 @@ PopupsAdvancedSearchViewModel.prototype.onShow = function ()
|
|||
|
||||
this.fromFocus(true);
|
||||
};
|
||||
|
||||
PopupsAdvancedSearchViewModel.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
$window.on('keydown', function (oEvent) {
|
||||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
});
|
||||
};
|
||||
|
|
|
|||
116
dev/ViewModels/PopupsAskViewModel.js
Normal file
116
dev/ViewModels/PopupsAskViewModel.js
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractViewModel
|
||||
*/
|
||||
function PopupsAskViewModel()
|
||||
{
|
||||
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsAsk');
|
||||
|
||||
this.askDesc = ko.observable('');
|
||||
this.yesButton = ko.observable('');
|
||||
this.noButton = ko.observable('');
|
||||
|
||||
this.yesFocus = ko.observable(false);
|
||||
this.noFocus = ko.observable(false);
|
||||
|
||||
this.fYesAction = null;
|
||||
this.fNoAction = null;
|
||||
|
||||
Knoin.constructorEnd(this);
|
||||
}
|
||||
|
||||
Utils.extendAsViewModel('PopupsAskViewModel', PopupsAskViewModel);
|
||||
|
||||
PopupsAskViewModel.prototype.clearPopup = function ()
|
||||
{
|
||||
this.askDesc('');
|
||||
this.yesButton(Utils.i18n('POPUPS_ASK/BUTTON_YES'));
|
||||
this.noButton(Utils.i18n('POPUPS_ASK/BUTTON_NO'));
|
||||
|
||||
this.yesFocus(false);
|
||||
this.noFocus(false);
|
||||
|
||||
this.fYesAction = null;
|
||||
this.fNoAction = null;
|
||||
};
|
||||
|
||||
PopupsAskViewModel.prototype.yesClick = function ()
|
||||
{
|
||||
if (Utils.isFunc(this.fYesAction))
|
||||
{
|
||||
this.fYesAction.call(null);
|
||||
}
|
||||
|
||||
this.cancelCommand();
|
||||
};
|
||||
|
||||
PopupsAskViewModel.prototype.noClick = function ()
|
||||
{
|
||||
if (Utils.isFunc(this.fNoAction))
|
||||
{
|
||||
this.fNoAction.call(null);
|
||||
}
|
||||
|
||||
this.cancelCommand();
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sAskDesc
|
||||
* @param {Function=} fYesFunc
|
||||
* @param {Function=} fNoFunc
|
||||
* @param {string=} sYesButton
|
||||
* @param {string=} sNoButton
|
||||
*/
|
||||
PopupsAskViewModel.prototype.onShow = function (sAskDesc, fYesFunc, fNoFunc, sYesButton, sNoButton)
|
||||
{
|
||||
this.clearPopup();
|
||||
|
||||
this.fYesAction = fYesFunc || null;
|
||||
this.fNoAction = fNoFunc || null;
|
||||
|
||||
this.askDesc(sAskDesc || '');
|
||||
if (sYesButton)
|
||||
{
|
||||
this.yesButton(sYesButton);
|
||||
}
|
||||
|
||||
if (sYesButton)
|
||||
{
|
||||
this.yesButton(sNoButton);
|
||||
}
|
||||
|
||||
this.yesFocus(true);
|
||||
};
|
||||
|
||||
PopupsAskViewModel.prototype.onHide = function ()
|
||||
{
|
||||
};
|
||||
|
||||
PopupsAskViewModel.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
$window.on('keydown', function (oEvent) {
|
||||
var bResult = true;
|
||||
if (oEvent && self.modalVisibility())
|
||||
{
|
||||
if (Enums.EventKeyCode.Tab === oEvent.keyCode || Enums.EventKeyCode.Right === oEvent.keyCode || Enums.EventKeyCode.Left === oEvent.keyCode)
|
||||
{
|
||||
if (self.yesFocus())
|
||||
{
|
||||
self.noFocus(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
self.yesFocus(true);
|
||||
}
|
||||
|
||||
bResult = false;
|
||||
}
|
||||
}
|
||||
|
||||
return bResult;
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -801,6 +801,17 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE
|
|||
this.triggerForResize();
|
||||
};
|
||||
|
||||
PopupsComposeViewModel.prototype.tryToClosePopup = function ()
|
||||
{
|
||||
var self = this;
|
||||
kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
|
||||
if (self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'closeCommand');
|
||||
}
|
||||
}]);
|
||||
};
|
||||
|
||||
PopupsComposeViewModel.prototype.onBuild = function ()
|
||||
{
|
||||
this.initEditor();
|
||||
|
|
@ -826,6 +837,11 @@ PopupsComposeViewModel.prototype.onBuild = function ()
|
|||
self.sendCommand();
|
||||
bResult = false;
|
||||
}
|
||||
else if (Enums.EventKeyCode.Esc === oEvent.keyCode)
|
||||
{
|
||||
self.tryToClosePopup();
|
||||
bResult = false;
|
||||
}
|
||||
}
|
||||
|
||||
return bResult;
|
||||
|
|
|
|||
|
|
@ -457,6 +457,17 @@ PopupsContactsViewModel.prototype.onBuild = function (oDom)
|
|||
}
|
||||
})
|
||||
;
|
||||
|
||||
$window.on('keydown', function (oEvent) {
|
||||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'closeCommand');
|
||||
bResult = false;
|
||||
}
|
||||
|
||||
return bResult;
|
||||
});
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.onShow = function ()
|
||||
|
|
|
|||
|
|
@ -186,6 +186,20 @@ PopupsDomainViewModel.prototype.onShow = function (oDomain)
|
|||
}
|
||||
};
|
||||
|
||||
PopupsDomainViewModel.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
$window.on('keydown', function (oEvent) {
|
||||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
});
|
||||
};
|
||||
|
||||
PopupsDomainViewModel.prototype.clearForm = function ()
|
||||
{
|
||||
this.edit(false);
|
||||
|
|
|
|||
|
|
@ -95,3 +95,17 @@ PopupsFolderClearViewModel.prototype.onShow = function (oFolder)
|
|||
this.selectedFolder(oFolder);
|
||||
}
|
||||
};
|
||||
|
||||
PopupsFolderClearViewModel.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
$window.on('keydown', function (oEvent) {
|
||||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -105,3 +105,17 @@ PopupsFolderCreateViewModel.prototype.onShow = function ()
|
|||
this.clearPopup();
|
||||
this.focusTrigger(true);
|
||||
};
|
||||
|
||||
PopupsFolderCreateViewModel.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
$window.on('keydown', function (oEvent) {
|
||||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -103,3 +103,17 @@ PopupsFolderSystemViewModel.prototype.onShow = function (iNotificationType)
|
|||
this.notification(sNotification);
|
||||
};
|
||||
|
||||
PopupsFolderSystemViewModel.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
$window.on('keydown', function (oEvent) {
|
||||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,6 @@ PopupsIdentityViewModel.prototype.clearPopup = function ()
|
|||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {?IdentityModel} oIdentity
|
||||
*/
|
||||
PopupsIdentityViewModel.prototype.onShow = function (oIdentity)
|
||||
|
|
@ -145,3 +144,17 @@ PopupsIdentityViewModel.prototype.onShow = function (oIdentity)
|
|||
this.email.focused(true);
|
||||
}
|
||||
};
|
||||
|
||||
PopupsIdentityViewModel.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
$window.on('keydown', function (oEvent) {
|
||||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -54,6 +54,20 @@ PopupsLanguagesViewModel.prototype.onHide = function ()
|
|||
this.exp(false);
|
||||
};
|
||||
|
||||
PopupsLanguagesViewModel.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
$window.on('keydown', function (oEvent) {
|
||||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
});
|
||||
};
|
||||
|
||||
PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
|
||||
{
|
||||
RL.data().mainLanguage(sLang);
|
||||
|
|
|
|||
|
|
@ -111,3 +111,28 @@ PopupsPluginViewModel.prototype.onShow = function (oPlugin)
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
PopupsPluginViewModel.prototype.tryToClosePopup = function ()
|
||||
{
|
||||
var self = this;
|
||||
kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
|
||||
if (self.modalVisibility())
|
||||
{
|
||||
kn.delegateRun(self, 'cancelCommand');
|
||||
}
|
||||
}]);
|
||||
};
|
||||
|
||||
PopupsPluginViewModel.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
$window.on('keydown', function (oEvent) {
|
||||
var bResult = true;
|
||||
if (oEvent && Enums.EventKeyCode.Esc === oEvent.keyCode && self.modalVisibility())
|
||||
{
|
||||
self.tryToClosePopup();
|
||||
bResult = false;
|
||||
}
|
||||
return bResult;
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue