Fix Ask popup bug (#231)

This commit is contained in:
RainLoop Team 2014-07-10 18:44:45 +04:00
parent aa7e198f3c
commit c155a6c200
10 changed files with 251 additions and 183 deletions

View file

@ -62,6 +62,8 @@ function PopupsPluginViewModel()
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = Enums.KeyState.All;
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), 200);
Knoin.constructorEnd(this);
}
@ -118,12 +120,15 @@ 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())
{
Utils.delegateRun(self, 'cancelCommand');
}
}]);
if (!kn.isPopupVisible(PopupsAskViewModel))
{
kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
if (self.modalVisibility())
{
Utils.delegateRun(self, 'cancelCommand');
}
}]);
}
};
PopupsPluginViewModel.prototype.onBuild = function ()
@ -132,7 +137,7 @@ PopupsPluginViewModel.prototype.onBuild = function ()
if (this.modalVisibility())
{
this.tryToClosePopup();
return false;
}
return false;
}, this));
};