forked from extern/egroupware
Etemplate: Cancel buttons do not trigger the change/close prompt
This commit is contained in:
parent
74284afc07
commit
143be4dc98
@ -199,6 +199,10 @@ var et2_button = /** @class */ (function (_super) {
|
|||||||
if (this.options.readonly)
|
if (this.options.readonly)
|
||||||
return false;
|
return false;
|
||||||
this.clicked = true;
|
this.clicked = true;
|
||||||
|
// Cancel buttons don't trigger the close confirmation prompt
|
||||||
|
if (this.btn.hasClass("et2_button_cancel")) {
|
||||||
|
this.getInstanceManager().skip_close_prompt();
|
||||||
|
}
|
||||||
if (!_super.prototype.click.apply(this, arguments)) {
|
if (!_super.prototype.click.apply(this, arguments)) {
|
||||||
this.clicked = false;
|
this.clicked = false;
|
||||||
return false;
|
return false;
|
||||||
@ -208,6 +212,7 @@ var et2_button = /** @class */ (function (_super) {
|
|||||||
this.getInstanceManager().submit(this, false, this.options.novalidate); //TODO: this only needs to be passed if it's in a datagrid
|
this.getInstanceManager().submit(this, false, this.options.novalidate); //TODO: this only needs to be passed if it's in a datagrid
|
||||||
}
|
}
|
||||||
this.clicked = false;
|
this.clicked = false;
|
||||||
|
this.getInstanceManager().skip_close_prompt(false);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
et2_button.prototype.set_label = function (_value) {
|
et2_button.prototype.set_label = function (_value) {
|
||||||
|
@ -310,6 +310,12 @@ export class et2_button extends et2_baseWidget implements et2_IInput, et2_IDetac
|
|||||||
|
|
||||||
this.clicked = true;
|
this.clicked = true;
|
||||||
|
|
||||||
|
// Cancel buttons don't trigger the close confirmation prompt
|
||||||
|
if(this.btn.hasClass("et2_button_cancel"))
|
||||||
|
{
|
||||||
|
this.getInstanceManager().skip_close_prompt();
|
||||||
|
}
|
||||||
|
|
||||||
if (!super.click.apply(this, arguments))
|
if (!super.click.apply(this, arguments))
|
||||||
{
|
{
|
||||||
this.clicked = false;
|
this.clicked = false;
|
||||||
@ -322,6 +328,7 @@ export class et2_button extends et2_baseWidget implements et2_IInput, et2_IDetac
|
|||||||
this.getInstanceManager().submit(this, false, this.options.novalidate); //TODO: this only needs to be passed if it's in a datagrid
|
this.getInstanceManager().submit(this, false, this.options.novalidate); //TODO: this only needs to be passed if it's in a datagrid
|
||||||
}
|
}
|
||||||
this.clicked = false;
|
this.clicked = false;
|
||||||
|
this.getInstanceManager().skip_close_prompt(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ var etemplate2 = /** @class */ (function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
etemplate2.prototype._close_changed_prompt = function (e) {
|
etemplate2.prototype._close_changed_prompt = function (e) {
|
||||||
if (!this.isDirty()) {
|
if (this._skip_close_prompt || !this.isDirty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Cancel the event
|
// Cancel the event
|
||||||
@ -296,6 +296,10 @@ var etemplate2 = /** @class */ (function () {
|
|||||||
// Chrome requires returnValue to be set
|
// Chrome requires returnValue to be set
|
||||||
e.returnValue = '';
|
e.returnValue = '';
|
||||||
};
|
};
|
||||||
|
etemplate2.prototype.skip_close_prompt = function (skip) {
|
||||||
|
if (skip === void 0) { skip = true; }
|
||||||
|
this._skip_close_prompt = skip;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* Unbind our unload handler
|
* Unbind our unload handler
|
||||||
*/
|
*/
|
||||||
|
@ -108,6 +108,7 @@ export class etemplate2
|
|||||||
private resize_timeout: number | boolean;
|
private resize_timeout: number | boolean;
|
||||||
private destroy_session: any;
|
private destroy_session: any;
|
||||||
private close_prompt: any;
|
private close_prompt: any;
|
||||||
|
private _skip_close_prompt: boolean;
|
||||||
private app_obj: EgwApp;
|
private app_obj: EgwApp;
|
||||||
app: string;
|
app: string;
|
||||||
|
|
||||||
@ -366,7 +367,7 @@ export class etemplate2
|
|||||||
|
|
||||||
private _close_changed_prompt(e : BeforeUnloadEvent)
|
private _close_changed_prompt(e : BeforeUnloadEvent)
|
||||||
{
|
{
|
||||||
if(!this.isDirty())
|
if(this._skip_close_prompt || !this.isDirty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -378,6 +379,11 @@ export class etemplate2
|
|||||||
e.returnValue = '';
|
e.returnValue = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public skip_close_prompt(skip = true)
|
||||||
|
{
|
||||||
|
this._skip_close_prompt = skip;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unbind our unload handler
|
* Unbind our unload handler
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user