New Ask popup

Fix inputosaurus fake span width detection
Add Esc trigger to all popups (#29)
Many minor fixes
This commit is contained in:
RainLoop Team 2013-12-14 03:27:12 +04:00
parent 214d905f90
commit dcc486a114
57 changed files with 1200 additions and 307 deletions

View file

@ -5647,11 +5647,6 @@ html.no-rgba .modal {
.inputosaurus-container li.inputosaurus-selected {
background-color: #ddd;
}
.inputosaurus-container .inputosaurus-fake-span {
position: absolute;
top: 0;
left: -5000px;
}
.inputosaurus-container .inputosaurus-input {
margin: 1px 10px 1px 0px;
height: 22px;
@ -5664,6 +5659,11 @@ html.no-rgba .modal {
.ui-autocomplete {
z-index: 2000;
}
.inputosaurus-fake-span {
position: absolute;
top: 0;
left: -5000px;
}
.g-ui-user-select-none {
-webkit-user-select: none;
-khtml-user-select: none;
@ -6132,6 +6132,18 @@ html.rl-no-preview-pane #rl-right .ui-resizable-handle {
.b-login-content .flag-selector {
margin-bottom: 0;
}
.popups .b-ask-content.modal {
z-index: 10000;
}
.popups .b-ask-content .modal-header {
background-color: #fff;
}
.popups .b-ask-content .modal-body {
text-align: center;
}
.popups .b-ask-content .desc-place {
font-size: 18px;
}
.b-folders .b-toolbar {
position: absolute;
top: 0;
@ -8410,3 +8422,10 @@ html.rl-message-fullscreen .messageView .b-content .buttonFull {
.editorFontStylePicker .editorFpFonts .editorFpFont {
padding: 5px;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"] {
height: 20px;
line-height: 21px;
}

File diff suppressed because one or more lines are too long

View file

@ -3492,11 +3492,6 @@ html.no-rgba .modal {
.inputosaurus-container li.inputosaurus-selected {
background-color: #ddd;
}
.inputosaurus-container .inputosaurus-fake-span {
position: absolute;
top: 0;
left: -5000px;
}
.inputosaurus-container .inputosaurus-input {
margin: 1px 10px 1px 0px;
height: 22px;
@ -3509,6 +3504,11 @@ html.no-rgba .modal {
.ui-autocomplete {
z-index: 2000;
}
.inputosaurus-fake-span {
position: absolute;
top: 0;
left: -5000px;
}
.g-ui-user-select-none {
-webkit-user-select: none;
-khtml-user-select: none;
@ -3977,6 +3977,18 @@ html.rl-no-preview-pane #rl-right .ui-resizable-handle {
.b-login-content .flag-selector {
margin-bottom: 0;
}
.popups .b-ask-content.modal {
z-index: 10000;
}
.popups .b-ask-content .modal-header {
background-color: #fff;
}
.popups .b-ask-content .modal-body {
text-align: center;
}
.popups .b-ask-content .desc-place {
font-size: 18px;
}
.b-folders .b-toolbar {
position: absolute;
top: 0;
@ -6255,3 +6267,10 @@ html.rl-message-fullscreen .messageView .b-content .buttonFull {
.editorFontStylePicker .editorFpFonts .editorFpFont {
padding: 5px;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"] {
height: 20px;
line-height: 21px;
}

View file

@ -372,6 +372,7 @@ Enums.ClientSideKeyName = {
*/
Enums.EventKeyCode = {
'Backspace': 8,
'Tab': 9,
'Enter': 13,
'Esc': 27,
'PageUp': 33,
@ -4641,6 +4642,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);
@ -4772,6 +4787,31 @@ 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;
});
};
/**
* @constructor
@ -4937,12 +4977,141 @@ 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);
this.cancelCommand();
};
/**
* @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;
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5772,8 +5941,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'
@ -7119,7 +7307,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])
{

File diff suppressed because one or more lines are too long

View file

@ -372,6 +372,7 @@ Enums.ClientSideKeyName = {
*/
Enums.EventKeyCode = {
'Backspace': 8,
'Tab': 9,
'Enter': 13,
'Esc': 27,
'PageUp': 33,
@ -7654,6 +7655,20 @@ 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;
});
};
/**
* @constructor
@ -7760,6 +7775,20 @@ 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;
});
};
/**
* @constructor
@ -7864,6 +7893,20 @@ 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;
});
};
/**
* @constructor
@ -8666,6 +8709,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();
@ -8691,6 +8745,11 @@ PopupsComposeViewModel.prototype.onBuild = function ()
self.sendCommand();
bResult = false;
}
else if (Enums.EventKeyCode.Esc === oEvent.keyCode)
{
self.tryToClosePopup();
bResult = false;
}
}
return bResult;
@ -9711,6 +9770,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 ()
@ -9836,6 +9906,20 @@ 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;
});
};
/**
* @constructor
@ -9945,10 +10029,20 @@ 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;
});
};
/**
@ -10071,7 +10165,6 @@ PopupsIdentityViewModel.prototype.clearPopup = function ()
};
/**
*
* @param {?IdentityModel} oIdentity
*/
PopupsIdentityViewModel.prototype.onShow = function (oIdentity)
@ -10096,6 +10189,20 @@ 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;
});
};
/**
* @constructor
@ -10151,12 +10258,141 @@ 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);
this.cancelCommand();
};
/**
* @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;
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -15742,7 +15978,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])
{

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long