Bug 22015: Move DataTables CSS to global include
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / clubs / clubs.tt
index f52f055..64338a5 100644 (file)
@@ -1,71 +1,13 @@
+[% USE raw %]
+[% USE Asset %]
 [% USE KohaDates %]
 [% USE Branches %]
 [% USE Koha %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Tools &rsaquo; Patron clubs</title>
 [% INCLUDE 'doc-head-close.inc' %]
 
-<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
-[% INCLUDE 'datatables.inc' %]
-
-<script type="text/javascript">
-//<![CDATA[
-    $(document).ready(function() {
-        tTable = $('#club-templates-table').dataTable($.extend(true, {}, dataTablesDefaults, {
-            "sPaginationType": "four_button",
-            "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
-            "aoColumnDefs": [
-                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
-            ]
-        } ));
-
-        cTable = $('#clubs-table').dataTable($.extend(true, {}, dataTablesDefaults, {
-            "sPaginationType": "four_button",
-            "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
-            "aoColumnDefs": [
-                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
-            ]
-        } ));
-    });
-
-    function ConfirmDeleteTemplate( id, name, a ) {
-        if ( confirm( _("Are you sure you want to delete the club template %s? This will delete all clubs using this template and cancel patron enrollments" ).format(name) ) ) {
-            $.ajax({
-                type: "POST",
-                url: '/cgi-bin/koha/svc/club/template/delete',
-                data: { id: id },
-                success: function( data ) {
-                    if ( data.success ) {
-                        location.reload();
-                    } else {
-                        alert(_("Unable to delete template!"));
-                    }
-                },
-                dataType: 'json'
-            });
-        }
-    }
-
-    function ConfirmDeleteClub( id, name, a ) {
-        if ( confirm( _("Are you sure you want to delete the club %s? This will cancel all patron enrollments in this club." ).format(name) ) ) {
-            $.ajax({
-                type: "POST",
-                url: '/cgi-bin/koha/svc/club/delete',
-                data: { id: id },
-                success: function( data ) {
-                    if ( data.success ) {
-                        location.reload();
-                    } else {
-                        alert(_("Unable to delete club!"));
-                    }
-                },
-                dataType: 'json'
-            });
-        }
-    }
-//]]>
-</script>
-
 </head>
 
 <body id="clubs_clubs" class="clubs">
 [% 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 clubs</div>
 
-<div id="doc3" class="yui-t2">
-   <div id="bd">
-        <div id="yui-main">
-            <div class="yui-b">
+<div class="main container-fluid">
+    <div class="row">
+        <div class="col-sm-10 col-sm-push-2">
+            <main>
+
                 <h1>Patron clubs</h1>
 
                 [% IF club_template %]
                     <div class="dialog message">
                         [% IF stored == 'updated' %]
-                            <p>Club template <i>[% club_template.name %]</i> was updated.</p>
+                            <p>Club template <i>[% club_template.name | html %]</i> was updated.</p>
                         [% ELSE %]
-                            <p>Club template <i>[% club_template.name %]</i> was saved.</p>
+                            <p>Club template <i>[% club_template.name | html %]</i> was saved.</p>
                         [% END %]
                     </div>
                 [% ELSIF club %]
                     <div class="dialog message">
                         [% IF stored == 'updated' %]
-                            <p>Club <i>[% club.name %]</i> was updated.</p>
+                            <p>Club <i>[% club.name | html %]</i> was updated.</p>
                         [% ELSE %]
-                            <p>Club <i>[% club.name %]</i> was saved.</p>
+                            <p>Club <i>[% club.name | html %]</i> was saved.</p>
                         [% END %]
                     </div>
                 [% END %]
                         <tbody>
                             [% FOREACH t IN club_templates %]
                                 <tr>
-                                    <td>[% t.name %]</td>
-                                    <td>[% t.description %]</td>
+                                    <td>[% t.name | html %]</td>
+                                    <td>[% t.description | html %]</td>
                                     <td>
                                         [% IF t.is_enrollable_from_opac %]
                                             Yes
                                             No
                                         [% END %]
                                     </td>
-                                    <td>[% Branches.GetName( t.branchcode ) %]</td>
+                                    <td>[% Branches.GetName( t.branchcode ) | html %]</td>
                                     <td class="actions">
                                         [% IF CAN_user_clubs_edit_templates %]
-                                            <a class="btn btn-xs btn-default" style="white-space:nowrap"  href="/cgi-bin/koha/clubbs/templates-add-modify.pl?id=[% t.id %]">
+                                            <a class="btn btn-xs btn-default" style="white-space:nowrap"  href="/cgi-bin/koha/clubs/templates-add-modify.pl?id=[% t.id | html %]">
                                                 <i class="fa fa-pencil"></i> Edit
                                             </a>
-                                            <a class="btn btn-xs btn-default" href="#" onclick='ConfirmDeleteTemplate([% t.id %], "[% t.name | html %]", $(this) ); return false;'>
+                                            <a class="btn btn-xs btn-default" href="#" onclick='ConfirmDeleteTemplate([% t.id | html %], "[% t.name | html %]", $(this) ); return false;'>
                                                 <i class="fa fa-trash"></i> Delete
                                             </a>
                                         [% END %]
                             [% END %]
                             <ul class="dropdown-menu">
                                 [% FOREACH t IN club_templates %]
-                                    <li><a href="/cgi-bin/koha/clubs/clubs-add-modify.pl?club_template_id=[% t.id %]">[% t.name %]</a></li>
+                                    <li><a href="/cgi-bin/koha/clubs/clubs-add-modify.pl?club_template_id=[% t.id | uri %]">[% t.name | html %]</a></li>
                                 [% END %]
                             </ul>
                         </div>
                         <tbody>
                             [% FOREACH c IN clubs %]
                                 <tr>
-                                    <td>[% c.name %]</td>
-                                    <td>[% c.club_template.name %]</td>
-                                    <td>[% c.description %]</td>
+                                    <td>[% c.name | html %]</td>
+                                    <td>[% c.club_template.name | html %]</td>
+                                    <td>[% c.description | html %]</td>
                                     <td>
                                         [% IF c.club_template.is_enrollable_from_opac %]
                                             Yes
                                             No
                                         [% END %]
                                     </td>
-                                    <td>[% Branches.GetName( c.branchcode ) %]</td>
+                                    <td>[% Branches.GetName( c.branchcode ) | html %]</td>
                                     <td>
                                         [% IF c.date_start %]
                                             [% c.date_start | $KohaDates %]
                                         [% END %]
                                     </td>
                                     <td>
-                                        [% c.club_enrollments.count %]
+                                        [% c.club_enrollments.count | html %]
                                     </td>
                                     <td class="actions">
                                         <div class="dropdown">
-                                            <a class="btn btn-default btn-xs dropdown-toggle" id="clubactions[% c.id %]" role="button" data-toggle="dropdown" href="#">
+                                            <a class="btn btn-default btn-xs dropdown-toggle" id="clubactions[% c.id | html %]" role="button" data-toggle="dropdown" href="#">
                                                 Actions <b class="caret"></b>
                                             </a>
-                                            <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="clubactions[% c.id %]">
+                                            <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="clubactions[% c.id | html %]">
                                                 [% IF ( c.club_enrollments.count ) %]
                                                     <li>
-                                                        <a href="club-enrollments.pl?id=[% c.id %]">
+                                                        <a href="club-enrollments.pl?id=[% c.id | uri %]">
                                                             <i class="fa fa-list-ul"></i> Enrollments
                                                         </a>
                                                     </li>
                                                 [% ELSE %]
                                                     <li class="disabled">
-                                                        <a href="club-enrollments.pl?id=[% c.id %]">
+                                                        <a href="club-enrollments.pl?id=[% c.id | uri %]">
                                                             <i class="fa fa-list-ul"></i> Enrollments
                                                         </a>
                                                     </li>
                                                 [% END %]
                                                 [% IF CAN_user_clubs_edit_clubs %]
                                                     <li>
-                                                        <a href="clubs-add-modify.pl?id=[% c.id %]">
+                                                        <a href="clubs-add-modify.pl?id=[% c.id | uri %]">
                                                             <i class="fa fa-pencil"></i> Edit
                                                         </a>
                                                     </li>
                                                     <li>
-                                                        <a href="#" onclick='ConfirmDeleteClub([% c.id %], "[% c.name | html %]", $(this) ); return false;'>
+                                                        <a href="#" onclick='ConfirmDeleteClub([% c.id | html %], "[% c.name | html %]", $(this) ); return false;'>
                                                             <i class="fa fa-trash"></i> Delete
                                                         </a>
                                                     </li>
                         <div class="dialog message">No clubs defined. A club template must be defined before a club can be defined.</div>
                     [% END %]
                 [% END %]
-            </div> <!-- /.yui-b -->
-        </div> <!-- /.yui-main -->
-        <div class="yui-b noprint">
-            [% INCLUDE 'tools-menu.inc' %]
-        </div>
-    </div> <!-- /#bd -->
+
+            </main>
+        </div> <!-- /.col-sm-10.col-sm-push-2 -->
+
+        <div class="col-sm-2 col-sm-pull-10">
+            <aside>
+                [% INCLUDE 'tools-menu.inc' %]
+            </aside>
+        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
+     </div> <!-- /.row -->
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'datatables.inc' %]
+    [% Asset.js("js/tools-menu.js") | $raw %]
+    <script>
+        $(document).ready(function() {
+            tTable = $('#club-templates-table').dataTable($.extend(true, {}, dataTablesDefaults, {
+                "sPaginationType": "four_button",
+                "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
+                "aoColumnDefs": [
+                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
+                ]
+            } ));
+
+            cTable = $('#clubs-table').dataTable($.extend(true, {}, dataTablesDefaults, {
+                "sPaginationType": "four_button",
+                "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
+                "aoColumnDefs": [
+                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
+                ]
+            } ));
+        });
+
+        function ConfirmDeleteTemplate( id, name, a ) {
+            if ( confirm( _("Are you sure you want to delete the club template %s? This will delete all clubs using this template and cancel patron enrollments" ).format(name) ) ) {
+                $.ajax({
+                    type: "POST",
+                    url: '/cgi-bin/koha/svc/club/template/delete',
+                    data: { id: id },
+                    success: function( data ) {
+                        if ( data.success ) {
+                            location.reload();
+                        } else {
+                            alert(_("Unable to delete template!"));
+                        }
+                    },
+                    dataType: 'json'
+                });
+            }
+        }
+
+        function ConfirmDeleteClub( id, name, a ) {
+            if ( confirm( _("Are you sure you want to delete the club %s? This will cancel all patron enrollments in this club." ).format(name) ) ) {
+                $.ajax({
+                    type: "POST",
+                    url: '/cgi-bin/koha/svc/club/delete',
+                    data: { id: id },
+                    success: function( data ) {
+                        if ( data.success ) {
+                            location.reload();
+                        } else {
+                            alert(_("Unable to delete club!"));
+                        }
+                    },
+                    dataType: 'json'
+                });
+            }
+        }
+    </script>
+[% END %]
 
 [% INCLUDE 'intranet-bottom.inc' %]