From be702c2454301f8742fa83a0edd662d67550d51e Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Mon, 10 Oct 2016 15:34:44 -0300 Subject: [PATCH] =?UTF-8?q?Remove=20duplica=C3=A7=C3=A3o=20de=20c=C3=B3dig?= =?UTF-8?q?o=20JavaScript?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/sessao/sessaoplenaria_form.html | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/sapl/templates/sessao/sessaoplenaria_form.html b/sapl/templates/sessao/sessaoplenaria_form.html index 86aa6b190..cf8cbd64f 100644 --- a/sapl/templates/sessao/sessaoplenaria_form.html +++ b/sapl/templates/sessao/sessaoplenaria_form.html @@ -30,7 +30,8 @@ // Filtra as choices de sessao legislativa pela legislatura $(function() { - $("#id_legislatura").ready(function(){ + function altera_legislatura(){ + console.debug('hey'); var id_legislatura = $("#id_legislatura").val(); var id_sessao_leg = $("#id_sessao_legislativa").val(); $("#id_sessao_legislativa option").remove(); @@ -48,28 +49,12 @@ else{ $("#id_sessao_legislativa option").remove(); } - }); + } - $("#id_legislatura").change(function(){ - var id_legislatura = $("#id_legislatura").val(); - $("#id_sessao_legislativa option").remove(); - if (id_legislatura) { + $("#id_legislatura").ready(altera_legislatura); - $.get("/sessao/sessao-legislativa-legislatura-ajax", {legislatura: id_legislatura}, function(data) { - lista_sessoes = data['sessao_legislativa']; - - $('#id_sessao_legislativa').append(''); - for (i = 0; i < lista_sessoes.length; i++) { - $('#id_sessao_legislativa').append(''); - } - - }); - } - else{ - $("#id_sessao_legislativa option").remove(); - } - }); - }) + $("#id_legislatura").change(altera_legislatura); + });