Bug 40757: Highlight circulation rules on click

To test:
1 - Apply patch, yarn build, restart all
2 - Browse to Admin->Circulation rules
3 - Click on some rows
4 - They highlight!
5 - Click to edit a row, highlight removed
6 - Cancel editing, editing color is removed
7 - Sign off!

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2025-09-04 15:39:06 +00:00 committed by Laura_Escamilla
parent 2e4c20a024
commit 45b3a9badd
No known key found for this signature in database
GPG Key ID: 56A7626A071C052F
2 changed files with 20 additions and 4 deletions

View File

@ -398,6 +398,11 @@ caption {
background-color: #FFD000;
}
.selected-row,
.selected-row td {
background-color: #D0FF00;
}
.warned-row,
.warned-row td {
background-color: #FF9000;
@ -410,7 +415,7 @@ caption {
tbody {
tr {
&:nth-child( odd ):not( .dtrg-group, .active, .ok, .highlighted-row ) {
&:nth-child( odd ):not( .dtrg-group, .active, .ok, .highlighted-row, .selected-row ) {
td {
&:not( .bg-danger, .bg-warning, .bg-info, .bg-success, .bg-primary, .highlighted-row ) {
background-color: $table-odd-row;

View File

@ -1462,7 +1462,7 @@
function clear_edit() {
var cancel = confirm(_("Are you sure you want to cancel your changes?"));
if (!cancel) return;
$("#default-circulation-rules td").removeClass("highlighted-row");
$("#default-circulation-rules tr").removeClass("highlighted-row");
var edit_row = $("#edit_row");
$(edit_row)
.find("input")
@ -1506,6 +1506,17 @@
$("#branch").change(function () {
$("#selectlibrary").submit();
});
$("#default-circulation-rules tbody tr")
.not("#edit_row")
.click(function () {
if ($(this).hasClass("highlighted-row")) {
return;
} else if ($(this).hasClass("selected-row")) {
$(this).removeClass("selected-row");
} else {
$(this).addClass("selected-row");
}
});
$(".editrule").click(function () {
if (
$("#edit_row")
@ -1517,13 +1528,13 @@
var edit = confirm(_("Are you sure you want to edit another rule?"));
if (!edit) return false;
}
$("#default-circulation-rules td").removeClass("highlighted-row");
$("#default-circulation-rules tr").removeClass("highlighted-row");
$(this).closest("tr").addClass("highlighted-row").removeClass("selected-row");
$(this)
.parent()
.parent()
.find("td")
.each(function (i) {
$(this).addClass("highlighted-row");
itm_code = $(this).data("code");
itm_text = $(this).text();
itm_text = itm_text.replace(/^\s*|\s*$/g, "");