Browse Source

Add detail sections to comissoes

pull/6/head
Marcio Mazza 10 years ago
parent
commit
74dae5b8cd
  1. 14
      comissoes/urls.py
  2. 13
      comissoes/views.py
  3. 5
      sapl/crud.py
  4. 10
      sapl/urls.py
  5. 11
      templates/comissoes/comissao_detail.html
  6. 6
      templates/comissoes/composicao.html
  7. 6
      templates/comissoes/materias.html
  8. 6
      templates/comissoes/reunioes.html
  9. 53
      templates/crud/detail.html

14
comissoes/urls.py

@ -0,0 +1,14 @@
from django.conf.urls import url
from comissoes.views import (
comissao_crud, ComposicaoListView, MateriasListView, ReunioesListView)
urlpatterns = comissao_crud.urlpatterns + [
url(r'^(?P<pk>\d+)/composicao$', ComposicaoListView.as_view(), name='composicao'),
url(r'^(?P<pk>\d+)/materias$', MateriasListView.as_view(), name='materias'),
url(r'^(?P<pk>\d+)/reunioes$', ReunioesListView.as_view(), name='reunioes'),
# url(r'^materias$', MateriasListView.as_view(), name='materias'),
# url(r'^reunioes$', ReunioesListView.as_view(), name='reunioes'),
]
comissoes_urls = urlpatterns, comissao_crud.namespace, comissao_crud.namespace

13
comissoes/views.py

@ -3,6 +3,7 @@ from django.utils.translation import ugettext_lazy as _
from .models import (TipoComissao, Comissao, Periodo, CargoComissao)
from sapl.crud import build_crud
cargo_crud = build_crud(
CargoComissao,
@ -52,3 +53,15 @@ comissao_crud = build_crud(
('data_prorrogada_temp', 4),
('data_fim_comissao', 4)]],
)
class ComposicaoListView(comissao_crud.CrudDetailView):
template_name = 'comissoes/composicao.html'
class MateriasListView(comissao_crud.CrudDetailView):
template_name = 'comissoes/materias.html'
class ReunioesListView(comissao_crud.CrudDetailView):
template_name = 'comissoes/reunioes.html'

5
sapl/crud.py

@ -217,7 +217,7 @@ def build_crud(model, *layout):
crud.CrudDeleteView = CrudDeleteView
# XXX transform into a property of Crud to enable override
crud.urls = [
crud.urlpatterns = [
url(r'^$', CrudListView.as_view(), name='list'),
url(r'^create$', CrudCreateView.as_view(), name='create'),
url(r'^(?P<pk>\d+)$', CrudDetailView.as_view(), name='detail'),
@ -225,6 +225,7 @@ def build_crud(model, *layout):
CrudUpdateView.as_view(), name='update'),
url(r'^(?P<pk>\d+)/delete$',
CrudDeleteView.as_view(), name='delete'),
], crud.namespace, crud.namespace
]
crud.urls = crud.urlpatterns, crud.namespace, crud.namespace
return crud

10
sapl/urls.py

@ -17,8 +17,8 @@ from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic.base import TemplateView
from comissoes.views import (tipo_comissao_crud, comissao_crud,
periodo_composicao_crud, cargo_crud)
from comissoes.views import (
tipo_comissao_crud, periodo_composicao_crud, cargo_crud)
from parlamentares.views import (legislatura_crud, coligacao_crud,
partido_crud, tipo_dependente_crud,
nivel_instrucao_crud, tipo_afastamento_crud,
@ -33,16 +33,18 @@ from lexml.views import (lexml_provedor_crud, lexml_publicador_crud)
from norma.views import (tipo_norma_crud, assunto_norma_crud)
from sessao.views import (tipo_sessao_crud, tipo_resultado_votacao_crud,
tipo_expediente_crud)
from comissoes.urls import comissoes_urls
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='index.html')),
url(r'^admin/', include(admin.site.urls)),
# main apps
url(r'^comissoes/', include(comissao_crud.urls)),
url(r'^comissoes/', include(comissoes_urls)),
url(r'^sessao/', include('sessao.urls')),
# system data
# SYSTEM DATA
# parlamentares
url(r'^sistema/parlamentares/legislatura/',
include(legislatura_crud.urls)),

11
templates/comissoes/comissao_detail.html

@ -0,0 +1,11 @@
{% extends "crud/detail.html" %}
{% load i18n %}
{% block sections_nav %}
<dl class="sub-nav left">
<dd><a href="{% url 'comissao:detail' object.pk %}" class="button secondary">{% trans 'Início' %}</a></dd>
<dd><a href="{% url 'comissao:composicao' object.pk %}" class="button secondary">{% trans 'Composição' %}</a></dd>
<dd><a href="{% url 'comissao:materias' object.pk %}" class="button secondary">{% trans 'Matérias em tramitação' %}</a></dd>
<dd><a href="{% url 'comissao:reunioes' object.pk %}" class="button secondary">{% trans 'Reuniões' %}</a></dd>
</dl>
{% endblock sections_nav %}

6
templates/comissoes/composicao.html

@ -0,0 +1,6 @@
{% extends "comissoes/comissao_detail.html" %}
{% load i18n %}
{% block detail_content %}
TODO ... Composição
{% endblock detail_content %}

6
templates/comissoes/materias.html

@ -0,0 +1,6 @@
{% extends "comissoes/comissao_detail.html" %}
{% load i18n %}
{% block detail_content %}
TODO ... Matérias
{% endblock detail_content %}

6
templates/comissoes/reunioes.html

@ -0,0 +1,6 @@
{% extends "comissoes/comissao_detail.html" %}
{% load i18n %}
{% block detail_content %}
TODO ... Reuniões
{% endblock detail_content %}

53
templates/crud/detail.html

@ -1,36 +1,37 @@
{% extends "base.html" %}
{% load i18n crispy_forms_tags %}
{% load i18n %}
{% block base_content %}
{# FIXME is this the best markup to use? #}
<dl class="sub-nav">
<dd><a href="{{ view.update_url }}">
{% blocktrans with verbose_name=view.verbose_name %} Editar {{ verbose_name }} {% endblocktrans %}
</a></dd>
<dd><a href="{{ view.delete_url }}">
{% blocktrans with verbose_name=view.verbose_name %} Excluir {{ verbose_name }} {% endblocktrans %}
</a></dd>
</dl>
<div class="clearfix">
<dl class="sub-nav right">
<dd><a href="{{ view.update_url }}" class="button">{% trans 'Editar' %}</a></dd>
<dd><a href="{{ view.delete_url }}" class="button alert">{% trans 'Excluir' %}</a></dd>
</dl>
{% block sections_nav %}{% endblock %}
</div>
{# TODO replace fieldset for something semantically correct, but with similar visual grouping style #}
{% for fieldset in view.fieldsets %}
<fieldset>
<legend>{{ fieldset.legend }}</legend>
{% for row in fieldset.rows %}
<div class="row">
{% for column in row %}
<div class="columns large-{{ column.span }}">
<div id="div_id_{{ column.id }}" class="holder">
<label>{{ column.verbose_name }}</label> {# TODO replace labels, probably (are they correct here?) #}
<p>{{ column.text }}</p>
</div>
</div>
{% endfor %}
</div>
{% block detail_content %}
{# TODO replace fieldset for something semantically correct, but with similar visual grouping style #}
{% for fieldset in view.fieldsets %}
<fieldset>
<legend>{{ fieldset.legend }}</legend>
{% for row in fieldset.rows %}
<div class="row">
{% for column in row %}
<div class="columns large-{{ column.span }}">
<div id="div_id_{{ column.id }}" class="holder">
<label>{{ column.verbose_name }}</label> {# TODO replace labels, probably (are they correct here?) #}
<p>{{ column.text }}</p>
</div>
</div>
{% endfor %}
</div>
{% endfor %}
</fieldset>
{% endfor %}
</fieldset>
{% endfor %}
{% endblock detail_content %}
{% endblock %}

Loading…
Cancel
Save