Skip to content

Commit

Permalink
Merge 276835f into 649d033
Browse files Browse the repository at this point in the history
  • Loading branch information
lfalvarez committed Sep 12, 2018
2 parents 649d033 + 276835f commit 7c52818
Showing 1 changed file with 38 additions and 17 deletions.
55 changes: 38 additions & 17 deletions merepresenta/templates/match/resultado_ajax.html
Expand Up @@ -13,30 +13,27 @@

<template>
<div class="col-4">
<div id="mulher">
<input type="checkbox" id="mulher_input" v-model="isMulher"><label for="mulher_input">Mulher</label>
</div>
<div id='race_checkboxes'>
<h3>por estado:</h3>
<ul class="filtros">
<li v-for="estado in estadosList">
<input type="checkbox" :id="estado.id" :value="estado.id" v-model="checkedEstado">
<label :for="estado.id">[[ estado.label ]]</label>
</li>
</ul>
<select v-model="checkedEstado">
<template v-for="estado in estadosList">
<option :id="estado.id" :value="estado.id" >
[[ estado.label ]]</option>
</template>
<select>
</div>
</div>
<div class="col-8">
<h2>Seus candidatos sao:</h2>
<ul class="results">
<template v-if="checkedEstado.length == 0">
<li v-for="item in sortedList">
name: [[ item.name ]], gender: [[ item.gender ]], lgtb: [[ item.lgbt ]], raca: [[ item.race ]], nota: [[ item.nota ]]
</li>
</template>
<template v-else>
<!-- <span> g: [[ checkedGenders.indexOf(item.gender) ]] </span> -->
<li v-for="item in sortedList" v-if="checkedEstado.indexOf(item.filter.estado) !== -1">
<template>
<li v-for="item in sortedList" v-if="filterElement(item)">
name: [[ item.name ]], gender: [[ item.gender ]], lgtb: [[ item.lgbt ]], raca: [[ item.race ]], nota: [[ item.nota ]]
</li>
</template>
</template>
</ul>
</div>
</template>
Expand All @@ -47,7 +44,24 @@ <h2>Seus candidatos sao:</h2>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
<script type="text/javascript" src="{% static 'js/dicts_for_result.js' %}"></script>
<script type="text/javascript">

var filterEstado = function(el, checkedEstado){
if(!checkedEstado){
return true;
}
if (checkedEstado === el.filter.estado){
return true;
}
return false;
}
var filterMulher = function(el, isMulher){
if(!isMulher){
return true;
}
if (el.filter.mulher){
return true;
}
return false;
}
$(function(){
$.post({
url: '{% url "match_result_ajax" %}',
Expand All @@ -65,7 +79,14 @@ <h2>Seus candidatos sao:</h2>
list: data,
partidosList: partidos_ids,
estadosList: estados_ids,
checkedEstado: []
isMulher: undefined,
checkedEstado: false,
filterElement: function(el){
var f_estado = filterEstado(el, this.checkedEstado);
var f_mulher = filterMulher(el, this.isMulher);
return f_estado && f_mulher;
}

},
computed: {
sortedList: function() {
Expand Down

0 comments on commit 7c52818

Please sign in to comment.