From 96fb2c143960c6ec238868002082adc396ea9377 Mon Sep 17 00:00:00 2001 From: James Armstong Date: Fri, 2 Aug 2024 21:39:01 -0700 Subject: [PATCH] Auto disable author/title sort input in metadata edit form --- cps/static/js/table.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cps/static/js/table.js b/cps/static/js/table.js index e556d85c3..269549a41 100644 --- a/cps/static/js/table.js +++ b/cps/static/js/table.js @@ -130,7 +130,29 @@ $(function() { $("#table_xchange").attr("aria-disabled", false); } + }); + + // Small block to initialize the state of the author/title sort inputs in metadata form + { + let checkA = $('#autoupdate_authorsort').prop('checked'); + $('#author_sort_input').prop('disabled', checkA); + let checkT = $('#autoupdate_titlesort').prop('checked'); + $('#title_sort_input').prop('disabled', checkT); + } + + // Disable/enable author and title sort input in respect to auto-update title/author sort being checked on or not + $("#autoupdate_authorsort").on('change', function(event) { + let checkA = $('#autoupdate_authorsort').prop('checked'); + $('#author_sort_input').prop('disabled', checkA); + }) + + $("#autoupdate_titlesort").on('change', function(event) { + let checkT = $('#autoupdate_titlesort').prop('checked'); + $('#title_sort_input').prop('disabled', checkT); + }) + ///// + $("#delete_selection").click(function() { $("#books-table").bootstrapTable("uncheckAll"); });