@@ -110,9 +110,9 @@ <h5 class="modal-title">Available Geography</h5>
110
110
</ div >
111
111
</ div >
112
112
</ 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 >
116
116
</ div >
117
117
< div id ="div_id_available_geography " class ="mb-3 ">
118
118
{% for choice in form.available_geography.field.choices %}
@@ -166,9 +166,9 @@ <h5 class="modal-title">Signal Type</h5>
166
166
</ div >
167
167
</ div >
168
168
</ 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 >
172
172
</ div >
173
173
< div id ="div_id_signal_type " class ="mb-3 ">
174
174
{% for choice in form.signal_type.field.choices %}
@@ -220,9 +220,9 @@ <h5 class="modal-title">Category</h5>
220
220
</ div >
221
221
</ div >
222
222
</ 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 >
226
226
</ div >
227
227
{{ form.category|as_crispy_field }}
228
228
</ div >
@@ -252,9 +252,9 @@ <h5 class="modal-title">Format Type</h5>
252
252
</ div >
253
253
</ div >
254
254
</ 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 >
258
258
</ div >
259
259
{{ form.format_type|as_crispy_field }}
260
260
</ div >
@@ -284,9 +284,9 @@ <h5 class="modal-title">Source</h5>
284
284
</ div >
285
285
</ div >
286
286
</ 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 >
290
290
</ div >
291
291
< div id ="div_id_source " class ="mb-3 ">
292
292
{% for choice in form.source.field.choices %}
@@ -416,12 +416,29 @@ <h5 class="modal-title">Time Label</h5>
416
416
bulkSelectDivs . forEach ( div => {
417
417
div . addEventListener ( 'click' , function ( event ) {
418
418
let form = this . nextElementSibling ;
419
+ let showMoreLink = form . querySelector ( 'a' ) ;
419
420
let checkboxes = form . querySelectorAll ( 'input[type="checkbox"]' ) ;
420
421
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
+ }
425
442
}
426
443
} ) ;
427
444
} ) ;
0 commit comments