Skip to content

Commit

Permalink
LTI-401: followup to make checkboxes mutually exclusive without disab…
Browse files Browse the repository at this point in the history
…ling (#338)
  • Loading branch information
jfederico authored Jul 24, 2024
1 parent 557fe04 commit 8890fd0
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions app/javascript/packs/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,34 @@ $(document).on('turbolinks:load', function () {

handleUseSharedCodeCheckbox();

$('#allModerators_checkbox').on('click', function () {
function handleRoomSettingCheckboxes() {
var all_mod_checked = $('#allModerators_checkbox').prop("checked");
var guest_policy_checked = $('#guestPolicy_checkbox').prop("checked");

if (all_mod_checked) {
$('#guestPolicy_checkbox').prop("checked", false).prop("disabled", true);
} else {
$('#guestPolicy_checkbox').prop("disabled", false);
$('#guestPolicy_checkbox').prop("checked", false);
}
})

$('#guestPolicy_checkbox').on('click', function () {
var guest_policy_checked = $('#guestPolicy_checkbox').prop("checked");
if (guest_policy_checked) {
$('#allModerators_checkbox').prop("checked", false).prop("disabled", true);
} else {
$('#allModerators_checkbox').prop("disabled", false);
$('#allModerators_checkbox').prop("checked", false);
}
})
}

$('#allModerators_checkbox').on('change', function () {
var is_checked = $(this).prop("checked");
if (is_checked) {
$('#guestPolicy_checkbox').prop("checked", false);
}
});

$('#guestPolicy_checkbox').on('change', function () {
var is_checked = $(this).prop("checked");
if (is_checked) {
$('#allModerators_checkbox').prop("checked", false);
}
});

handleRoomSettingCheckboxes(); // Apply the rule on page load

function check_record_status() {
var record_checked = $('#record_checkbox').prop("checked");
Expand Down

0 comments on commit 8890fd0

Please sign in to comment.