Koha/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-reserves.tt
Julian Maurice ed7543287b Bug 20538: Remove the need of writing [% KOHA_VERSION %] everywhere
Having to write [% KOHA_VERSION %] for each url is bad because:
- It's easily forgettable when adding new <script> or <link>
- It prevents grep'ing for the full filename
- It violates the DRY principle
- If at some point we want to change the "force js and css reload"
  mechanism, it will be tedious

This patch:
- adds a Template::Toolkit plugin that generates <script> and
  <link> tags for JS and CSS files, and inserts automatically the Koha
  version in the filename
- use the new plugin to remove all occurences of [% KOHA_VERSION %]
- remove the code that was adding KOHA_VERSION as a template variable

Test plan:
1. Apply patch
2. Go to several different pages in Koha (opac and intranet) while
   checking your browser's dev tools (there should be no 404 for JS and
   CSS files, and the Koha version should appear in filenames) and the
   server logs (there should be no "File not found")
3. `git grep KOHA_VERSION` should return nothing
4. prove t/db_dependent/Koha/Template/Plugin/Asset.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-04-13 11:49:44 -03:00

109 lines
4.8 KiB
Text

[% USE Asset %]
[% USE AuthorisedValues %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Course reserves</title>
[% INCLUDE 'doc-head-close.inc' %]
[% Asset.css("css/datatables.css") %]
</head>
<body id="courses_course_reserves" class="course">
[% 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/course_reserves/course-reserves.pl">Course reserves</a></div>
<div class="main container-fluid">
<div class="row">
<div class="col-md-8 col-md-offset-2">
[% IF CAN_user_coursereserves_add_reserves OR CAN_user_coursereserves_manage_courses OR CAN_user_coursereserves_manage_courses %]
<div id="toolbar">
[% IF ( CAN_user_coursereserves_manage_courses ) %]
<a class="btn btn-default btn-sm" id="new_course" href="/cgi-bin/koha/course_reserves/course.pl"><i class="fa fa-plus"></i> New course</a>
[% END %]
</div><!-- /toolbar -->
[% END %]
<!--
<div id="search-toolbar">
<script type="text/javascript">
//<![CDATA[
function submitSearchForm(p_oEvent){
$('#search_courses_form').submit();
}
$(document).ready(function(){
newCourseButton = new YAHOO.widget.Button("search_courses");
newCourseButton.on("click", submitSearchForm );
});
//]]>
</script>
<ul class="toolbar">
<li><form id="search_courses_form"><input type="text" name="search_on" id="search_on"></form></li>
<li><a id="search_courses">Search courses</a></li>
</ul>
</div>
-->
<h1>Courses</h1>
<table id="course_reserves_table">
<thead>
<tr>
<th>Name</th>
<th>Dept.</th>
<th>Course #</th>
<th>Section</th>
<th>Term</th>
<th>Instructors</th>
<th>Staff note</th>
<th>Public note</th>
<th># of Students</th>
<th>Enabled</th>
</tr>
</thead>
<tbody>
[% FOREACH c IN courses %]
<tr>
<td><a href="course-details.pl?course_id=[% c.course_id %]">[% c.course_name %]</a></td>
<td>[% AuthorisedValues.GetByCode( 'DEPARTMENT', c.department ) %]</td>
<td>[% c.course_number %]</td>
<td>[% c.section %]</td>
<td>[% AuthorisedValues.GetByCode( 'TERM' c.term ) %]</td>
<td>
[% FOREACH i IN c.instructors %]
<div class="instructor"><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% i.borrowernumber %]">[% i.firstname %] [% i.surname %]</a></div>
[% END %]
</td>
<td>[% c.staff_note %]</td>
<td>[% c.public_note %]</td>
<td>[% c.students_count %]</td>
<td>
[% IF c.enabled == 'yes' %]
Yes
[% ELSE %]
No
[% END %]
</td>
[% END %]
</tbody>
</table>
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript" id="js">
$(document).ready(function() {
$("#course_reserves_table").dataTable($.extend(true, {}, dataTablesDefaults, {
"sPaginationType": "four_button"
}));
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]