Commit 7af3043a authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Implemented changes from https://project/issues/1874

parent 669c25d0
......@@ -34,7 +34,7 @@ Close Button
------------
* User presses the Close button
1. Form not modified by user: Client redirects to previous page.
1. Form modified by user: Ask User 'You have unsaved changes. Do you want to close?'
1. Form modified by user: Ask User 'You have unsaved changes. Do you want to save first?'
* Yes: Client redirects to previous page.
* No: Client stays on current page.
* Save & Close:
......
......@@ -287,16 +287,18 @@ var QfqNS = QfqNS || {};
n.QfqForm.prototype.handleCloseClick = function () {
this.lastButtonPress = "close";
if (this.form.getFormChanged()) {
var alert = new n.Alert("You have unsaved changes. Do you want to close?", "warning",
[{label: "Yes", eventName: "ok"}, {label: "No", eventName: "no", focus: true}, {
label: "Save & Close",
eventName: "save"
var alert = new n.Alert("You have unsaved changes. Do you want to save first?", "warning",
[
{label: "Yes", eventName: "yes"},
{label: "No", eventName: "no", focus: true},
{
label: "Cancel", eventName: "cancel"
}]);
var that = this;
alert.on('alert.save', function () {
alert.on('alert.yes', function () {
that.submit();
});
alert.on('alert.ok', function () {
alert.on('alert.no', function () {
window.history.back();
});
alert.show();
......@@ -336,20 +338,20 @@ var QfqNS = QfqNS || {};
this.lastButtonPress = "new";
if (this.form.getFormChanged()) {
var alert = new n.Alert("You have unsaved changes. Do you want to close?", "warning",
var alert = new n.Alert("You have unsaved changes. Do you want to save first?", "warning",
[
{label: "Yes", eventName: "ok"},
{label: "No", eventName: "cancel", focus: true},
{label: "Save & Close", eventName: "save"}
{label: "Yes", eventName: "yes", focus: true},
{label: "No", eventName: "no"},
{label: "Cancel", eventName: "cancel"}
]);
var that = this;
alert.on('alert.save', function () {
that.submit();
});
alert.on('alert.ok', function () {
alert.on('alert.no', function () {
var anchorTarget = that.getNewButtonTarget();
window.location = anchorTarget;
});
alert.on('alert.yes', function () {
that.submit();
});
alert.show();
} else {
var anchorTarget = this.getNewButtonTarget();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment