web/data/cubicweb.edition.js
changeset 10932 cb217b2b3463
parent 10456 e7ee508a8b2f
--- a/web/data/cubicweb.edition.js	Wed Nov 25 16:22:42 2015 +0100
+++ b/web/data/cubicweb.edition.js	Wed Nov 25 18:31:48 2015 +0100
@@ -537,6 +537,24 @@
 }
 
 /**
+ * Cancel the operations done on the given form.
+ *
+ */
+$(function () {
+    $(document).on('click', '.cwjs-edition-cancel', function (evt) {
+        var $mynode = $(evt.currentTarget),
+            $form = $mynode.closest('form'),
+            $error = $form.find(':input[name="__errorurl"]'),
+            errorurl = $error.attr('value'),
+            args = ajaxFuncArgs('cancel_edition', null, errorurl);
+        loadRemote(AJAX_BASE_URL, args, 'POST', true);
+        history.back();
+        return false;
+    });
+});
+
+
+/**
  * .. function:: validateForm(formid, action, onsuccess, onfailure)
  *
  * called on traditionnal form submission : the idea is to try