Bug 2889 - templates should use [% IF ( loop.odd ) %] - Administration

Some scripts pass a template variable to facilitate an alternate table
row class for styling. Other use the 'IF (loop.odd)' construction. I
think we're at the point where the CSS3 :nth-child() selector is
widely-supported enough that we can do without template-based solutions:

http://caniuse.com/#feat=css-sel3

This patch adds such a selector to the staff client CSS and removes the
corresponding template markup from Administration pages. The last in
this series of patches will remove the redundant CSS.

Also in this patch: a few minor markup corrections.

To test, apply the patch and clear your browser cache if necessary. View
the following pages and confirm that alternate table row highlighting
works as before:

 - Administration -> Budgets
 - Acquisitions   -> Vendor -> Contracts
 - Administration -> Budgets -> Budget -> Planning
 - Administration -> Authority types
 - Administration -> Authority types -> MARC structure
 - Administration -> Authority types -> MARC structure -> subfields
 - Administration -> MARC bibliographic framework
 - Administration -> MARC bibliographic framework -> MARC structure
 - Administration -> MARC bibliographic framework -> MARC structure -> Subfields
 - Administration -> Libraries and groups
 - Administration -> Cities and towns
 - Administration -> Classification sources
 - Administration -> Circulation and fines rules
 - Administration -> Currencies and exchange rates
 - Administration -> Item types
 - Administration -> Koha to MARC mapping
 - Administration -> System preferences -> Local use
 - Administration -> Z39.50 client targets

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Owen Leonard 2014-07-14 08:33:48 -04:00 committed by Tomas Cohen Arazi
parent 97fa2c032e
commit a46b3b4de0
22 changed files with 40 additions and 87 deletions

View File

@ -260,6 +260,7 @@ table+table {
.highlighted-row { background-color: orange !important }
tbody tr:nth-child(odd) td,
tr.highlight td,
tr.highlight th,
tr.odd td,

View File

@ -570,11 +570,7 @@
</thead>
<tbody>
[% FOREACH period_loo IN period_inactive_loop %]
[% IF ( loop.odd ) %]
<tr>
[% ELSE %]
<tr class="highlight">
[% END %]
<tr>
<td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_loo.budget_period_id %]" title="View funds for [% period_loo.budget_period_description %]">[% period_loo.budget_period_description %]</a></td>
<td><span title="[% period_loo.budget_period_startdate %]">[% period_loo.budget_period_startdate | $KohaDates %]</span></td>
<td><span title="[% period_loo.budget_period_enddate %]">[% period_loo.budget_period_enddate | $KohaDates %]</span></td>

View File

@ -181,7 +181,7 @@ function Check(ff) {
<th scope="col" colspan="2">&nbsp; </th>
</tr>
[% FOREACH loo IN loop %]
[% IF ( loop.even ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
<tr>
<td>
<a href="[% loo.script_name %]?op=add_form&amp;booksellerid=[% loo.booksellerid %]&amp;contractnumber=[% loo.contractnumber %]">[% loo.contractname %]</a>
</td>

View File

@ -125,7 +125,7 @@
<tbody>
[% FOREACH budget_line IN budget_lines %]
[% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
<tr>
[% IF ( budget_line.budget_lock ) %]
<td class="locked" title="Fund locked">
[% ELSE %]

View File

@ -262,11 +262,7 @@ function displayMoreConstraint(numlayer){
<th>Delete</th>
</tr>
[% FOREACH loo IN loop %]
[% UNLESS ( loop.odd ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
<td>[% loo.tagsubfield %]</td>
<td>
[% IF ( loo.subfield_ignored ) %]

View File

@ -54,7 +54,7 @@
[% ELSE %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Default framework</a>
[% END %] &rsaquo; Data deleted
[% ELSE %]
[% IF ( authtypecode ) %][% authtypecode %] Framework</a>
[% IF ( authtypecode ) %][% authtypecode %] Framework
[% ELSE %]Default framework
[% END %]
[% END %]
@ -200,31 +200,31 @@
</div>
<table id="table_authtagstructure">
<thead>
<th>Tag</th>
<th>Lib</th>
<th>Repeatable</th>
<th>Mandatory</th>
<th>Authorized<br />value</th>
<th>Subfields</th>
<th>Edit</th>
<th>Delete</th>
<tr>
<th>Tag</th>
<th>Lib</th>
<th>Repeatable</th>
<th>Mandatory</th>
<th>Authorized<br />value</th>
<th>Subfields</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
[% FOREACH loo IN loop %]
[% UNLESS ( loop.odd ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
<td><b>[% loo.tagfield %]</b></td>
<td>[% loo.liblibrarian %]</td>
<td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
<td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
<td>[% loo.authorised_value %]</td>
<td><a href="[% loo.subfield_link %]" class="button">subfields</a></td>
<td><a href="[% loo.edit %]">Edit</a></td>
<td><a href="[% loo.delete %]">Delete</a></td>
</tr>
[% END %]
<tbody>
[% FOREACH loo IN loop %]
<tr>
<td><b>[% loo.tagfield %]</b></td>
<td>[% loo.liblibrarian %]</td>
<td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
<td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
<td>[% loo.authorised_value %]</td>
<td><a href="[% loo.subfield_link %]" class="button">subfields</a></td>
<td><a href="[% loo.edit %]">Edit</a></td>
<td><a href="[% loo.delete %]">Delete</a></td>
</tr>
[% END %]
</tbody>
</table>
[% END %]

View File

@ -104,11 +104,7 @@
</tr>
[% FOREACH loo IN loop %]
[% IF ( loop.odd ) %]
<tr>
[% ELSE %]
<tr class="highlight">
[% END %]
<td>[% loo.authtypecode %]</td>
<td>[% loo.authtypetext %]</td>
<td>[% loo.summary %]</td>

View File

@ -220,9 +220,7 @@
</tr>
<!-- note highlight assignment appears backwards because we already have a normal row for Default -->
[% FOREACH loo IN loop %]
[% IF ( loop.odd ) %]<tr class="highlight">
[% ELSE %]<tr>
[% END %]
<tr>
<td>[% loo.frameworkcode %]</td>
<td>[% loo.frameworktext %]</td>
<td><a href="marctagstructure.pl?frameworkcode=[% loo.frameworkcode %]" >MARC structure</a></td>

View File

@ -95,7 +95,7 @@
<tbody>
[% FOREACH to_branch_loo IN codes_loo.to_branch_loop %]
[% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
<tr>
<td><label style="min-width:400px;" for="[% to_branch_loo.code %][% to_branch_loo.toBranch %]row">[% to_branch_loo.toBranch %] - [% to_branch_loo.toBranchname %]</label></td>
<td>
[% IF ( to_branch_loo.isChecked ) %]

View File

@ -186,11 +186,7 @@ tinyMCE.init({
<th>&nbsp;</th>
</tr></thead><tbody>
[% FOREACH branche IN branches %]
[% IF ( loop.odd ) %]
<tr>
[% ELSE %]
<tr class="highlight">
[% END %]
<tr>
<td>[% branche.branch_name |html %]</td>
<td>[% branche.branch_code |html %]</td>
<td>

View File

@ -131,11 +131,7 @@
<th>&nbsp;</th>
</thead>
[% FOREACH loo IN loop %]
[% UNLESS ( loop.odd ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
<tr>
<td>[% loo.cityid %]</td>
<td>[% loo.city_name %]</td>
<td>[% loo.city_state %]</td>

View File

@ -250,11 +250,7 @@ function CheckRuleForm(f) {
<th>Actions</th>
</tr>
[% FOREACH class_source IN class_sources %]
[% IF ( loop.odd ) %]
<tr>
[% ELSE %]
<tr class="highlight">
[% END %]
<td>[% class_source.code %]</td>
<td>[% class_source.description %]</td>
<td>[% IF ( class_source.used ) %]Yes[% ELSE %]No[% END %]</td>

View File

@ -1,5 +1,5 @@
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; Issuing Rules &rsaquo; Clone Issuing Rules</title>
<title>Koha &rsaquo; Administration &rsaquo; Issuing rules &rsaquo; Clone issuing rules</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="admin_clone-rules" class="admin">

View File

@ -266,11 +266,7 @@ Item types administration
<th>Actions</th>
</thead>
[% FOREACH loo IN loop %]
[% UNLESS ( loop.odd ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
<tr>
[% UNLESS ( noItemTypeImages ) %] <td>[% IF ( loo.imageurl ) %]<img src="[% loo.imageurl %]" alt="" />[% ELSE %]&nbsp;[% END %]</td>[% END %]
<td>
<a href="[% loo.script_name %]?op=add_form&amp;itemtype=[% loo.itemtype |html %]">

View File

@ -92,11 +92,7 @@
<th>&nbsp;</th>
</tr>
[% FOREACH loo IN loop %]
[% UNLESS ( loop.odd ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
<td><a href="[% loo.edit %]">[% loo.kohafield %]</a></td>
<td>[% loo.tagfield %]</td>
<td>[% loo.tagsubfield %]</td>

View File

@ -391,11 +391,7 @@ function populateHiddenCheckboxes(tab) {
<th>Delete</th>
</tr>
[% FOREACH loo IN loop %]
[% UNLESS ( loop.odd ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
<td><a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&amp;tagfield=[% loo.tagfield %]&amp;frameworkcode=[% frameworkcode %]#sub[% loo.tagsubfield %]field">[% loo.tagsubfield %]</a></td>
<td>
[% IF ( loo.subfield_ignored ) %]

View File

@ -192,7 +192,7 @@ $(document).ready(function() {
<tbody>
[% IF ( select_display ) %]
[% FOREACH loo IN loop %]
[% IF ( loop.odd ) %]<tr>[% ELSE %]<tr class="highlight">[% END %]
<tr>
<td>[% loo.tagfield %]</td>
<td>[% loo.liblibrarian %]</td>
<td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>

View File

@ -164,7 +164,7 @@
<th>&nbsp;</th>
</tr>
[% FOREACH loo IN loop %]
[% IF ( loop.odd ) %]<tr>[% ELSE %]<tr class="highlight">[% END %]
<tr>
<td>[% loo.printername %]</td>
<td>[% loo.printqueue %]</td>
<td>[% loo.printtype %]</td>

View File

@ -162,11 +162,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
</thead>
<tbody>
[% FOREACH rule IN rules %]
[% UNLESS ( loop.odd ) %]
<tr class="highlight" id="row_[% loop.count %]">
[% ELSE %]
<tr id="row_[% loop.count %]">
[% END %]
<td>[% IF ( rule.default_humancategorycode ) %]
<em>All</em>
[% ELSE %]

View File

@ -120,9 +120,7 @@
<th></th>
</tr>
[% FOREACH loo IN loop %]
[% IF ( loop.odd ) %]<tr>
[% ELSE %]<tr class="highlight">
[% END %]
<tr>
<td>[% loo.word %]</td>
<td><a href="[% loo.script_name %]?op=delete_confirm&amp;searchfield=[% loo.word %]">Delete</a></td>
</tr>

View File

@ -264,7 +264,7 @@
</tr></thead>
[% END %]
<tbody>[% FOREACH loo IN loop %]
[% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
<tr>
<td><strong><a href="[% loo.edit %]">[% loo.variable %]</a></strong></td><td> [% loo.explanation |html %]</td>
[% IF ( loo.oneline ) %]

View File

@ -216,11 +216,7 @@
</tr></thead>
<tbody>
[% FOREACH loo IN loop %]
[% UNLESS ( loop.odd ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
<tr>
<td><a href="[% loo.script_name %]?op=edit&amp;id=[% loo.id %]">[% loo.servername %]</a></td><td>[% loo.host %]:[% loo.port %]</td><td>[% loo.db %]</td><td>[% loo.userid %]</td><td>[% IF loo.password %]########[% END %]</td><td>[% IF ( loo.checked ) %]Yes[% ELSE %]No[% END %]</td><td>[% loo.rank %]</td>
<td>[% loo.syntax %]</td><td>[% loo.encoding %]</td><td>[% loo.timeout %]</td>
<td>[% IF ( loo.recordtype == 'biblio' ) %]