Bug 41570: Tidy kohaTable - course_reserves/course-details.tt

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2026-01-08 12:36:50 +01:00 committed by Lucas Gass
parent 1c3afb52ab
commit bc1b3d5a7d
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 9 additions and 8 deletions

View File

@ -362,6 +362,14 @@
[% INCLUDE 'datatables.inc' %]
<script>
var table_settings = [% TablesSettings.GetTableSettings( 'coursereserves', 'reserves', 'course_reserves_table', 'json' ) | $raw %];
const course_reserves_size = [% course_reserves.size || 0 | html %]
const i18n = {
are_you_sure_items: [% I18N.tnx("Are you sure you want to delete this course? There is one attached item.", "Are you sure you want to delete this course? There are {count} attached items.", course_reserves_size, { count: course_reserves_size}) | html %],
are_you_sure_no_item: [% I18N.t("Are you sure you want to delete this course?") | html %],
};
</script>
<script>
$(document).ready(function(){
$("#delete_course_button").on( 'click', function(e){
@ -394,14 +402,7 @@
});
$("#delete_course").click(function(){
[% SET count = course_reserves.size || 0 %]
[% IF count == 1 %]
return confirmDelete(_("Are you sure you want to delete this course? There is %s attached item.").format([% count | html %]) );
[% ELSIF count > 1 %]
return confirmDelete(_("Are you sure you want to delete this course? There are %s attached items.").format([% count | html %]) );
[% ELSE %]
return confirmDelete(_("Are you sure you want to delete this course?"));
[% END %]
return confirmDelete(course_reserves_size > 0 ? i18n.are_you_sure_items : i18n.are_you_sure_no_item);
});
});
</script>