Skip to content
This repository has been archived by the owner on Aug 7, 2018. It is now read-only.

Commit

Permalink
Melhora comportamento dos botões de filtro
Browse files Browse the repository at this point in the history
  • Loading branch information
diraol committed Sep 4, 2016
1 parent da87ee4 commit bd4897e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
7 changes: 4 additions & 3 deletions radar_parlamentar/radar_parlamentar/templates/plenaria.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ <h4><div id="votacao"/></h4>
<div class='filtrosVotosVotacao'>
<h3> Filtros </h3>
<ul>
<li><input type="button" onClick="destacarVoto('SIM')" name="VotoSim", value="Voto Sim"></button></li>
<li><input type="button" onClick="destacarVoto('NAO')" name="VotoNão", value="Voto Não"></button></li>
<li><input type="button" onClick="destacarVoto('ABSTENCAO')" name="Abstenção", value="Abstenção"></button></li>
<li><input type="button" class="filtro-voto botao" onClick="destacarVoto('SIM')" name="VotoSim", value="Voto Sim"></button></li>
<li><input type="button" class="filtro-voto botao" onClick="destacarVoto('NAO')" name="VotoNão", value="Voto Não"></button></li>
<li><input type="button" class="filtro-voto botao" onClick="destacarVoto('ABSTENCAO')" name="Abstenção", value="Abstenção"></button></li>
<li><input type="button" class="filtro-voto botao todos ativado" onClick="destacarVoto('TODOS')" name="Todos", value="Todos"></button></li>
</ul>
</div>
<div class='myflex-spacer'></div>
Expand Down
23 changes: 19 additions & 4 deletions radar_parlamentar/static/files/codes/js/plenaria.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,28 @@ Plot = (function ($) {
})(jQuery);

function destacarVoto(voto){
// Limpa dados de um votante específico
$("#detalheParlamentar").empty();
// Configura os botões
if (voto == "TODOS") {
$(".filtro-voto").removeClass("ativado");
$(this).addClass("ativado");
} else {
if ($(this).hasClass("ativado")) {
$(".filtro-voto").removeClass("ativado");
$(".filtro-voto.todos").addClass("ativado");
} else {
$(".filtro-voto").removeClass("ativado");
$(this).addClass("ativado");
}
}
situacao_atual = $(".filtro-voto.ativado").val();
d3.selectAll("circle").each(function(d,i){
var el = d3.select(this)
.attr('data-destacado', 0)
.attr('fill-opacity', 1)
.attr('stroke-width', 0);
if (el.attr("data-voto")==voto) {
.attr("data-destacado", 0)
.attr("fill-opacity", 1)
.attr("stroke-width", 0);
if (el.attr("data-voto")==voto || voto=="TODOS" || situacao_atual=="TODOS") {
el.attr("fill", el.attr("data-cor-partido"));
} else {
el.attr("fill", "#ccc");
Expand Down

0 comments on commit bd4897e

Please sign in to comment.