Skip to content

Commit

Permalink
Update sheet selection dialog UI:
Browse files Browse the repository at this point in the history
- Change the label from "Close" to "OK".
- Disable the OK button until at least one checkbox is selected.
- Add a heading "Show sheets" above the checkboxes.

Signed-off-by: Parth Raiyani <[email protected]>
Change-Id: I8fdabce9508296052f6c2e7741be651ef45df9f8
  • Loading branch information
rparth07 committed Dec 4, 2024
1 parent 7168663 commit 2fb6744
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion browser/src/control/Parts.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,26 @@ L.Map.include({
}
};

this.uiManager.showInfoModal('show-sheets-modal', '', ' ', ' ', _('Close'), callback, true, 'show-sheets-modal-response');
this.uiManager.showInfoModal('show-sheets-modal', _('Show sheets'), ' ', ' ', _('OK'), callback, true, 'show-sheets-modal-response');
const modal = document.getElementById('show-sheets-modal');
modal.insertBefore(container, modal.children[0]);

var okButton = document.getElementById('show-sheets-modal-response');
var checkboxes = document.querySelectorAll('#show-sheets-modal input[type="checkbox"]');

okButton.disabled = true;

checkboxes.forEach(function(checkbox) {
checkbox.addEventListener('change', function() {
var anyChecked = false;
checkboxes.forEach(function(checkbox) {
if (checkbox.checked) {
anyChecked = true;
}
});
okButton.disabled = !anyChecked;
});
});
}
},

Expand Down

0 comments on commit 2fb6744

Please sign in to comment.