Bug 16372 - Replace the use of "onclick" for deletion confirmation in some templates
[koha_ffzg] / koha-tmpl / intranet-tmpl / prog / en / modules / patron_lists / lists.tt
index 2703144..8dd0b60 100644 (file)
@@ -1,49 +1,57 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Tools &rsaquo; Patron lists</title>
 [% INCLUDE 'doc-head-close.inc' %]
-
-<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+[% INCLUDE 'greybox.inc' %]
+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
 [% INCLUDE 'datatables.inc' %]
 
 <script type="text/javascript">
 //<![CDATA[
     $(document).ready(function() {
         $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults, {
+            "autoWidth": false,
             "aoColumnDefs": [
-                { "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false },
-            ]
+                { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }
+            ],
+            "sPaginationType": "four_button"
         } ));
+        $(".delete_patron").on("click", function(){
+            $(".dropdown").removeClass("open");
+            var list = $(this).data("list-name");
+            return confirmDelete( _("Are you sure you want to delete the list %s?").format(list) );
+        });
     });
-
-    function ConfirmDelete( list ) {
-        return confirm( _("Are you sure you want to delete the list %s?").format(list) );
-    }
 //]]>
 </script>
 
 </head>
 
-<body>
+<body id="patlist_lists" class="pat patlist">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Patron lists</div>
 
-<div class="yui-t7">
-    <div class="yui-main">
-        <h1>Your patron lists</h1>
+<div id="doc3" class="yui-t2">
+   <div id="bd">
+    <div id="yui-main">
+        <div class="yui-b">
 
-        <div class="btn-group">
-            <a class="btn btn-small" href="add-modify.pl"><i class="icon-plus"></i> New patron list</a>
+        <div id="toolbar" class="btn-toolbar">
+            <div class="btn-group">
+                <a class="btn btn-small" href="add-modify.pl"><i class="fa fa-plus"></i> New patron list</a>
+            </div>
         </div>
 
+        <h1>Your patron lists</h1>
+
+        [% IF ( lists ) %]
+
         <table id="patron-lists-table">
             <thead>
                 <tr>
                     <th>Name</th>
                     <th>Patrons in list</th>
-                    <th>&nbsp;</th>
-                    <th>&nbsp;</th>
-                    <th>&nbsp;</th>
+                    <th class="NoSort">&nbsp;</th>
                 </tr>
             </thead>
 
                         <td>[% l.name %]</td>
                         <td>[% l.patron_list_patrons_rs.count || 0 %]</td>
                         <td>
-                            <a class="btn btn-mini" href="list.pl?patron_list_id=[% l.patron_list_id %]">
-                                <i class="icon-plus-sign"></i> Add patrons <i class="icon-user"></i>
-                            </a>
-                        </td>
-                        <td>
-                            <a class="btn btn-mini" href="add-modify.pl?patron_list_id=[% l.patron_list_id %]">
-                                <i class="icon-edit"></i> Edit
-                            </a>
-                        </td>
-                        <td>
-                            <a class="btn btn-mini" href="delete.pl?patron_list_id=[% l.patron_list_id %]" onclick='return ConfirmDelete("[% l.name | html %]")'>
-                                <i class="icon-trash"></i> Delete
-                            </a>
+                            <div class="dropdown">
+                                <a class="btn btn-mini dropdown-toggle" id="listactions[% l.patron_list_id %]" role="button" data-toggle="dropdown" href="#">
+                                   Actions <b class="caret"></b>
+                                </a>
+                                <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="listactions[% l.patron_list_id %]">
+                                    <li><a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id %]"><i class="fa fa-user"></i> Add patrons</a></li>
+                                    <li><a href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% l.patron_list_id %]"><i class="fa fa-pencil"></i> Edit list</a></li>
+                                    <li><a class="delete_patron" href="/cgi-bin/koha/patron_lists/delete.pl?patron_list_id=[% l.patron_list_id %]" data-list-name="[% l.name %]"><i class="fa fa-trash"></i> Delete list</a></li>
+                                    [% IF ( l.patron_list_patrons_rs.count ) %]
+                                        <li class="divider"></li>
+                                        <li><a href="#" onclick='GB_showCenter(_("Print patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?patronlist_id=[% l.patron_list_id %]", 400, 800);return false;'><i class="fa fa-print"></i> Print patron cards</a></li>
+                                        [% IF CAN_user_tools_edit_patrons %]
+                                            <li>
+                                                <a href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% l.patron_list_id %]&op=show">
+                                                    <i class="fa fa-pencil"></i> Batch edit patrons</i>
+                                                </a>
+                                            </li>
+                                        [% END %]
+                                        [% IF CAN_user_tools_delete_anonymize_patrons %]
+                                            <li>
+                                                <a href="/cgi-bin/koha/tools/cleanborrowers.pl?step=2&patron_list_id=[% l.patron_list_id %]&checkbox=borrower">
+                                                    <i class="fa fa-trash"></i> Batch delete patrons</i>
+                                                </a>
+                                            </li>
+                                        [% END %]
+                                    [% END %]
+                                </ul>
+                            </div>
                         </td>
                     </tr>
                 [% END %]
             </tbody>
         </table>
+        [% ELSE %]
+           <div class="dialog message">There are no patron lists.</div>
+        [% END %]
+
+            </div>
+        </div>
+        <div class="yui-b noprint">
+            [% INCLUDE 'tools-menu.inc' %]
+        </div>
     </div>
-</div>
 [% INCLUDE 'intranet-bottom.inc' %]