Browse Source

Change painel URL and style buttons of controller

pull/7/head
Edward Ribeiro 9 years ago
parent
commit
0522d85cf5
  1. 17
      painel/urls.py
  2. 20
      painel/views.py
  3. 6
      templates/painel/controller.html
  4. 3
      templates/painel/index.html
  5. 12
      templates/sessao/painel.html

17
painel/urls.py

@ -1,19 +1,18 @@
from django.conf.urls import include, url
from .views import (controlador_painel, cronometro_painel_crud, json_presenca,
from .views import (controlador_painel, cronometro_painel_crud,
json_votacao, painel_mensagem_view,
painel_parlamentares_view, painel_view,
painel_votacao_view)
urlpatterns = [
url(r'^sistema/painel$', painel_view),
url(r'^sistema/painel/controlador',
url(r'^painel$', painel_view, name="painel"),
url(r'^painel/controlador',
controlador_painel, name='controlador_painel'),
url(r'^sistema/painel/mensagem', painel_mensagem_view),
url(r'^sistema/painel/parlamentares', painel_parlamentares_view),
url(r'^sistema/painel/votacao', painel_votacao_view),
url(r'^sistema/painel/json_presenca', json_presenca, name='json_presenca'),
url(r'^sistema/painel/json_votacao', json_votacao, name='json_votacao'),
url(r'^sistema/painel/cronometro',
url(r'^painel/mensagem', painel_mensagem_view),
url(r'^painel/parlamentares', painel_parlamentares_view),
url(r'^painel/votacao', painel_votacao_view),
url(r'^painel/(?P<pk>\d+)/json_votacao$', json_votacao, name='json_votacao'),
url(r'^painel/cronometro',
include(cronometro_painel_crud.urls)),
]

20
painel/views.py

@ -51,7 +51,7 @@ def cronometro_painel(request):
return HttpResponse({})
def painel_view(request):
def painel_view(request, pk):
context = {'head_title': 'Painel Plenário',
'title': '3a. Sessao Ordinária do Município XYZ'}
return render(request, 'painel/index.html', {'context': context})
@ -70,23 +70,15 @@ def painel_votacao_view(request):
# REST web services
def json_presenca(request):
presencas = PresencaOrdemDia.objects.filter(sessao_plenaria_id=6)
parlamentares = []
for p in presencas:
parlamentares.append(p.parlamentar)
# parlamentares = serializers.serialize('json', Parlamentar.objects.all())
parlamentares = serializers.serialize('json', parlamentares)
return HttpResponse(parlamentares, content_type='application/json')
# return JsonResponse(data) # work with python dict
# TODO: make this response non cacheable,
# probably on jQuery site, but check Django too
# TODO: reduce number of database query hits by means
# of QuerySet wizardry.
def json_votacao(request):
def json_votacao(request, pk):
# TODO: se tentar usar objects.get(ordem_id = 104
# ocorre a msg: 'RegistroVotacao' object does not support indexing
# TODO; tratar o caso de vir vazio

6
templates/painel/controller.html

@ -17,8 +17,8 @@ FECHADO
<label for="tipo_painel{{ forloop.counter }}">{{ value }}</label><br />
{% endfor %}
</br>
<input type="submit" name="start-painel" value="Abrir Painel">
<input type="submit" name="stop-painel" value="Fechar Painel">
<input type="submit" name="save-painel" value="Salvar">
<input type="submit" name="start-painel" value="Abrir Painel" class="button primary">
<input type="submit" name="stop-painel" value="Fechar Painel" class="button primary">
<input type="submit" name="save-painel" value="Salvar" class="button primary">
</form>
{% endblock %}

3
templates/painel/index.html

@ -96,8 +96,7 @@
</head>
<body>
<h1>{{ context.title }}</h1>
<input id="json_url" type="hidden" value="{% url 'json_votacao' %}">
<input id="json_url" type="hidden" value="{% url 'json_presenca' %}">
<input id="json_url" type="hidden" value="{% url 'json_votacao' 96 %}">
<h2>Ajax refresh counter: <span id="counter"></span></h2>
<h3>
<span id="sessao_plenaria"></span><br/><br/>

12
templates/sessao/painel.html

@ -6,12 +6,12 @@
<audio type="hidden" id="audio" src="{% static 'audio/ring.mp3' %}"> </audio>
<ul class="small-block-grid-1 medium-block-grid-2 large-block-grid-2">
<li><a href="/sistema/painel">Iniciar painel presidente</a></li>
<li><a href="/sistema/painel">Iniciar painel completo</a></li>
<li><a href="/sistema/painel/mensagem">Iniciar painel mensagem</a></li>
<li><a href="/sistema/painel/parlamentares">Iniciar painel parlamentares</a></li>
<li><a href="/sistema/painel/votacao">Iniciar painel votação</a></li>
<li><a href="/sistema/painel/controlador">Controlador Painel</a></li>
<li><a href="painel">Iniciar painel presidente</a></li>
<li><a href="painel">Iniciar painel completo</a></li>
<li><a href="painel/mensagem">Iniciar painel mensagem</a></li>
<li><a href="painel/parlamentares">Iniciar painel parlamentares</a></li>
<li><a href="painel/votacao">Iniciar painel votação</a></li>
<li><a href="painel/controlador">Controlador Painel</a></li>
</ul>
<br />
<h5>Operação do Painel Eletrônico</h5>

Loading…
Cancel
Save