Browse Source

Fix #1814 (#1826)

pull/1831/head
Victor Fabre 7 years ago
committed by Edward
parent
commit
a69594241a
  1. 3
      sapl/painel/views.py
  2. 96
      sapl/templates/painel/voto_nominal.html

3
sapl/painel/views.py

@ -84,6 +84,7 @@ def votacao_aberta(request):
def votante_view(request): def votante_view(request):
# Pega o votante relacionado ao usuário # Pega o votante relacionado ao usuário
template_name = 'painel/voto_nominal.html'
try: try:
votante = Votante.objects.get(user=request.user) votante = Votante.objects.get(user=request.user)
except ObjectDoesNotExist: except ObjectDoesNotExist:
@ -220,7 +221,7 @@ def votante_view(request):
return HttpResponseRedirect( return HttpResponseRedirect(
reverse('sapl.painel:voto_individual')) reverse('sapl.painel:voto_individual'))
return render(request, 'painel/voto_nominal.html', context) return render(request, template_name, context)
@user_passes_test(check_permission) @user_passes_test(check_permission)

96
sapl/templates/painel/voto_nominal.html

@ -11,6 +11,10 @@
<script type="text/javascript" src="{% static 'js/jquery.runner.js' %}"></script> <script type="text/javascript" src="{% static 'js/jquery.runner.js' %}"></script>
<style type="text/css"> <style type="text/css">
html, body {
max-width: 100%;
overflow-x: hidden;
}
@media screen { @media screen {
body { body {
background: #1c1b1b; background: #1c1b1b;
@ -18,19 +22,37 @@
ul, li { ul, li {
list-style-type: none; list-style-type: none;
} }
#date, #relogio, #resultado_votacao, #blocoprincipal, #blocoerro {
font-family: Verdana;
}
} }
#votos
{
text-align:center;
}
#votosim, #votonao, #votoabstencao
{
display:inline;
}
</style> </style>
</head> </head>
{% if not error_message %} <body>
<body>
{% if not error_message %}
<div id="blocoprincipal" style="display:block">
<h1><b><font color="#4FA64D"><p align="center">{{sessao}}</p></font></b></h1> <h1><b><font color="#4FA64D"><p align="center">{{sessao}}</p></font></b></h1>
<table style="width:100%"> <table style="width:90%">
<tr> <tr>
<th style="text-align:center"><font color="white" size="4">Hora Início: {{hora}}</font></th> <td style="text-align:center"><font color="white" size="4">Data Início: {{data}}</font></td>
<th style="text-align:center"><font color="white" size="4">Data Início: {{data}}</font></th> <td style="text-align:center"><font color="white" size="4">Hora Início: {{hora}}</font></td>
</tr> </tr>
</table>
<h1><font color="white"><p align="center"><span id="relogio"></span></p></font></h1> <tr>
<td style="text-align:center"><font color="white" size="6"><span id="date"></span></font></td>
<td style="text-align:center"><font color="white" size="6"><span id="relogio"></span></font></td>
</tr>
</table>
</br> </br>
</br> </br>
@ -62,12 +84,14 @@
{% csrf_token %} {% csrf_token %}
<div class="row container-detail clearfix" style="text-align:center"> <div class="row container-detail clearfix" style="text-align:center">
<div class="row-fluid"> <div class="row-fluid">
<div class="col-md-12"> <div class="col-md-12" id="votos">
<div id="votosim">
<input type="submit" class="btn btn-lg btn-success" id="voto" name="voto" type="submit" value="Sim"/> <input type="submit" class="btn btn-lg btn-success" id="voto" name="voto" type="submit" value="Sim"/>
&nbsp &nbsp;
<input type="submit" class="btn btn-lg btn-danger" id="voto" name="voto" type="submit" value="Não"/> </div>
&nbsp <div id="votonao"><input type="submit" class="btn btn-lg btn-danger" id="voto" name="voto" type="submit" value="Não"/></div>
<input type="submit" class="btn btn-lg btn-secondary" id="voto" name="voto" type="submit" value="Abstenção"/> &nbsp;
<div id="votoabstencao"><input type="submit" class="btn btn-lg btn-secondary" id="voto" name="voto" type="submit" value="Abstenção"/></div>
</div> </div>
</br> </br>
</br> </br>
@ -77,20 +101,54 @@
</div> </div>
</form> </form>
</body> </div>
{% else %} {% else %}
<h2><font color="red"><p align="center" style="font-family:Verdana">{{error_message}}</p></font></h2> <div id="blocoerro" style="display:block">
</br> <h2><font color="red"><p align="center" style="font-family:Verdana">{{error_message}}</p></font></h2>
</br> </br>
</br> </br>
<center><button type="button" onclick="javascript:window.close()">Sair</button></center> </br>
<center><button type="button" onclick="javascript:window.close()">Sair</button></center>
</div>
{% endif %} {% endif %}
</body>
</html> </html>
<script type="text/javascript"> <script type="text/javascript">
var d = new Date();
var n = d.toLocaleDateString();
document.getElementById("date").innerHTML = n;
$(window).on('beforeunload', function () {
$("input[type=submit], input[type=button]").prop("disabled", "disabled");
});
$( "#votosim" ).mouseleave(function(){document.location.reload(true);});
$( "#votonao" ).mouseleave(function(){document.location.reload(true);});
$( "#votoabstencao" ).mouseleave(function(){document.location.reload(true);});
$(document).ready( $(document).ready(
function(){ function(){
setTimeout(function() {window.location.reload(true)}, 3000)
function checkTime(i) {
if (i<10) {i = "0" + i}; // add zero in front of numbers < 10
return i;
}
function startTime() {
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
m = checkTime(m);
s = checkTime(s);
$("#relogio").text(h+":"+m+":"+s)
var t = setTimeout(function(){
startTime()
}, 500);
}
startTime();
setTimeout(function() {
document.location.reload(true);
}, 30000)
}); });
</script> </script>
Loading…
Cancel
Save