Bug 16014: Display a warning on deleting OAI sets
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 9 Mar 2016 11:57:47 +0000 (11:57 +0000)
committerBrendan A Gallagher <brendan@bywatersolutions.com>
Fri, 11 Mar 2016 16:50:42 +0000 (16:50 +0000)
A JavaScript alert should ask the user to confirm deletion of a OAI set.

Test plan:
Define a OAI set
Delete it
=> With this patch you should get a warning

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_sets.tt

index 06bb16a..d78dd1f 100644 (file)
@@ -16,6 +16,16 @@ function delDescField(minusButton) {
     var li = $(minusButton).parent('li');
     $(li).remove();
 }
+
+function confirmDelete() {
+  return confirm(_("Are you sure you want to delete this OAI set?"));
+}
+
+$(document).ready(function() {
+    $(".delete_oai_set").on("click",function(){
+        return confirmDelete();
+    });
+});
 //]]>
 </script>
 </head>
@@ -104,7 +114,7 @@ function delDescField(minusButton) {
                             <td>
                                 <a href="/cgi-bin/koha/admin/oai_sets.pl?op=mod&amp;id=[% set.id %]">Modify</a>
                                 |
-                                <a href="/cgi-bin/koha/admin/oai_sets.pl?op=del&amp;id=[% set.id %]">Delete</a>
+                                <a class="delete_oai_set" href="/cgi-bin/koha/admin/oai_sets.pl?op=del&amp;id=[% set.id %]">Delete</a>
                                 |
                                 <a href="/cgi-bin/koha/admin/oai_set_mappings.pl?id=[% set.id %]">Define mappings</a>
                             </td>