Do not use JavaScript to hide double conso after loading

This commit is contained in:
Alexandre Iooss 2020-04-10 19:50:42 +02:00
parent 658d402242
commit cf67e17e85
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
2 changed files with 4 additions and 6 deletions

View File

@ -26,7 +26,7 @@ $(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"); let double_conso_obj = $("#double_conso");
double_conso_obj.click(function() { double_conso_obj.click(function() {
$("#consos_list_div").show(); $("#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');
@ -46,7 +46,7 @@ $(document).ready(function() {
let single_conso_obj = $("#single_conso"); let single_conso_obj = $("#single_conso");
single_conso_obj.click(function() { single_conso_obj.click(function() {
$("#consos_list_div").hide(); $("#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');
@ -74,8 +74,6 @@ $(document).ready(function() {
double_conso_obj.removeAttr('checked'); double_conso_obj.removeAttr('checked');
$("label[for='double_conso']").attr('class', 'btn btn-sm btn-outline-primary'); $("label[for='double_conso']").attr('class', 'btn btn-sm btn-outline-primary');
$("#consos_list_div").hide();
$("#consume_all").click(consumeAll); $("#consume_all").click(consumeAll);
}); });

View File

@ -42,7 +42,7 @@
</div> </div>
</div> </div>
<div class="col-xl-5" id="consos_list_div"> <div class="col-xl-5 d-none" id="consos_list_div">
<div class="card border-info shadow mb-4"> <div class="card border-info shadow mb-4">
<div class="card-header"> <div class="card-header">
<p class="card-text font-weight-bold"> <p class="card-text font-weight-bold">
@ -150,7 +150,7 @@
{% endblock %} {% endblock %}
{% block extrajavascript %} {% block extrajavascript %}
<script type="text/javascript" src="/static/js/consos.js"></script> <script type="text/javascript" src="{% static "js/consos.js" %}"></script>
<script type="text/javascript"> <script type="text/javascript">
{% for button in most_used %} {% for button in most_used %}
{% if button.display %} {% if button.display %}