From f696f8289f5f91bbd9aa744b6cfb8ec9d1aaff45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Kervella?= Date: Sun, 15 Oct 2017 00:18:08 +0000 Subject: [PATCH 1/3] Fix bug id avec JS et paiement + utilisation bootstrap --- .../templates/cotisations/new_facture.html | 56 ++++++++++++------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/cotisations/templates/cotisations/new_facture.html b/cotisations/templates/cotisations/new_facture.html index 2dfa52c2..f2586e8b 100644 --- a/cotisations/templates/cotisations/new_facture.html +++ b/cotisations/templates/cotisations/new_facture.html @@ -38,18 +38,20 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ venteform.management_form }}

Articles de la facture

-
+
{% for form in venteform.forms %} -
-

- {{ form.as_table }} -

+
+ Article :   + {% bootstrap_form form label_class='sr-only' %} +   +
{% endfor %}
-

-

Prix total : 0,00

@@ -63,19 +65,23 @@ with this program; if not, write to the Free Software Foundation, Inc., prices[{{ article.id|escapejs }}] = {{ article.prix }}; {% endfor %} - var template = `

{{ venteform.empty_form.as_table }}

`; + var template = `Article :   + {% bootstrap_form venteform.empty_form label_class='sr-only' %} +   + ` function add_article(){ // Index start at 0 => new_index = number of items var new_index = document.getElementsByClassName('product_to_sell').length; - document.getElementById('id_form-TOTAL_FORMS').value = - parseInt(document.getElementById('id_form-TOTAL_FORMS').value) + 1; + document.getElementById('id_form-TOTAL_FORMS').value ++; var new_article = document.createElement('div'); - new_article.className = 'product_to_sell'; + new_article.className = 'product_to_sell form-inline'; new_article.innerHTML = template.replace(/__prefix__/g, new_index); - document.getElementById('form_set') - .appendChild(new_article); + document.getElementById('form_set').appendChild(new_article); add_listenner_for_id(new_index); } @@ -106,18 +112,28 @@ with this program; if not, write to the Free Software Foundation, Inc., .addEventListener("onkeypress", update_price, true); document.getElementById('id_form-' + i.toString() + '-quantity') .addEventListener("change", update_price, true); + document.getElementById('id_form-' + i.toString() + '-article-remove') + .addEventListener("click", function(event) { + var article = event.target.parentNode; + article.parentNode.removeChild(article); + document.getElementById('id_form-TOTAL_FORMS').value --; + update_price(); + } + ) } - function set_cheque_info_visibility(){ - var visible = document.getElementById("id_paiement").value == document.getElementById("id_paiement").getAttribute('data-cheque'); - p = document.getElementById("id_paiement") - console.log(p); + function set_cheque_info_visibility() { + var paiement = document.getElementById("id_Facture-paiement"); + var visible = paiement.value == paiement.getAttribute('data-cheque'); + p = document.getElementById("id_Facture-paiement"); var display = 'none'; if (visible) { display = 'block'; } - document.getElementById("id_cheque").parentNode.style.display = display; - document.getElementById("id_banque").parentNode.style.display = display; + document.getElementById("id_Facture-cheque") + .parentNode.style.display = display; + document.getElementById("id_Facture-banque") + .parentNode.style.display = display; } // Add events manager when DOM is fully loaded @@ -129,7 +145,7 @@ with this program; if not, write to the Free Software Foundation, Inc., for (i = 0; i < product_count; ++i){ add_listenner_for_id(i); } - document.getElementById("id_paiement") + document.getElementById("id_Facture-paiement") .addEventListener("change", set_cheque_info_visibility, true); set_cheque_info_visibility(); update_price(); From 8579b7d60cd2ca3c563596f94634d586e6b2099d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Kervella?= Date: Sun, 15 Oct 2017 14:47:22 +0000 Subject: [PATCH 2/3] Affichage plus lisible pour la suppression des droits --- users/templates/users/del_right.html | 31 ++++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/users/templates/users/del_right.html b/users/templates/users/del_right.html index 740778a2..30edf666 100644 --- a/users/templates/users/del_right.html +++ b/users/templates/users/del_right.html @@ -35,19 +35,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% csrf_token %} - - - {% for key, values in userform.items %} - - {% endfor %} - - - + {% for key, values in userform.items %} - {% bootstrap_form_errors values %} - - {% endfor %} + + + + + + {% endfor %} +
{{ key }}
{{ values.rights }}
+ +
+
+
    + {% for user in values.rights %} +
  • {{ user }}
  • + {% endfor %} +
+
+
{% bootstrap_button "Modifier" button_type="submit" icon="star" %}
From 01f3936ae12f3d613dd5b781a4994c6b722036b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Kervella?= Date: Sun, 15 Oct 2017 15:27:13 +0000 Subject: [PATCH 3/3] =?UTF-8?q?Fix=20:=20merge=20fait=20=C3=A0=20l'arrache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- topologie/templates/topologie/switch.html | 2 +- topologie/views.py | 18 ++++-------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/topologie/templates/topologie/switch.html b/topologie/templates/topologie/switch.html index fe224678..249097e7 100644 --- a/topologie/templates/topologie/switch.html +++ b/topologie/templates/topologie/switch.html @@ -54,7 +54,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endif %} {% if interfaceform %} {% if i_bft_param %} - {% massive_bootstrap_form interfaceform 'ipv4,machine' mbf_param=i_bft_param %} + {% massive_bootstrap_form interfaceform 'ipv4,machine' mbf_param=i_mbf_param %} {% else %} {% massive_bootstrap_form interfaceform 'ipv4,machine' %} {% endif %} diff --git a/topologie/views.py b/topologie/views.py index fb7550db..f1e8740c 100644 --- a/topologie/views.py +++ b/topologie/views.py @@ -381,20 +381,15 @@ def new_switch(request): reversion.set_comment("Création") messages.success(request, "Le switch a été créé") return redirect("/topologie/") -<<<<<<< HEAD - i_bft_param = generate_ipv4_mbf_param( interface, False ) - return form({'topoform':switch, 'machineform': machine, 'interfaceform': interface, 'domainform': domain, 'i_bft_param': i_bft_param}, 'topologie/switch.html', request) -======= - i_bft_param = generate_ipv4_bft_param(interface, False) + i_mbf_param = generate_ipv4_mbf_param( interface, False ) return form({ 'topoform': switch, 'machineform': machine, 'interfaceform': interface, 'domainform': domain, - 'i_bft_param': i_bft_param + 'i_mbf_param': i_mbf_param }, 'topologie/switch.html', request) ->>>>>>> master @login_required @permission_required('infra') @@ -454,20 +449,15 @@ def edit_switch(request, switch_id): ) messages.success(request, "Le switch a bien été modifié") return redirect("/topologie/") -<<<<<<< HEAD - i_bft_param = generate_ipv4_mbf_param( interface_form, False ) - return form({'topoform':switch_form, 'machineform': machine_form, 'interfaceform': interface_form, 'domainform': domain_form, 'i_bft_param': i_bft_param}, 'topologie/switch.html', request) -======= - i_bft_param = generate_ipv4_bft_param(interface_form, False) + i_mbf_param = generate_ipv4_mbf_param( interface_form, False ) return form({ 'topoform': switch_form, 'machineform': machine_form, 'interfaceform': interface_form, 'domainform': domain_form, - 'i_bft_param': i_bft_param + 'i_mbf_param': i_mbf_param }, 'topologie/switch.html', request) ->>>>>>> master @login_required @permission_required('infra')