mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +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
|
|
@ -35,8 +35,27 @@ AdminPlugins.prototype.configurePlugin = function (oPlugin)
|
|||
RL.remote().plugin(this.onPluginLoadRequest, oPlugin.name);
|
||||
};
|
||||
|
||||
AdminPlugins.prototype.onBuild = function ()
|
||||
AdminPlugins.prototype.onBuild = function (oDom)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
oDom
|
||||
.on('click', '.e-item .configure-plugin-action', function () {
|
||||
var oPlugin = ko.dataFor(this);
|
||||
if (oPlugin)
|
||||
{
|
||||
self.configurePlugin(oPlugin);
|
||||
}
|
||||
})
|
||||
.on('click', '.e-item .disable-plugin', function () {
|
||||
var oPlugin = ko.dataFor(this);
|
||||
if (oPlugin)
|
||||
{
|
||||
self.disablePlugin(oPlugin);
|
||||
}
|
||||
})
|
||||
;
|
||||
|
||||
this.enabledPlugins.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
||||
'EnabledPlugins': bValue ? '1' : '0'
|
||||
|
|
|
|||
|
|
@ -240,7 +240,6 @@ AbstractApp.prototype.pub = function (sName, aArgs)
|
|||
{
|
||||
if (!Utils.isUnd(this.oSubs[sName]))
|
||||
{
|
||||
window.console.log(sName);
|
||||
_.each(this.oSubs[sName], function (aItem) {
|
||||
if (aItem[0])
|
||||
{
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ Enums.ClientSideKeyName = {
|
|||
*/
|
||||
Enums.EventKeyCode = {
|
||||
'Backspace': 8,
|
||||
'Tab': 9,
|
||||
'Enter': 13,
|
||||
'Esc': 27,
|
||||
'PageUp': 33,
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
@import "Scroll.less";
|
||||
@import "SystemDropDown.less";
|
||||
@import "Login.less";
|
||||
@import "Ask.less";
|
||||
@import "FolderList.less";
|
||||
@import "FolderClear.less";
|
||||
@import "FolderCreate.less";
|
||||
|
|
|
|||
20
dev/Styles/Ask.less
Normal file
20
dev/Styles/Ask.less
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
.popups {
|
||||
.b-ask-content {
|
||||
|
||||
&.modal {
|
||||
z-index: 10000;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.desc-place {
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,2 +1,5 @@
|
|||
|
||||
|
||||
input[type="text"], input[type="password"], input[type="email"], input[type="search"] {
|
||||
height: 20px;
|
||||
line-height: 21px;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,12 +45,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.inputosaurus-fake-span {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -5000px;
|
||||
}
|
||||
|
||||
.inputosaurus-input {
|
||||
|
||||
margin: 1px 10px 1px 0px;
|
||||
|
|
@ -66,4 +60,10 @@
|
|||
|
||||
.ui-autocomplete {
|
||||
z-index: 2000;
|
||||
}
|
||||
}
|
||||
|
||||
.inputosaurus-fake-span {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -5000px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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