Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/clubs-tab.tt
Wainui Witika-Park d3ab8dbeec Bug 28242: added captions to tables and legends to forms
Ensured that in the OPAC, all tables have relevant captions and all forms have relevant legends.

Many of these have class="sr-only" so they are not visible but will be
available for people who use screen-readers.

To test:
1) Go to OPAC
2) Apply patch and dependencies
3) Check that on all pages, any tables have a caption (many of them will
    not be visible, but will be in the markup code)
4) Check that on all pages, any forms have a legend (many of them will
    not be visible, but will be in the markup code)
5) Check that the captions are appropriate and relevant
6) Check that the legends are appropriate and relevant

Sponsored-by: Catalyst IT

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-21 14:05:30 +02:00

101 lines
3.3 KiB
Text

[% USE KohaDates %]
[% IF enrollments %]
<h2>Clubs currently enrolled in</h2>
<table id="clubs-table-enrolled" class="table table-bordered table-striped">
<caption class="sr-only">Clubs</caption>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Date enrolled</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
[% FOREACH e IN enrollments %]
<tr>
<td>[% e.club.name | html %]</td>
<td>[% e.club.description | html %]</td>
<td>[% e.date_enrolled | $KohaDates %]</td>
<td>
[% IF e.club.club_template.is_enrollable_from_opac %]
<button class="btn btn-xs btn-default" onclick="cancelEnrollment( [% e.id | html %] )">
<i class="fa fa-remove" aria-hidden="true"></i> Cancel enrollment
</button>
[% ELSE %]
Contact your library to be disenrolled from this club.
[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
[% IF clubs %]
<h2>Clubs you can enroll in</h2>
<table id="clubs-table-unenrolled" class="table table-bordered table-striped">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
[% FOREACH c IN clubs %]
<tr>
<td>[% c.name | html %]</td>
<td>[% c.description | html %]</td>
<td>
[% IF !c.club_template.is_email_required || ( c.club_template.is_email_required && borrower.first_valid_email_address ) %]
<button class="btn btn-xs btn-default" onclick="loadEnrollmentForm([% c.id | html%])">
<i class="fa fa-plus" aria-hidden="true"></i> Enroll
</button>
[% ELSE %]
<span class="hint">You must have an email address to enroll</span>
[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
<script>
function loadEnrollmentForm( id ) {
$("body").css("cursor", "progress");
$('#opac-user-clubs').load('/cgi-bin/koha/clubs/enroll.pl?borrowernumber=[% borrower.borrowernumber | html %]&id=' + id, function() {
$("body").css("cursor", "default");
});
return false;
}
function cancelEnrollment( id ) {
$("body").css("cursor", "progress");
$.ajax({
type: "POST",
url: '/cgi-bin/koha/svc/club/cancel_enrollment',
data: { id: id },
success: function( data ) {
if ( data.success ) {
$('#opac-user-clubs').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrower.borrowernumber | html %]', function() {
$("body").css("cursor", "default");
});
} else {
alert(_("Unable to cancel enrollment!"));
}
},
dataType: 'json'
});
return false;
}
</script>