mirror of https://gitlab.crans.org/bde/nk20
Use JQuery addClass and removeClass
This commit is contained in:
parent
cf67e17e85
commit
18c95f2063
|
@ -24,9 +24,8 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Switching in double consumptions mode should update the layout
|
// Switching in double consumptions mode should update the layout
|
||||||
let double_conso_obj = $("#double_conso");
|
$("#double_conso").click(function() {
|
||||||
double_conso_obj.click(function() {
|
$("#consos_list_div").removeClass('d-none');
|
||||||
$("#consos_list_div").attr('class', 'col-xl-5');
|
|
||||||
$("#infos_div").attr('class', 'col-sm-5 col-xl-6');
|
$("#infos_div").attr('class', 'col-sm-5 col-xl-6');
|
||||||
$("#note_infos_div").attr('class', 'col-xl-3');
|
$("#note_infos_div").attr('class', 'col-xl-3');
|
||||||
$("#user_select_div").attr('class', 'col-xl-4');
|
$("#user_select_div").attr('class', 'col-xl-4');
|
||||||
|
@ -44,9 +43,8 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let single_conso_obj = $("#single_conso");
|
$("#single_conso").click(function() {
|
||||||
single_conso_obj.click(function() {
|
$("#consos_list_div").addClass('d-none');
|
||||||
$("#consos_list_div").attr('class', 'col-xl-5 d-none');
|
|
||||||
$("#infos_div").attr('class', 'col-sm-5 col-md-4');
|
$("#infos_div").attr('class', 'col-sm-5 col-md-4');
|
||||||
$("#note_infos_div").attr('class', 'col-xl-5');
|
$("#note_infos_div").attr('class', 'col-xl-5');
|
||||||
$("#user_select_div").attr('class', 'col-xl-7');
|
$("#user_select_div").attr('class', 'col-xl-7');
|
||||||
|
@ -69,10 +67,8 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Ensure we begin in single consumption. Removing these lines may cause problems when reloading.
|
// Ensure we begin in single consumption. Fix issue with TurboLinks and BootstrapJS
|
||||||
single_conso_obj.prop('checked', 'true');
|
$("label[for='double_conso']").removeClass('active');
|
||||||
double_conso_obj.removeAttr('checked');
|
|
||||||
$("label[for='double_conso']").attr('class', 'btn btn-sm btn-outline-primary');
|
|
||||||
|
|
||||||
$("#consume_all").click(consumeAll);
|
$("#consume_all").click(consumeAll);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue