Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt
Owen Leonard 9042ce4ea5 Bug 10632 [Follow-up] Enable datatables for courses and course details in the OPAC
This follow-up adds some style improvements and corrects some errors in
the previous patch:

- The path to datatables.css has been corrected
- Unused CSS has been removed from datatables.css (particularly related
  to pagination controls, which are currently unused in the OPAC).
- Style has been added to datatables.css to make the table search form
  look better.
- The configuration of the course details table has been enhanced to
  include a title sort which ignores articles and date sorting according
  to the "title-string" method for date format agnostic sorting.
- Unrelated: A message <div> has been modified to have the correct style
  for the Bootstrap theme.

To test you should have multiple courses and at least one course with
multiple reserves. Clear your browser cache if necessary and view the
list of courses in the OPAC. All table sorting should work correctly, as
should the table search form.

View the details of a course which has multiple reserves. All sorting
should work correctly, including title sort excluding articles. Sorting
by date due should work correctly for any dateformat system preference
setting.

View the details of a course which has no reserves. You should see a "No
reserves" message box with a style consistent with similar messages in
the Bootstrap OPAC.

View other sorted tables in the OPAC to confirm that the CSS changes
have not negatively affected their appearance: opac-user.pl for
instance, or opac-detail.pl.

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

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 16:07:33 -03:00

104 lines
5.2 KiB
Text

[% USE Koha %]
[% USE KohaDates %]
[% USE AuthorisedValues %]
[% USE ItemTypes %]
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Course reserves for [% course.course_name %]
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %]
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
[% END %]
</head>
[% INCLUDE 'bodytag.inc' bodyid='opac-main' %]
[% INCLUDE 'masthead.inc' %]
<div class="main">
<ul class="breadcrumb">
<li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
<li><a href="/cgi-bin/koha/opac-course-reserves.pl">Course reserves</a> <span class="divider">&rsaquo;</span></li>
<li><a href="#">Course reserves for <i>[% course.course_name %]</i></a></li>
</ul>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<h2>Course reserves for <i>[% course.course_name %]</i></h2>
<div class="rows">
<ol>
[% IF ( course.term ) %]<li><span class="label">Term:</span> [% AuthorisedValues.GetByCode( 'TERM', course.term ) %]</li>[% END %]
<li><span class="label">Department:</span> [% AuthorisedValues.GetByCode( 'DEPARTMENT', course.department ) %]</li>
[% IF ( course.course_number ) %]<li><span class="label">Course number:</span> [% course.course_number %]</li>[% END %]
[% IF ( course.section ) %]<li><span class="label">Section:</span> [% course.section %]</li>[% END %]
[% IF ( course.instructors ) %]
<li><span class="label">Instructors:</span>
<ul>
[% FOREACH i IN course.instructors %]
<li><div class="instructor">[% i.firstname %] [% i.surname %]</div></li>
[% END %]
</ul>
</li>
[% END %]
[% IF ( course.public_note ) %]<li><span class="label">Notes:</span> [% course.public_note %]</li>[% END %]
</ol>
</div>
[% IF ( course_reserves ) %]
<table id="course-items-table" class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th class="anti-the">Title</th>
<th>Item type</th>
<th>Location</th>
<th>Collection</th>
<th>Call number</th>
<th>Copy number</th>
<th>Status</th>
<th class="title-string">Date due</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
[% FOREACH cr IN course_reserves %]
<tr>
<td><a href="opac-detail.pl?biblionumber=[% cr.item.biblionumber %]">[% cr.item.title %]</a></td>
<td>[% ItemTypes.GetDescription( cr.item.itype ) %]</td>
<td>[% Branches.GetName( cr.item.holdingbranch ) %] <br/> <i>[% AuthorisedValues.GetByCode( 'LOC', cr.item.location ) %]</i></td>
<td>[% AuthorisedValues.GetByCode( 'CCODE', cr.item.ccode ) %]</td>
<td>[% cr.item.itemcallnumber %]</td>
<td>[% cr.item.copynumber %]</td>
<td>[% INCLUDE 'item-status.inc' item=cr.item issue=cr.issue %]</td>
<td><span title="[% cr.issue.date_due %]">[% cr.issue.date_due | $KohaDates as_due_date => 1 %]</span></td>
<td>[% cr.public_note %]</td>
</tr>
[% END %]
</tbody>
</table>
[% ELSE %]
<br style="clear:both;" />
<div class="alert alert-info">
<p>No reserves have been selected for this course.</p>
</div>
[% END %]
</div> <!-- / .span12 -->
</div> <!-- / .row-fluid -->
</div> <!-- / .container-fluid -->
</div> <!-- / .main -->
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
$(document).ready(function() {
$("#course-items-table").dataTable($.extend(true, {}, dataTablesDefaults, {
"sDom": '<"top"flp>rt<"clear">',
"aoColumnDefs": [
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] },
{ "sType": "title-string", "aTargets" : [ "title-string" ] }
]
}));
});
</script>
[% END %]