Bug 16338 - Remove the use of "onclick" from the lists template
authorOwen Leonard <oleonard@myacpl.org>
Mon, 25 Apr 2016 01:07:19 +0000 (21:07 -0400)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 29 Apr 2016 16:38:37 +0000 (16:38 +0000)
This patch removes the use of "onclick" from the list delete button,
moving the event definition into the script.

Also changed: Removed some unnecessary link markup; Added some
whitespace around the action buttons.

To test, apply the patch and go to Lists.

Click the "Delete" button next to any list. You should be prompted to
confirm the deletion. Verify that both confirming and canceling the
deletion works correctly.

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt
koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt

index 805d3dd..2c8207d 100644 (file)
@@ -107,6 +107,9 @@ $(document).ready(function(){
             }
         }
     });
+    $("body").on("click", ".deleteshelf", function(){
+        return confirmDelete(MSG_CONFIRM_DELETE_LIST);
+    });
 });
 [% END %]
 
index f19a54a..d8fa6f0 100644 (file)
@@ -22,7 +22,7 @@
                 "dt_modification_time":
                     "[% data.modification_time | $KohaDates %]",
                 "dt_action":
-                    "<a style=\"cursor:pointer\">[% PROCESS action_form shelfnumber=data.shelfnumber can_manage_shelf=data.can_manage_shelf can_delete_shelf=data.can_delete_shelf type=data.type %]</a>"
+                    "[% PROCESS action_form shelfnumber=data.shelfnumber can_manage_shelf=data.can_manage_shelf can_delete_shelf=data.can_delete_shelf type=data.type %]"
             }[% UNLESS loop.last %],[% END %]
         [% END %]
     ]
         [%~ action_block = action_block _ '<input type="hidden" name="category" value="' _ type _ '" />' ~%]
         [%~ action_block = action_block _ '<input type="hidden" name="referer" value="list" />' ~%]
         [%~ action_block = action_block _ '<button class="editshelf btn btn-mini"><i class="fa fa-pencil"></i> Edit</button>' ~%]
-        [%~ action_block = action_block _ '</form>' ~%]
+        [%~ action_block = action_block _ '</form> ' ~%]
     [%~ END ~%]
     [%~ IF can_manage_shelf OR can_delete_shelf ~%]
-        [%~ action_block = action_block _ '<form action="shelves.pl" method="post">' ~%]
+        [%~ action_block = action_block _ ' <form action="shelves.pl" method="post">' ~%]
         [%~ action_block = action_block _ '<input type="hidden" name="shelfoff" value="' _ shelfoff _ '" />' ~%]
         [%~ action_block = action_block _ '<input type="hidden" name="shelves" value="1" />' ~%]
         [%~ action_block = action_block _ '<input type="hidden" name="op" value="delete" />' ~%]
         [%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber  _ '" />' ~%]
         [%~ action_block = action_block _ '<input type="hidden" name="category" value="' _ type _ '" />' ~%]
         [%~ action_block = action_block _ '<input type="hidden" name="referer" value="list" />' ~%]
-        [%~ action_block = action_block _ '<button class="deleteshelf btn btn-mini" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)"><i class="fa fa-trash"></i> Delete</button>' ~%]
+        [%~ action_block = action_block _ '<button type="submit" class="deleteshelf btn btn-mini"><i class="fa fa-trash"></i> Delete</button>' ~%]
         [%~ action_block = action_block _ '</form>' ~%]
     [%~ END ~%]
 [%~ ELSE ~%]