mirror of
https://github.com/simonw/datasette.git
synced 2026-11-18 08:08:32 +01:00
Fix minor irritation with /-/allowed UI
This commit is contained in:
parent
7d9d7acb0b
commit
ee62bf9bdc
3 changed files with 32 additions and 28 deletions
|
|
@ -42,7 +42,7 @@
|
|||
<div class="form-section">
|
||||
<label for="child">Filter by child (optional):</label>
|
||||
<input type="text" id="child" name="child" placeholder="e.g., table name">
|
||||
<small>Filter results to a specific child resource (requires parent)</small>
|
||||
<small>Filter results to a specific child resource (requires parent to be set)</small>
|
||||
</div>
|
||||
|
||||
<div class="form-section">
|
||||
|
|
@ -236,12 +236,15 @@ function displayError(data) {
|
|||
const parentInput = document.getElementById('parent');
|
||||
const childInput = document.getElementById('child');
|
||||
|
||||
childInput.addEventListener('focus', () => {
|
||||
parentInput.addEventListener('input', () => {
|
||||
childInput.disabled = !parentInput.value;
|
||||
if (!parentInput.value) {
|
||||
alert('Please specify a parent resource first before filtering by child resource.');
|
||||
parentInput.focus();
|
||||
childInput.value = '';
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize disabled state
|
||||
childInput.disabled = !parentInput.value;
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue