Browse Source

close #70

pull/98/head
LeandroRoberto 9 years ago
parent
commit
aa7912086a
  1. 43
      compilacao/forms.py
  2. 24
      compilacao/migrations/0040_auto_20160106_1956.py
  3. 10
      compilacao/models.py
  4. 9
      compilacao/templatetags/compilacao_filters.py
  5. 9
      compilacao/urls.py
  6. 7
      compilacao/utils.py
  7. 133
      compilacao/views.py
  8. 5
      compilacao/views2.py
  9. 17
      materia/urls.py
  10. 21
      materia/views.py
  11. 19
      norma/migrations/0009_auto_20160106_1511.py
  12. 3
      norma/models.py
  13. 3
      norma/views.py
  14. 24
      static/js/compilacao_view.js
  15. 0
      templates/compilacao/confirm_delete.html
  16. 8
      templates/compilacao/text_edit.html
  17. 2
      templates/compilacao/text_edit_bloco.html
  18. 6
      templates/compilacao/text_list.html
  19. 11
      templates/compilacao/textoarticulado_detail.html
  20. 9
      templates/compilacao/textoarticulado_list.html
  21. 53
      templates/compilacao/tipotextoarticulado_detail.html
  22. 74
      templates/compilacao/tipotextoarticulado_list.html

43
compilacao/forms.py

@ -1,5 +1,3 @@
import sys
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms_foundation.layout import (HTML, Column, Div, Fieldset, from crispy_forms_foundation.layout import (HTML, Column, Div, Fieldset,
Layout, Row) Layout, Row)
@ -10,10 +8,10 @@ from django.core.exceptions import NON_FIELD_ERRORS
from django.forms.models import ModelForm from django.forms.models import ModelForm
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from compilacao.models import (Dispositivo, Nota, TextoArticulado, TipoNota, from compilacao.models import (PARTICIPACAO_SOCIAL_CHOICES, Dispositivo, Nota,
TipoTextoArticulado, TipoVide, Vide, TextoArticulado, TipoNota, TipoTextoArticulado,
PARTICIPACAO_SOCIAL_CHOICES) TipoVide, Vide)
from compilacao.utils import to_column, to_row, FormLayout from compilacao.utils import YES_NO_CHOICES, FormLayout, to_column, to_row
class UpLoadImportFileForm(forms.Form): class UpLoadImportFileForm(forms.Form):
@ -31,6 +29,39 @@ ta_error_messages = {
} }
class TipoTaForm(ModelForm):
sigla = forms.CharField(label='Sigla')
descricao = forms.CharField(label='Descrição')
participacao_social = forms.NullBooleanField(
label=_('Participação Social'),
widget=forms.Select(choices=YES_NO_CHOICES),
required=True)
class Meta:
model = TipoTextoArticulado
fields = ['sigla',
'descricao',
'content_type',
'participacao_social',
]
def __init__(self, *args, **kwargs):
row1 = to_row([
('sigla', 2),
('descricao', 4),
('content_type', 3),
('participacao_social', 3),
])
self.helper = FormHelper()
self.helper.layout = FormLayout(
Fieldset(_('Identificação Básica'),
row1, css_class="large-12"))
super(TipoTaForm, self).__init__(*args, **kwargs)
class TaForm(ModelForm): class TaForm(ModelForm):
tipo_ta = forms.ModelChoiceField( tipo_ta = forms.ModelChoiceField(
label=_('Tipo do Texto Articulado'), label=_('Tipo do Texto Articulado'),

24
compilacao/migrations/0040_auto_20160106_1956.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
('compilacao', '0039_auto_20151226_1433'),
]
operations = [
migrations.RemoveField(
model_name='tipotextoarticulado',
name='model',
),
migrations.AddField(
model_name='tipotextoarticulado',
name='content_type',
field=models.ForeignKey(verbose_name='Modelo Integrado', blank=True, default=None, null=True, to='contenttypes.ContentType'),
),
]

10
compilacao/models.py

@ -63,12 +63,10 @@ class BaseModel(models.Model):
class TipoTextoArticulado(models.Model): class TipoTextoArticulado(models.Model):
sigla = models.CharField(max_length=3, verbose_name=_('Sigla')) sigla = models.CharField(max_length=3, verbose_name=_('Sigla'))
descricao = models.CharField(max_length=50, verbose_name=_('Descrição')) descricao = models.CharField(max_length=50, verbose_name=_('Descrição'))
model = models.CharField( content_type = models.ForeignKey(
default='', ContentType,
blank=True, null=True, blank=True, null=True, default=None,
max_length=50, verbose_name=_('Modelo Integrado'))
unique=True,
verbose_name=_('Modelagem Django'))
participacao_social = models.NullBooleanField( participacao_social = models.NullBooleanField(
default=False, default=False,
blank=True, null=True, blank=True, null=True,

9
compilacao/templatetags/compilacao_filters.py

@ -5,7 +5,6 @@ from django.db.models import Q
from compilacao.models import Dispositivo, TipoDispositivo from compilacao.models import Dispositivo, TipoDispositivo
register = template.Library() register = template.Library()
@ -161,6 +160,14 @@ def field_verbose_name(instance, field_name):
return instance._meta.get_field(field_name).verbose_name return instance._meta.get_field(field_name).verbose_name
@register.simple_tag
def fieldclass_verbose_name(class_name, field_name):
cls = get_class(
'compilacao.models.' + class_name)
return cls._meta.get_field(
field_name).verbose_name
@register.simple_tag @register.simple_tag
def model_verbose_name(class_name): def model_verbose_name(class_name):
model = get_class('compilacao.models.' + class_name) model = get_class('compilacao.models.' + class_name)

9
compilacao/urls.py

@ -1,8 +1,8 @@
from django.conf.urls import include, url from django.conf.urls import include, url
from compilacao import views from compilacao import views
from compilacao.views import tipo_nota_crud, tipo_vide_crud,\ from compilacao.views import (tipo_nota_crud, tipo_publicacao_crud,
tipo_publicacao_crud, veiculo_publicacao_crud tipo_vide_crud, veiculo_publicacao_crud)
urlpatterns_compilacao = [ urlpatterns_compilacao = [
url(r'^$', views.TaListView.as_view(), name='ta_list'), url(r'^$', views.TaListView.as_view(), name='ta_list'),
@ -61,13 +61,16 @@ urlpatterns_compilacao = [
views.DispositivoSearchFragmentFormView.as_view(), views.DispositivoSearchFragmentFormView.as_view(),
name='search_dispositivo'), name='search_dispositivo'),
url(r'^config/tipo-textoarticulado$', url(r'^config/tipo-textoarticulado$',
views.TipoTaListView.as_view(), name='tipo_ta_list'), views.TipoTaListView.as_view(), name='tipo_ta_list'),
url(r'^config/tipo-textoarticulado/create$', url(r'^config/tipo-textoarticulado/create$',
views.TipoTaCreateView.as_view(), name='tipo_ta_create'), views.TipoTaCreateView.as_view(), name='tipo_ta_create'),
url(r'^config/tipo-textoarticulado/(?P<pk>[0-9]+)$', url(r'^config/tipo-textoarticulado/(?P<pk>[0-9]+)$',
views.TipoTaDetailView.as_view(), name='tipo_ta_detail'), views.TipoTaDetailView.as_view(), name='tipo_ta_detail'),
url(r'^config/tipo-textoarticulado/(?P<pk>[0-9]+)/edit$',
views.TipoTaUpdateView.as_view(), name='tipo_ta_edit'),
url(r'^config/tipo-textoarticulado/(?P<pk>[0-9]+)/delete$',
views.TipoTaDeleteView.as_view(), name='tipo_ta_delete'),
url(r'^config/tipo-nota/', url(r'^config/tipo-nota/',
include(tipo_nota_crud.urls)), include(tipo_nota_crud.urls)),

7
compilacao/utils.py

@ -1,18 +1,17 @@
from braces.views import FormMessagesMixin from braces.views import FormMessagesMixin
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms_foundation.layout import Column, Fieldset, Row from crispy_forms_foundation.layout import Column, Fieldset, Row
from crispy_forms_foundation.layout.base import Layout, Div, HTML from crispy_forms_foundation.layout.base import HTML, Div, Layout
from crispy_forms_foundation.layout.buttons import Submit from crispy_forms_foundation.layout.buttons import Submit
from django import forms from django import forms
from django.conf.urls import url from django.conf.urls import url
from django.core.urlresolvers import reverse_lazy, reverse from django.core.urlresolvers import reverse, reverse_lazy
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views.generic.detail import DetailView from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView from django.views.generic.edit import CreateView, DeleteView, UpdateView
from django.views.generic.list import ListView from django.views.generic.list import ListView
NO_ENTRIES_MSG = _('Não existem registros') NO_ENTRIES_MSG = _('Não existem registros')

133
compilacao/views.py

@ -1,17 +1,14 @@
import sys
from collections import OrderedDict from collections import OrderedDict
from datetime import datetime, timedelta from datetime import datetime, timedelta
import sys
from braces.views import FormMessagesMixin from braces.views import FormMessagesMixin
from crispy_forms.helper import FormHelper
from crispy_forms_foundation.layout.containers import Fieldset
from django import forms from django import forms
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.signing import Signer from django.core.signing import Signer
from django.core.urlresolvers import reverse, reverse_lazy from django.core.urlresolvers import reverse, reverse_lazy
from django.db.models import Q from django.db.models import Q
from django.forms.models import ModelForm
from django.http.response import (HttpResponse, HttpResponseRedirect, from django.http.response import (HttpResponse, HttpResponseRedirect,
JsonResponse) JsonResponse)
from django.shortcuts import get_object_or_404, redirect from django.shortcuts import get_object_or_404, redirect
@ -24,15 +21,13 @@ from django.views.generic.edit import CreateView, DeleteView, UpdateView
from django.views.generic.list import ListView from django.views.generic.list import ListView
from compilacao import utils from compilacao import utils
from compilacao.forms import TaForm, NotaForm, VideForm from compilacao.forms import NotaForm, TaForm, TipoTaForm, VideForm
from compilacao.models import (Dispositivo, Nota, from compilacao.models import (Dispositivo, Nota,
PerfilEstruturalTextoArticulado, PerfilEstruturalTextoArticulado,
TextoArticulado, TipoDispositivo, TipoNota, TextoArticulado, TipoDispositivo, TipoNota,
TipoTextoArticulado, Vide, TipoVide, TipoPublicacao, TipoTextoArticulado, TipoVide,
TipoPublicacao, VeiculoPublicacao, VeiculoPublicacao, Vide)
PARTICIPACAO_SOCIAL_CHOICES) from compilacao.utils import build_crud
from compilacao.utils import build_crud, to_row, FormLayout
DISPOSITIVO_SELECT_RELATED = ( DISPOSITIVO_SELECT_RELATED = (
'tipo_dispositivo', 'tipo_dispositivo',
@ -89,7 +84,7 @@ class IntegracaoTaView(TemplateView):
if not ta.exists(): if not ta.exists():
ta = TextoArticulado() ta = TextoArticulado()
tipo_ta = TipoTextoArticulado.objects.filter( tipo_ta = TipoTextoArticulado.objects.filter(
model=item.__class__.__name__.lower())[:1] content_type=related_object_type)[:1]
if tipo_ta.exists(): if tipo_ta.exists():
ta.tipo_ta = tipo_ta[0] ta.tipo_ta = tipo_ta[0]
ta.content_object = item ta.content_object = item
@ -149,7 +144,7 @@ def get_integrations_view_names():
def choice_extenal_views(): def choice_extenal_views():
integrations_view_names = get_integrations_view_names() integrations_view_names = get_integrations_view_names()
result = [] result = [(None, '-------------'), ]
for item in integrations_view_names: for item in integrations_view_names:
ct = ContentType.objects.filter( ct = ContentType.objects.filter(
model=item.model.__name__.lower(), model=item.model.__name__.lower(),
@ -161,46 +156,23 @@ def choice_extenal_views():
return result return result
class TipoTaForm(ModelForm): class CompMixin(object):
sigla = forms.CharField(label='Sigla')
descricao = forms.CharField(label='Descrição')
participacao_social = forms.NullBooleanField(
label=_('Participação Social'),
widget=forms.Select(choices=PARTICIPACAO_SOCIAL_CHOICES),
required=False)
class Meta:
model = TipoTextoArticulado
fields = ['sigla',
'descricao',
'model',
'participacao_social',
]
def __init__(self, *args, **kwargs):
row1 = to_row([ @property
('sigla', 2), def title(self):
('descricao', 4), return self.get_object()
('model', 3),
('participacao_social', 3),
])
self.helper = FormHelper()
self.helper.layout = FormLayout(
Fieldset(_('Identificação Básica'),
row1, css_class="large-12"))
super(TipoTaForm, self).__init__(*args, **kwargs)
class TipoTaListView(ListView): class TipoTaListView(ListView):
model = TipoTextoArticulado model = TipoTextoArticulado
paginate_by = 10 paginate_by = 10
verbose_name = model._meta.verbose_name verbose_name = model._meta.verbose_name
title = model._meta.verbose_name_plural
create_url = reverse_lazy('tipo_ta_create') create_url = reverse_lazy('tipo_ta_create')
@property
def title(self):
return self.model._meta.verbose_name_plural
class TipoTaCreateView(FormMessagesMixin, CreateView): class TipoTaCreateView(FormMessagesMixin, CreateView):
model = TipoTextoArticulado model = TipoTextoArticulado
@ -212,31 +184,67 @@ class TipoTaCreateView(FormMessagesMixin, CreateView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
self.object = None self.object = None
form = self.get_form() form = self.get_form()
form.fields['model'] = forms.ChoiceField( form.fields['content_type'] = forms.ChoiceField(
choices=choice_extenal_views(), choices=choice_extenal_views(),
label='Associação', required=False) label=_('Modelo Integrado'), required=False)
return self.render_to_response(self.get_context_data(form=form)) return self.render_to_response(self.get_context_data(form=form))
def get_success_url(self): def get_success_url(self):
return reverse_lazy('tipo_ta_detail', kwargs={'pk': self.object.id}) return reverse_lazy('tipo_ta_detail', kwargs={'pk': self.object.id})
@property
def cancel_url(self):
return reverse_lazy('tipo_ta_list')
class TipoTaDetailView(CompMixin, DetailView):
model = TipoTextoArticulado
class TipoTaUpdateView(CompMixin, UpdateView):
model = TipoTextoArticulado
form_class = TipoTaForm
template_name = "compilacao/form.html"
def get(self, request, *args, **kwargs):
self.object = self.get_object()
form = self.get_form()
form.fields['content_type'] = forms.ChoiceField(
choices=choice_extenal_views(),
label=_('Modelo Integrado'), required=False)
return self.render_to_response(self.get_context_data(form=form))
def get_success_url(self):
return reverse_lazy('tipo_ta_detail', kwargs={'pk': self.kwargs['pk']})
@property
def cancel_url(self):
return reverse_lazy('tipo_ta_detail', kwargs={'pk': self.kwargs['pk']})
class TipoTaDetailView(DetailView):
class TipoTaDeleteView(CompMixin, DeleteView):
model = TipoTextoArticulado model = TipoTextoArticulado
template_name = "compilacao/confirm_delete.html"
@property @property
def title(self): def detail_url(self):
return self.get_object() return reverse_lazy('tipo_ta_detail', kwargs={'pk': self.kwargs['pk']})
def get_success_url(self):
return reverse_lazy('tipo_ta_list')
class TaListView(ListView): class TaListView(ListView):
model = TextoArticulado model = TextoArticulado
paginate_by = 10 paginate_by = 10
verbose_name = model._meta.verbose_name verbose_name = model._meta.verbose_name
title = model._meta.verbose_name_plural
create_url = reverse_lazy('ta_create') create_url = reverse_lazy('ta_create')
@property
def title(self):
return self.model._meta.verbose_name_plural
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(TaListView, self).get_context_data(**kwargs) context = super(TaListView, self).get_context_data(**kwargs)
paginator = context['paginator'] paginator = context['paginator']
@ -270,15 +278,23 @@ class TaCreateView(FormMessagesMixin, CreateView):
def get_success_url(self): def get_success_url(self):
return reverse_lazy('ta_detail', kwargs={'pk': self.object.id}) return reverse_lazy('ta_detail', kwargs={'pk': self.object.id})
@property
def cancel_url(self):
return reverse_lazy('ta_list')
class TaUpdateView(UpdateView): class TaUpdateView(CompMixin, UpdateView):
model = TextoArticulado model = TextoArticulado
form_class = TaForm form_class = TaForm
template_name = "compilacao/form.html" template_name = "compilacao/form.html"
@property def get(self, request, *args, **kwargs):
def title(self): self.object = self.get_object()
return self.get_object() form = self.get_form()
# if self.object and self.object.content_object:
# form.fields['tipo_ta'].required = False
# form.fields['tipo_ta'].widget.attrs['disabled'] = 'disabled'
return self.render_to_response(self.get_context_data(form=form))
def get_success_url(self): def get_success_url(self):
return reverse_lazy('ta_detail', kwargs={'pk': self.kwargs['pk']}) return reverse_lazy('ta_detail', kwargs={'pk': self.kwargs['pk']})
@ -288,12 +304,9 @@ class TaUpdateView(UpdateView):
return reverse_lazy('ta_detail', kwargs={'pk': self.kwargs['pk']}) return reverse_lazy('ta_detail', kwargs={'pk': self.kwargs['pk']})
class TaDeleteView(DeleteView): class TaDeleteView(CompMixin, DeleteView):
model = TextoArticulado model = TextoArticulado
template_name = "compilacao/confirm_delete.html"
@property
def title(self):
return self.get_object()
@property @property
def detail_url(self): def detail_url(self):
@ -318,10 +331,10 @@ class TextView(ListView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
ta = TextoArticulado.objects.get(pk=self.kwargs['ta_id']) ta = TextoArticulado.objects.get(pk=self.kwargs['ta_id'])
self.title = ta self.object = ta
if ta.content_object: if ta.content_object:
item = ta.content_object item = ta.content_object
self.title = item self.object = item
if hasattr(item, 'ementa') and item.ementa: if hasattr(item, 'ementa') and item.ementa:
ta.ementa = item.ementa ta.ementa = item.ementa
else: else:

5
compilacao/views2.py

@ -1,11 +1,8 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from compilacao.models import (PerfilEstruturalTextoArticulado, from compilacao.models import PerfilEstruturalTextoArticulado, TipoDispositivo
TipoDispositivo, TipoNota, TipoPublicacao,
TipoVide, VeiculoPublicacao)
from sapl.crud import build_crud from sapl.crud import build_crud
perfil_estr_txt_norm = build_crud( perfil_estr_txt_norm = build_crud(
PerfilEstruturalTextoArticulado, 'perfil_estrutural', [ PerfilEstruturalTextoArticulado, 'perfil_estrutural', [

17
materia/urls.py

@ -9,13 +9,14 @@ from materia.views import (AutoriaEditView, AutoriaView,
MateriaLegislativaPesquisaView, MateriaTaView, MateriaLegislativaPesquisaView, MateriaTaView,
NumeracaoEditView, NumeracaoView, NumeracaoEditView, NumeracaoView,
PesquisaMateriaListView, ProposicaoListView, PesquisaMateriaListView, ProposicaoListView,
ProposicaoView, RelatoriaEditView, RelatoriaView, ProposicaoTaView, ProposicaoView, RelatoriaEditView,
TramitacaoEditView, TramitacaoView, autor_crud, RelatoriaView, TramitacaoEditView, TramitacaoView,
materia_legislativa_crud, orgao_crud, origem_crud, autor_crud, materia_legislativa_crud, orgao_crud,
regime_tramitacao_crud, status_tramitacao_crud, origem_crud, regime_tramitacao_crud,
tipo_autor_crud, tipo_documento_crud, status_tramitacao_crud, tipo_autor_crud,
tipo_fim_relatoria_crud, tipo_materia_crud, tipo_documento_crud, tipo_fim_relatoria_crud,
tipo_proposicao_crud, unidade_tramitacao_crud) tipo_materia_crud, tipo_proposicao_crud,
unidade_tramitacao_crud)
materia_legislativa_patterns = materia_legislativa_crud.urlpatterns materia_legislativa_patterns = materia_legislativa_crud.urlpatterns
@ -28,6 +29,8 @@ urlpatterns = [
url(r'^materia/(?P<pk>[0-9]+)/ta$', url(r'^materia/(?P<pk>[0-9]+)/ta$',
MateriaTaView.as_view(), name='materia_ta'), MateriaTaView.as_view(), name='materia_ta'),
url(r'^materia/proposicao/(?P<pk>[0-9]+)/ta$',
ProposicaoTaView.as_view(), name='proposicao_ta'),
url(r'^sistema/proposicoes/tipo/', include(tipo_proposicao_crud.urls)), url(r'^sistema/proposicoes/tipo/', include(tipo_proposicao_crud.urls)),

21
materia/views.py

@ -15,12 +15,12 @@ from django.views.generic import ListView
from django.views.generic.edit import FormMixin from django.views.generic.edit import FormMixin
from vanilla.views import GenericView from vanilla.views import GenericView
import sapl
from comissoes.models import Comissao, Composicao from comissoes.models import Comissao, Composicao
from compilacao.views import IntegracaoTaView from compilacao.views import IntegracaoTaView
from norma.models import LegislacaoCitada, NormaJuridica, TipoNormaJuridica from norma.models import LegislacaoCitada, NormaJuridica, TipoNormaJuridica
from parlamentares.models import Parlamentar from parlamentares.models import Parlamentar
from sapl.crud import build_crud from sapl.crud import build_crud
import sapl
from .models import (Anexada, Autor, Autoria, DespachoInicial, from .models import (Anexada, Autor, Autoria, DespachoInicial,
DocumentoAcessorio, MateriaLegislativa, Numeracao, Orgao, DocumentoAcessorio, MateriaLegislativa, Numeracao, Orgao,
@ -29,7 +29,6 @@ from .models import (Anexada, Autor, Autoria, DespachoInicial,
TipoFimRelatoria, TipoMateriaLegislativa, TipoProposicao, TipoFimRelatoria, TipoMateriaLegislativa, TipoProposicao,
Tramitacao, UnidadeTramitacao) Tramitacao, UnidadeTramitacao)
origem_crud = build_crud( origem_crud = build_crud(
Origem, 'origem', [ Origem, 'origem', [
@ -952,7 +951,7 @@ class NumeracaoForm(ModelForm):
required=True, required=True,
queryset=TipoMateriaLegislativa.objects.all(), queryset=TipoMateriaLegislativa.objects.all(),
empty_label='Selecione', empty_label='Selecione',
) )
data_materia = forms.DateField(label='Data', data_materia = forms.DateField(label='Data',
required=False, required=False,
@ -1092,7 +1091,7 @@ class DocumentoAcessorioForm(ModelForm):
required=True, required=True,
queryset=TipoDocumento.objects.all(), queryset=TipoDocumento.objects.all(),
empty_label='Selecione', empty_label='Selecione',
) )
data = forms.DateField(label='Data', data = forms.DateField(label='Data',
required=False, required=False,
@ -1854,7 +1853,7 @@ class MateriaLegislativaPesquisaForm(forms.Form):
required=False, required=False,
queryset=Autor.objects.all().order_by('tipo'), queryset=Autor.objects.all().order_by('tipo'),
empty_label='Selecione', empty_label='Selecione',
) )
# relatores são os parlamentares ativos? # relatores são os parlamentares ativos?
relator = forms.ModelChoiceField( relator = forms.ModelChoiceField(
@ -1863,14 +1862,14 @@ class MateriaLegislativaPesquisaForm(forms.Form):
queryset=Parlamentar.objects.filter( queryset=Parlamentar.objects.filter(
ativo=True).order_by('nome_parlamentar'), ativo=True).order_by('nome_parlamentar'),
empty_label='Selecione', empty_label='Selecione',
) )
tipo = forms.ModelChoiceField( tipo = forms.ModelChoiceField(
label='Tipo de Matéria', label='Tipo de Matéria',
required=False, required=False,
queryset=TipoMateriaLegislativa.objects.all(), queryset=TipoMateriaLegislativa.objects.all(),
empty_label='Selecione', empty_label='Selecione',
) )
data_apresentacao = forms.DateField(label=u'Data de Apresentação', data_apresentacao = forms.DateField(label=u'Data de Apresentação',
input_formats=['%d/%m/%Y'], input_formats=['%d/%m/%Y'],
@ -1896,14 +1895,14 @@ class MateriaLegislativaPesquisaForm(forms.Form):
required=False, required=False,
queryset=UnidadeTramitacao.objects.all(), queryset=UnidadeTramitacao.objects.all(),
empty_label='Selecione', empty_label='Selecione',
) )
situacao = forms.ModelChoiceField( situacao = forms.ModelChoiceField(
label='Situação', label='Situação',
required=False, required=False,
queryset=StatusTramitacao.objects.all(), queryset=StatusTramitacao.objects.all(),
empty_label='Selecione', empty_label='Selecione',
) )
tramitacao = forms.ChoiceField(required=False, tramitacao = forms.ChoiceField(required=False,
label='Tramitando', label='Tramitando',
@ -2024,3 +2023,7 @@ class PesquisaMateriaListView(FormMixin, ListView):
class MateriaTaView(IntegracaoTaView): class MateriaTaView(IntegracaoTaView):
model = MateriaLegislativa model = MateriaLegislativa
class ProposicaoTaView(IntegracaoTaView):
model = Proposicao

19
norma/migrations/0009_auto_20160106_1511.py

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('norma', '0008_normajuridica_texto_integral'),
]
operations = [
migrations.AlterField(
model_name='normajuridica',
name='tipo',
field=models.ForeignKey(verbose_name='Tipo da Norma Juridica', to='norma.TipoNormaJuridica'),
),
]

3
norma/models.py

@ -72,7 +72,8 @@ class NormaJuridica(models.Model):
null=True, null=True,
upload_to=texto_upload_path, upload_to=texto_upload_path,
verbose_name=_('Texto Integral')) verbose_name=_('Texto Integral'))
tipo = models.ForeignKey(TipoNormaJuridica, verbose_name=_('Tipo da Norma Juridica')) tipo = models.ForeignKey(
TipoNormaJuridica, verbose_name=_('Tipo da Norma Juridica'))
materia = models.ForeignKey(MateriaLegislativa, blank=True, null=True) materia = models.ForeignKey(MateriaLegislativa, blank=True, null=True)
numero = models.PositiveIntegerField(verbose_name=_('Número')) numero = models.PositiveIntegerField(verbose_name=_('Número'))
ano = models.PositiveSmallIntegerField(verbose_name=_('Ano')) ano = models.PositiveSmallIntegerField(verbose_name=_('Ano'))

3
norma/views.py

@ -12,15 +12,14 @@ from django.utils.translation import ugettext_lazy as _
from django.views.generic.edit import FormMixin from django.views.generic.edit import FormMixin
from vanilla.views import GenericView from vanilla.views import GenericView
import sapl
from compilacao.views import IntegracaoTaView from compilacao.views import IntegracaoTaView
from materia.models import MateriaLegislativa, TipoMateriaLegislativa from materia.models import MateriaLegislativa, TipoMateriaLegislativa
from sapl.crud import build_crud from sapl.crud import build_crud
import sapl
from .models import (AssuntoNorma, LegislacaoCitada, NormaJuridica, from .models import (AssuntoNorma, LegislacaoCitada, NormaJuridica,
TipoNormaJuridica) TipoNormaJuridica)
assunto_norma_crud = build_crud( assunto_norma_crud = build_crud(
AssuntoNorma, 'assunto_norma_juridica', [ AssuntoNorma, 'assunto_norma_juridica', [

24
static/js/compilacao_view.js

@ -5,18 +5,6 @@ $( window ).scroll(function() {
$( "section.vigencias" ).addClass("fixed"); $( "section.vigencias" ).addClass("fixed");
}); });
$(window).load(function() {
setTimeout(function() {
href = location.href.split('#')
if (href.length == 2) {
height = $( "section.vigencias" ).height();
$('html, body').animate({
scrollTop: window.pageYOffset - height - 55
}, 300);
}
}, 100);
});
function isElementInViewport (el) { function isElementInViewport (el) {
@ -142,11 +130,19 @@ function textoVigente(item, link) {
scrollTop: $(elv).parent().offset().top - 60 scrollTop: $(elv).parent().offset().top - 60
}, 0); }, 0);
} }
} }
$(document).ready(function() { $(document).ready(function() {
setTimeout(function() {
var href = location.href.split('#')
if (href.length == 2) {
$('html, body').animate({
scrollTop: $('#dptt' + href[1] ).offset().top - window.innerHeight / 9
}, 0);
}
}, 100);
$("#btn_font_menos").click(function() { $("#btn_font_menos").click(function() {
$(".dpt").css("font-size", "-=1"); $(".dpt").css("font-size", "-=1");
}); });

0
templates/compilacao/textoarticulado_confirm_delete.html → templates/compilacao/confirm_delete.html

8
templates/compilacao/text_edit.html

@ -17,13 +17,7 @@
<h1><b>Edição:</b> {{ view.title }} - <i>{% trans 'Texto Multivigente' %}</i></h1> <h1><b>Edição:</b> {{ view.title }} - <i>{% trans 'Texto Multivigente' %}</i></h1>
{% endblock %} {% endblock %}
{% block sections_nav %}{{block.super}}
{% if not object.content_object%}
<dd><a href="{% url 'ta_text' object.pk %}" class="button secondary">{% trans 'Texto' %}</a></dd>
{%endif %}
{% endblock %}
{% block base_content %}{{block.super}} {% block base_content %}{{block.super}}

2
templates/compilacao/text_edit_bloco.html

@ -35,7 +35,7 @@
</ul> </ul>
<ul class="btns-action actions_left"> <ul class="btns-action actions_left">
<li><a class="btn-left btn-action" pk="{{dpt.pk}}" title="">.</a></li> <li><a href ="{% url 'ta_text' dpt.ta.pk%}#{{dpt.pk}}" class="btn-left btn-action" pk="{{dpt.pk}}" title="{% trans 'Ir para Texto'%}">T</a></li>
</ul> </ul>
<ul class="btns-action actions_bottom"> <ul class="btns-action actions_bottom">
{% for perfil in perfil_estrutural_list%} {% for perfil in perfil_estrutural_list%}

6
templates/compilacao/text_list.html

@ -16,11 +16,7 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block sections_nav %}{{block.super}}
<dd><a href="{% url 'ta_text_edit' object.pk %}" class="button secondary">{% trans 'Edição' %}</a></dd>
{% endblock %}
{% block actions %}{% endblock %}
{% block base_content %}{{block.super}} {% block base_content %}{{block.super}}

11
templates/compilacao/textoarticulado_detail.html

@ -6,15 +6,16 @@
<ul class="button-group right"> <ul class="button-group right">
<li><a href="{% url 'ta_edit' object.pk %}" class="button tiny">{% trans 'Edição dos Metadados do Texto Articulado' %}</a></li> <li><a href="{% url 'ta_edit' object.pk %}" class="button tiny">{% trans 'Edição dos Metadados do Texto Articulado' %}</a></li>
<li><a href="{% url 'ta_delete' object.pk %}" class="button alert tiny">{% trans 'Excluir' %}</a></li> <li><a href="{% url 'ta_delete' object.pk %}" class="button alert tiny">{% trans 'Excluir' %}</a></li>
<li><a href="#" class="button tiny" data-dropdown="drop"><i class="fi-widget"></i></a> <li><a href="#" class="button tiny" data-dropdown="drop"><i class="fi-widget"></i></a>
<ul id="drop" class="tiny f-dropdown" data-dropdown-content> <ul id="drop" class="tiny f-dropdown" data-dropdown-content>
<li><a href="{% url 'tipo_ta_list' %}">{%model_verbose_name_plural 'TipoTextoArticulado'%}</a></li> <li><a href="{% url 'tipo_ta_list' %}">{%model_verbose_name_plural 'TipoTextoArticulado'%}</a></li>
<li><a href="{% url 'tipopublicacao:list' %}">{%model_verbose_name_plural 'TipoPublicacao'%}</a></li> <li><a href="{% url 'tipopublicacao:list' %}">{%model_verbose_name_plural 'TipoPublicacao'%}</a></li>
<li><a href="{% url 'veiculopublicacao:list' %}">{%model_verbose_name_plural 'VeiculoPublicacao'%}</a></li> <li><a href="{% url 'veiculopublicacao:list' %}">{%model_verbose_name_plural 'VeiculoPublicacao'%}</a></li>
<li><a href="{% url 'tiponota:list' %}">{%model_verbose_name_plural 'TipoNota'%}</a></li> <li><a href="{% url 'tiponota:list' %}">{%model_verbose_name_plural 'TipoNota'%}</a></li>
<li><a href="{% url 'tipovide:list' %}">{%model_verbose_name_plural 'TipoVide'%}</a></li> <li><a href="{% url 'tipovide:list' %}">{%model_verbose_name_plural 'TipoVide'%}</a></li>
<li><a href="#">Tipo de Dispositivo</a></li> <li><a href="#">TODO: Tipo de Dispositivo</a></li>
<li><a href="#">Perfil Estrutural de Textos Articulados</a></li> <li><a href="#">TODO: Perfil Estrutural de Textos Articulados</a></li>
</ul></li> </ul></li>
</ul> </ul>
{% endblock actions %} {% endblock actions %}
@ -26,8 +27,10 @@
<dd><a href="{% url 'ta_detail' object.pk %}" class="button secondary">{% trans 'Início' %}</a></dd> <dd><a href="{% url 'ta_detail' object.pk %}" class="button secondary">{% trans 'Início' %}</a></dd>
{%endif%} {%endif%}
<dd><a href="#" class="button secondary">{% model_verbose_name_plural 'Publicacao' %}</a></dd> <dd><a href="#" class="button secondary">{% model_verbose_name_plural 'Publicacao' %}</a></dd>
<dd><a href="{% url 'ta_text' object.pk %}" class="button secondary">{% trans 'Texto' %}</a></dd> <dd><a href="{% url 'ta_text' object.pk %}" class="button secondary">{% trans 'Texto' %}</a></dd>
{% endblock %} <dd><a href="{% url 'ta_text_edit' object.pk %}" class="button secondary">{% trans 'Edição do Texto' %}</a></dd>
{% endblock %}
</dl> </dl>
</div> </div>

9
templates/compilacao/textoarticulado_list.html

@ -9,21 +9,22 @@
<a href="#" class="button tiny right" data-dropdown="dropconfig"><i class="fi-widget"></i></a> <a href="#" class="button tiny right" data-dropdown="dropconfig"><i class="fi-widget"></i></a>
<ul id="dropconfig" class="tiny f-dropdown" data-dropdown-content> <ul id="dropconfig" class="tiny f-dropdown" data-dropdown-content>
<li><a href="{% url 'tipo_ta_list' %}">{%model_verbose_name_plural 'TipoTextoArticulado'%}</a></li>
<li><a href="{% url 'tipopublicacao:list' %}">{%model_verbose_name_plural 'TipoPublicacao'%}</a></li> <li><a href="{% url 'tipopublicacao:list' %}">{%model_verbose_name_plural 'TipoPublicacao'%}</a></li>
<li><a href="{% url 'veiculopublicacao:list' %}">{%model_verbose_name_plural 'VeiculoPublicacao'%}</a></li> <li><a href="{% url 'veiculopublicacao:list' %}">{%model_verbose_name_plural 'VeiculoPublicacao'%}</a></li>
<li><a href="{% url 'tiponota:list' %}">{%model_verbose_name_plural 'TipoNota'%}</a></li> <li><a href="{% url 'tiponota:list' %}">{%model_verbose_name_plural 'TipoNota'%}</a></li>
<li><a href="{% url 'tipovide:list' %}">{%model_verbose_name_plural 'TipoVide'%}</a></li> <li><a href="{% url 'tipovide:list' %}">{%model_verbose_name_plural 'TipoVide'%}</a></li>
<li><a href="#">Tipo de Dispositivo</a></li> <li><a href="#">Tipo de Dispositivo</a></li>
<li><a href="#">Perfil Estrutural de Textos Articulados</a></li> <li><a href="#">Perfil Estrutural de Textos Articulados</a></li>
</ul> </ul>
<dl class="sub-nav"> <dl class="sub-nav">
<dd><a href="{{ view.create_url }}"> <dd><a href="{{ view.create_url }}">
{% blocktrans with verbose_name=view.verbose_name %} Adicionar {{ verbose_name }} {% endblocktrans %} {% blocktrans with verbose_name=view.verbose_name %} Adicionar {{ verbose_name }} {% endblocktrans %}
</a></dd> </a></dd>
{% block more_buttons %} {% block more_buttons %}
{% endblock more_buttons %} {% endblock more_buttons %}

53
templates/compilacao/tipotextoarticulado_detail.html

@ -0,0 +1,53 @@
{% extends "base.html" %} {% load i18n %} {% load compilacao_filters %}
{% block base_content %} {# FIXME is this the best markup to use? #}
<div class="clearfix">
{% block actions %}
<ul class="button-group right">
<li><a href="{% url 'tipo_ta_edit' object.pk %}" class="button tiny">{% trans 'Editar' %}</a></li>
<li><a href="{% url 'tipo_ta_delete' object.pk %}" class="button alert tiny">{% trans 'Excluir' %}</a></li>
</ul>
{% endblock actions %}
<dl class="sub-nav left">
{% block sections_nav %}
{% endblock %}
</dl>
</div>
{% block detail_content %} {# TODO replace fieldset for something semantically correct, but with similar visual grouping style #}
<fieldset>
<legend>{%trans 'Identificação Básica'%}</legend>
<div class="row">
<div class="columns large-2">
<div id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'sigla' %}</label>
<p>{{ object.sigla}}</p>
</div>
</div>
<div class="columns large-4">
<div id="div_id_numero" class="holder">
<label>{% field_verbose_name object 'descricao' %}</label>
<p>{{ object.descricao}}</p>
</div>
</div>
<div class="columns large-3">
<div id="div_id_ano" class="holder">
<label>{% field_verbose_name object 'content_type' %}</label>
<p>{{ object.content_type|default:""}}</p>
</div>
</div>
<div class="columns large-3">
<div id="div_id_ano" class="holder">
<label>{% field_verbose_name object 'participacao_social' %}</label>
<p>{{ object.get_participacao_social_display}}</p>
</div>
</div>
</div>
</fieldset>
{% endblock detail_content %}
{% endblock base_content %}

74
templates/compilacao/tipotextoarticulado_list.html

@ -0,0 +1,74 @@
{% extends "base.html" %}
{% load i18n %}
{% load compilacao_filters %}
{% block base_content %}
<dl class="sub-nav">
<dd><a href="{{ view.create_url }}">
{% trans 'Adicionar'%} {%model_verbose_name 'TipoTextoArticulado'%}
</a></dd>
{% block more_buttons %}
{% endblock more_buttons %}
</dl>
{% if not object_list %}
<p>{{ NO_ENTRIES_MSG }}</p>
{% else %}
<table class="table table-hover" width=100%>
<thead>
<tr>
<th>{% fieldclass_verbose_name 'TipoTextoArticulado' 'sigla' %}</th>
<th>{% fieldclass_verbose_name 'TipoTextoArticulado' 'descricao' %}</th>
<th>{% fieldclass_verbose_name 'TipoTextoArticulado' 'content_type' %}</th>
</tr>
</thead>
<tbody>
{% for tipo_ta in object_list %}
<tr>
<td><a href="{% url 'tipo_ta_detail' tipo_ta.pk %}">{{ tipo_ta.sigla }}</a></td>
<td>{{ tipo_ta.descricao }}</td>
<td>{{ tipo_ta.content_type }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if is_paginated %}
<div class="pagination-centered">
<ul class="pagination" role="menubar" aria-label="Pagination">
{% if page_obj.has_previous %}
<li>
<a href="?page={{ page_obj.previous_page_number }}">
<span class="arrow">&laquo;</span>
</a>
</li>
{% else %}
<li class="arrow unavailable" aria-disabled="true"><a href="">&laquo;</a></li>
{% endif %}
{% for page in page_range %}
{% if page %}
<li {% if page == page_obj.number %}class="current"{% endif %}>
<a href="?page={{ page }}">{{ page }}</a>
</li>
{% else %}
<li class="unavailable" aria-disabled="true"><a href="">&hellip;</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li>
<a href="?page={{ page_obj.next_page_number }}">
<span class="arrow">&raquo;</span>
</a>
</li>
{% else %}
<li class="arrow unavailable" aria-disabled="true"><a href="">&raquo;</a></li>
{% endif %}
</ul>
</div>
{% endif %}
{% endif %}
{% endblock %}
Loading…
Cancel
Save