Skip to content

Commit 7896ab8

Browse files
authored
Merge pull request #89 from cmu-delphi/OKRS24-119
OKRS24-119
2 parents a38fa47 + 654ae79 commit 7896ab8

File tree

1 file changed

+36
-19
lines changed

1 file changed

+36
-19
lines changed

src/templates/signals/signals.html

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ <h5 class="modal-title">Available Geography</h5>
110110
</div>
111111
</div>
112112
</div>
113-
<div class="d-flex justify-content-evenly bulk-select">
114-
<a role="button">All</a>
115-
<a role="button">Clear</a>
113+
<div class="bulk-select">
114+
<input type="checkbox" class="form-check-input" id="select-all">
115+
<label for="select-all">Select all</label>
116116
</div>
117117
<div id="div_id_available_geography" class="mb-3">
118118
{% for choice in form.available_geography.field.choices %}
@@ -166,9 +166,9 @@ <h5 class="modal-title">Signal Type</h5>
166166
</div>
167167
</div>
168168
</div>
169-
<div class="d-flex justify-content-evenly bulk-select">
170-
<a role="button">All</a>
171-
<a role="button">Clear</a>
169+
<div class="bulk-select">
170+
<input type="checkbox" class="form-check-input" id="select-all">
171+
<label for="select-all">Select all</label>
172172
</div>
173173
<div id="div_id_signal_type" class="mb-3">
174174
{% for choice in form.signal_type.field.choices %}
@@ -220,9 +220,9 @@ <h5 class="modal-title">Category</h5>
220220
</div>
221221
</div>
222222
</div>
223-
<div class="d-flex justify-content-evenly bulk-select">
224-
<a role="button">All</a>
225-
<a role="button">Clear</a>
223+
<div class="bulk-select">
224+
<input type="checkbox" class="form-check-input" id="select-all">
225+
<label for="select-all">Select all</label>
226226
</div>
227227
{{ form.category|as_crispy_field }}
228228
</div>
@@ -252,9 +252,9 @@ <h5 class="modal-title">Format Type</h5>
252252
</div>
253253
</div>
254254
</div>
255-
<div class="d-flex justify-content-evenly bulk-select">
256-
<a role="button">All</a>
257-
<a role="button">Clear</a>
255+
<div class="bulk-select">
256+
<input type="checkbox" class="form-check-input" id="select-all">
257+
<label for="select-all">Select all</label>
258258
</div>
259259
{{ form.format_type|as_crispy_field }}
260260
</div>
@@ -284,9 +284,9 @@ <h5 class="modal-title">Source</h5>
284284
</div>
285285
</div>
286286
</div>
287-
<div class="d-flex justify-content-evenly bulk-select">
288-
<a role="button">All</a>
289-
<a role="button">Clear</a>
287+
<div class="bulk-select">
288+
<input type="checkbox" class="form-check-input" id="select-all">
289+
<label for="select-all">Select all</label>
290290
</div>
291291
<div id="div_id_source" class="mb-3">
292292
{% for choice in form.source.field.choices %}
@@ -416,12 +416,29 @@ <h5 class="modal-title">Time Label</h5>
416416
bulkSelectDivs.forEach(div => {
417417
div.addEventListener('click', function(event) {
418418
let form = this.nextElementSibling;
419+
let showMoreLink = form.querySelector('a');
419420
let checkboxes = form.querySelectorAll('input[type="checkbox"]');
420421

421-
if (event.target.innerText === 'All') {
422-
checkboxes.forEach(checkbox => checkbox.checked = true);
423-
} else if (event.target.innerText === 'Clear') {
424-
checkboxes.forEach(checkbox => checkbox.checked = false);
422+
if (event.target.checked === true) {
423+
checkboxes.forEach((checkbox, index) => {
424+
checkbox.checked = true;
425+
if (index > 4) {
426+
checkbox.parentElement.style.display = checkbox.parentElement.style.display === 'none' ? 'block' : null;
427+
}
428+
})
429+
if (showMoreLink) {
430+
showMoreLink.innerText = 'Show less...';
431+
}
432+
} else if (event.target.checked === false) {
433+
checkboxes.forEach((checkbox, index) => {
434+
checkbox.checked = false
435+
if (index > 4) {
436+
checkbox.parentElement.style.display = checkbox.parentElement.style.display === 'block' ? 'none' : null;
437+
}
438+
});
439+
if (showMoreLink) {
440+
showMoreLink.innerText = 'Show more...';
441+
}
425442
}
426443
});
427444
});

0 commit comments

Comments
 (0)