From 80e833bef29c2c0fc6b54fcdd91155f11f1e1ec4 Mon Sep 17 00:00:00 2001
From: Rafael Ostertag <rafael.ostertag@math.uzh.ch>
Date: Tue, 10 May 2016 15:45:33 +0200
Subject: [PATCH] Adjusted code to cope with new Alert.js.

---
 javascript/src/FileDelete.js    |  4 +++-
 javascript/src/QfqForm.js       | 20 ++++++++++++++++----
 javascript/src/QfqRecordList.js |  6 +++++-
 3 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/javascript/src/FileDelete.js b/javascript/src/FileDelete.js
index 403246595..bf699d593 100644
--- a/javascript/src/FileDelete.js
+++ b/javascript/src/FileDelete.js
@@ -27,7 +27,9 @@ var QfqNS = QfqNS || {};
 
     n.FileDelete.prototype.buttonClicked = function (event) {
         event.preventDefault();
-        var alert = new n.Alert("Do you want to delete the file?", "warning", "okcancel");
+        var alert = new n.Alert("Do you want to delete the file?",
+            "warning",
+            [{label: "OK", eventName: "ok"}, {label: "Cancel", eventName: "cancel"}]);
         alert.on('alert.ok', function () {
             this.performFileDelete(event);
         }.bind(this));
diff --git a/javascript/src/QfqForm.js b/javascript/src/QfqForm.js
index 96ea6e862..04a548259 100644
--- a/javascript/src/QfqForm.js
+++ b/javascript/src/QfqForm.js
@@ -93,7 +93,6 @@ var QfqNS = QfqNS || {};
     };
 
 
-
     /**
      *
      * @private
@@ -291,7 +290,11 @@ 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", "yesnosave");
+            var alert = new n.Alert("You have unsaved changes. Do you want to close?", "warning",
+                [{label: "Yes", eventName: "ok"}, {label: "No", eventName: "no"}, {
+                    label: "Save & Close",
+                    eventName: "save"
+                }]);
             var that = this;
             alert.on('alert.save', function () {
                 that.submit();
@@ -333,7 +336,12 @@ 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", "yesnosave");
+            var alert = new n.Alert("You have unsaved changes. Do you want to close?", "warning",
+                [
+                    {label: "Yes", eventName: "ok"},
+                    {label: "No", eventName: "cancel"},
+                    {label: "Save & Close", eventName: "save"}
+                ]);
             var that = this;
             alert.on('alert.save', function () {
                 that.submit();
@@ -356,7 +364,11 @@ var QfqNS = QfqNS || {};
     n.QfqForm.prototype.handleDeleteClick = function () {
         this.lastButtonPress = "delete";
         n.Log.debug("delete click");
-        var alert = new n.Alert("Do you really want to delete the record?", "warning", "yesno");
+        var alert = new n.Alert("Do you really want to delete the record?", "warning",
+            [
+                {label: "Yes", eventName: "ok"},
+                {label: "No", eventName: "cancel"}
+            ]);
         var that = this;
         alert.on('alert.ok', function () {
             $.post(that.deleteUrl)
diff --git a/javascript/src/QfqRecordList.js b/javascript/src/QfqRecordList.js
index 18ea78a6f..0dba04fe4 100644
--- a/javascript/src/QfqRecordList.js
+++ b/javascript/src/QfqRecordList.js
@@ -40,7 +40,11 @@ var QfqNS = QfqNS || {};
         }
 
 
-        var alert = new n.Alert("Do you really want to delete the record?", "warning", "yesno");
+        var alert = new n.Alert("Do you really want to delete the record?", "warning",
+            [
+                {label: "Yes", eventName: "ok"},
+                {label: "No", eventName: "cancel"}
+            ]);
         var that = this;
         alert.on('alert.ok', function () {
             $.post(that.deleteUrl + "?s=" + sip)
-- 
GitLab