Browse Source

Organização de código app compilacao

- Organização de Códigos duplicados na app compilação
- Criação da common_tags na app base
pull/153/head
LeandroRoberto 9 years ago
parent
commit
5fd9810e5b
  1. 0
      base/templatetags/__init__.py
  2. 39
      base/templatetags/common_tags.py
  3. 9
      compilacao/forms.py
  4. 30
      compilacao/models.py
  5. 32
      compilacao/templatetags/compilacao_filters.py
  6. 297
      compilacao/utils.py
  7. 58
      compilacao/views.py
  8. 54
      compilacao/views2.py
  9. 38
      templates/compilacao/detail.html
  10. 82
      templates/compilacao/list.html
  11. 1
      templates/compilacao/publicacao_detail.html
  12. 54
      templates/compilacao/publicacao_list.html
  13. 1
      templates/compilacao/text_edit.html
  14. 1
      templates/compilacao/text_edit_bloco.html
  15. 1
      templates/compilacao/text_edit_blocoalteracao.html
  16. 1
      templates/compilacao/text_list.html
  17. 1
      templates/compilacao/text_list_bloco.html
  18. 1
      templates/compilacao/text_list_blocoalteracao.html
  19. 28
      templates/compilacao/textoarticulado_detail.html
  20. 70
      templates/compilacao/textoarticulado_list.html
  21. 1
      templates/compilacao/tipotextoarticulado_detail.html
  22. 46
      templates/compilacao/tipotextoarticulado_list.html
  23. 4
      templates/norma/normajuridica_detail.html

0
base/templatetags/__init__.py

39
base/templatetags/common_tags.py

@ -0,0 +1,39 @@
from compressor.utils import get_class
from django import template
register = template.Library()
@register.simple_tag
def field_verbose_name(instance, field_name):
return instance._meta.get_field(field_name).verbose_name
@register.simple_tag
def fieldclass_verbose_name(class_name, field_name):
cls = get_class(class_name)
return cls._meta.get_field(field_name).verbose_name
@register.simple_tag
def model_verbose_name(class_name):
model = get_class(class_name)
return model._meta.verbose_name
@register.simple_tag
def model_verbose_name_plural(class_name):
model = get_class(class_name)
return model._meta.verbose_name_plural
@register.filter
def lookup(d, key):
skey = str(key)
return d[str(key)] if skey in d else []
@register.filter
def isinst(value, class_str):
classe = value.__class__.__name__
return classe == class_str

9
compilacao/forms.py

@ -12,7 +12,8 @@ from compilacao.models import (PARTICIPACAO_SOCIAL_CHOICES, Dispositivo, Nota,
Publicacao, TextoArticulado, TipoNota,
TipoPublicacao, TipoTextoArticulado, TipoVide,
VeiculoPublicacao, Vide)
from compilacao.utils import YES_NO_CHOICES, FormLayout, to_column, to_row
from sapl.layout import SaplFormLayout, to_column, to_row
from sapl.utils import YES_NO_CHOICES
class UpLoadImportFileForm(forms.Form):
@ -62,7 +63,7 @@ class TipoTaForm(ModelForm):
])
self.helper = FormHelper()
self.helper.layout = FormLayout(
self.helper.layout = SaplFormLayout(
Fieldset(_('Identificação Básica'),
row1, css_class="large-12"))
super(TipoTaForm, self).__init__(*args, **kwargs)
@ -129,7 +130,7 @@ class TaForm(ModelForm):
])
self.helper = FormHelper()
self.helper.layout = FormLayout(
self.helper.layout = SaplFormLayout(
Fieldset(_('Identificação Básica'), row1, css_class="large-12"),
Fieldset(
TextoArticulado._meta.get_field('ementa').verbose_name,
@ -428,7 +429,7 @@ class PublicacaoForm(ModelForm):
])
self.helper = FormHelper()
self.helper.layout = FormLayout(
self.helper.layout = SaplFormLayout(
Fieldset(Publicacao._meta.verbose_name,
row1, row2, row3, css_class="large-12"))

30
compilacao/models.py

@ -9,8 +9,8 @@ from django.db.models.aggregates import Max
from django.template import defaultfilters
from django.utils.translation import ugettext_lazy as _
from compilacao import utils
from compilacao.utils import YES_NO_CHOICES
from compilacao.utils import int_to_letter, int_to_roman
from sapl import utils
class TimestampedMixin(models.Model):
@ -268,13 +268,13 @@ class TipoDispositivo(BaseModel):
max_length=100,
verbose_name=_('Sufixo html da nota automática'))
contagem_continua = models.BooleanField(
choices=YES_NO_CHOICES, verbose_name=_('Contagem contínua'))
choices=utils.YES_NO_CHOICES, verbose_name=_('Contagem contínua'))
dispositivo_de_articulacao = models.BooleanField(
choices=YES_NO_CHOICES,
choices=utils.YES_NO_CHOICES,
default=False,
verbose_name=_('Dispositivo de Articulação (Sem Texto)'))
dispositivo_de_alteracao = models.BooleanField(
choices=YES_NO_CHOICES,
choices=utils.YES_NO_CHOICES,
default=False,
verbose_name=_('Dispositivo de Alteração'))
formato_variacao0 = models.CharField(
@ -368,7 +368,7 @@ class PerfilEstruturalTextoArticulado(BaseModel):
nome = models.CharField(max_length=50, verbose_name=_('Nome'))
padrao = models.BooleanField(
default=False,
choices=YES_NO_CHOICES, verbose_name=_('Padrão'))
choices=utils.YES_NO_CHOICES, verbose_name=_('Padrão'))
class Meta:
verbose_name = _('Perfil Estrutural de Texto Articulado')
@ -388,10 +388,12 @@ class TipoDispositivoRelationship(BaseModel):
perfil = models.ForeignKey(PerfilEstruturalTextoArticulado)
filho_de_insercao_automatica = models.BooleanField(
default=False,
choices=YES_NO_CHOICES, verbose_name=_('Filho de Inserção Automática'))
choices=utils.YES_NO_CHOICES,
verbose_name=_('Filho de Inserção Automática'))
permitir_variacao = models.BooleanField(
default=True,
choices=YES_NO_CHOICES, verbose_name=_('Permitir Variação Numérica'))
choices=utils.YES_NO_CHOICES,
verbose_name=_('Permitir Variação Numérica'))
quantidade_permitida = models.IntegerField(
default=-1,
@ -549,12 +551,12 @@ class Dispositivo(BaseModel, TimestampedMixin):
inconstitucionalidade = models.BooleanField(
default=False,
choices=YES_NO_CHOICES,
choices=utils.YES_NO_CHOICES,
verbose_name=_('Inconstitucionalidade'))
# Relevant attribute only in altering norms
visibilidade = models.BooleanField(
default=False,
choices=YES_NO_CHOICES,
choices=utils.YES_NO_CHOICES,
verbose_name=_('Visibilidade no Texto Articulado Publicado'))
tipo_dispositivo = models.ForeignKey(
@ -839,16 +841,16 @@ class Dispositivo(BaseModel, TimestampedMixin):
result = separadores[i] + str(numero[i]) + result
elif formato[i] == TipoDispositivo.FNCI:
result = separadores[i] + \
utils.int_to_roman(numero[i]) + result
int_to_roman(numero[i]) + result
elif formato[i] == TipoDispositivo.FNCi:
result = separadores[i] + \
utils.int_to_roman(numero[i]).lower() + result
int_to_roman(numero[i]).lower() + result
elif formato[i] == TipoDispositivo.FNCA:
result = separadores[i] + \
utils.int_to_letter(numero[i]) + result
int_to_letter(numero[i]) + result
elif formato[i] == TipoDispositivo.FNCa:
result = separadores[i] + \
utils.int_to_letter(numero[i]).lower() + result
int_to_letter(numero[i]).lower() + result
elif formato[i] == TipoDispositivo.FNC8:
result = separadores[i] + '*' + result
elif formato[i] == TipoDispositivo.FNCN:

32
compilacao/templatetags/compilacao_filters.py

@ -1,4 +1,3 @@
from compressor.utils import get_class
from django import template
from django.core.signing import Signer
from django.db.models import Q
@ -22,12 +21,6 @@ def get_tipos_dispositivo(pk_atual):
id__gte=pk_atual)
@register.filter
def lookup(d, key):
skey = str(key)
return d[str(key)] if skey in d else []
@register.simple_tag
def dispositivo_desativado(dispositivo, inicio_vigencia, fim_vigencia):
if inicio_vigencia and fim_vigencia:
@ -155,31 +148,6 @@ def nomenclatura_heranca(d, ignore_ultimo=0, ignore_primeiro=0):
return result
@register.simple_tag
def field_verbose_name(instance, field_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
def model_verbose_name(class_name):
model = get_class('compilacao.models.' + class_name)
return model._meta.verbose_name
@register.simple_tag
def model_verbose_name_plural(class_name):
model = get_class('compilacao.models.' + class_name)
return model._meta.verbose_name_plural
@register.filter
def urldetail_content_type(obj):
return '%s:detail' % obj.content_type.model

297
compilacao/utils.py

@ -1,48 +1,3 @@
from braces.views import FormMessagesMixin
from crispy_forms.helper import FormHelper
from crispy_forms_foundation.layout import Column, Fieldset, Row
from crispy_forms_foundation.layout.base import HTML, Div, Layout
from crispy_forms_foundation.layout.buttons import Submit
from django import forms
from django.conf.urls import url
from django.core.urlresolvers import reverse, reverse_lazy
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, DeleteView, UpdateView
from django.views.generic.list import ListView
NO_ENTRIES_MSG = _('Não existem registros')
def to_column(name_span):
fieldname, span = name_span
return Column(fieldname, css_class='large-%d' % span)
def to_row(names_spans):
return Row(*list(map(to_column, names_spans)))
def to_fieldsets(fields):
for field in fields:
if isinstance(field, list):
legend, *row_specs = field
rows = [to_row(name_span_list) for name_span_list in row_specs]
yield Fieldset(legend, *rows)
else:
yield field
def make_choices(*choice_pairs):
assert len(choice_pairs) % 2 == 0
ipairs = iter(choice_pairs)
choices = list(zip(ipairs, ipairs))
yield choices
for key, value in choices:
yield key
YES_NO_CHOICES = [(True, _('Sim')), (False, _('Não'))]
def int_to_roman(int_value):
@ -70,255 +25,3 @@ def int_to_letter(int_value):
result = chr(rest + 65) + result
result = chr(int_value + 65) + result
return result
def from_to(start, end):
return list(range(start, end + 1))
def make_pagination(index, num_pages):
'''Make a list of adjacent page ranges interspersed with "None"s
The list starts with [1, 2] and end with [num_pages-1, num_pages].
The list includes [index-1, index, index+1]
"None"s separate those ranges and mean ellipsis (...)
Example: [1, 2, None, 10, 11, 12, None, 29, 30]
'''
PAGINATION_LENGTH = 10
if num_pages <= PAGINATION_LENGTH:
return from_to(1, num_pages)
else:
if index - 1 <= 5:
tail = [num_pages - 1, num_pages]
head = from_to(1, PAGINATION_LENGTH - 3)
else:
if index + 1 >= num_pages - 3:
tail = from_to(index - 1, num_pages)
else:
tail = [index - 1, index, index + 1,
None, num_pages - 1, num_pages]
head = from_to(1, PAGINATION_LENGTH - len(tail) - 1)
return head + [None] + tail
def get_field_display(obj, fieldname):
field = obj._meta.get_field(fieldname)
verbose_name = str(field.verbose_name)
if field.choices:
value = getattr(obj, 'get_%s_display' % fieldname)()
else:
value = getattr(obj, fieldname)
if value is None:
display = ''
elif 'date' in str(type(value)):
display = value.strftime("%d/%m/%Y")
elif 'bool' in str(type(value)):
display = 'Sim' if value else 'Não'
else:
display = str(value)
return verbose_name, display
class FormLayout(Layout):
def __init__(self, *fields):
buttons = Div(
HTML('<a href="{{ view.cancel_url }}"'
' class="button radius alert">%s</a>' % _('Cancelar')),
Submit('submit', _('Enviar'),
css_class='button radius success right'),
css_class='radius clearfix'
)
_fields = list(to_fieldsets(fields)) + \
[Row(Column(buttons, css_class='clearfix'))]
super(FormLayout, self).__init__(*_fields)
class Crud(object):
pass
def build_crud(model, help_path, layout):
crud = Crud()
crud.model = model
crud.help_path = help_path
crud.namespace = model._meta.model_name
class CrispyForm(forms.ModelForm):
class Meta:
model = crud.model
exclude = []
def __init__(self, *args, **kwargs):
super(CrispyForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.layout = FormLayout(*layout)
crud.model_form = CrispyForm
def in_namespace(url_name):
return '%s:%s' % (crud.namespace, url_name)
def make_form_invalid_message(msg):
return '%s %s' % (_('Formulário inválido.'), msg)
class BaseMixin(object):
model = crud.model
verbose_name = crud.model._meta.verbose_name
verbose_name_plural = crud.model._meta.verbose_name_plural
list_url = reverse_lazy(in_namespace('list'))
create_url = reverse_lazy(in_namespace('create'))
help_path = crud.help_path # FIXME
def get_url_for_this_object(self, url_name):
return reverse(in_namespace(url_name), args=(self.object.id,))
@property
def detail_url(self):
return self.get_url_for_this_object('detail')
@property
def update_url(self):
return self.get_url_for_this_object('update')
@property
def delete_url(self):
return self.get_url_for_this_object('delete')
def get_template_names(self):
names = super(BaseMixin, self).get_template_names()
names.append("compilacao/%s.html" %
self.template_name_suffix.lstrip('_'))
return names
class CrudListView(BaseMixin, ListView):
title = BaseMixin.verbose_name_plural
paginate_by = 10
no_entries_msg = NO_ENTRIES_MSG
@cached_property
def field_names(self):
'''The list of field names to display on table
This base implementation returns the field names
in the first fieldset of the layout.
'''
rows = layout[0][1:]
return [fieldname for row in rows for fieldname, __ in row]
def get_rows(self, object_list):
return [[(get_field_display(obj, name)[1],
obj.pk if i == 0 else None)
for i, name in enumerate(self.field_names)]
for obj in object_list
]
def get_context_data(self, **kwargs):
context = super(CrudListView, self).get_context_data(**kwargs)
paginator = context['paginator']
page_obj = context['page_obj']
context['page_range'] = make_pagination(
page_obj.number, paginator.num_pages)
object_list = context['object_list']
context['headers'] = [
self.model._meta.get_field(fieldname).verbose_name
for fieldname in self.field_names]
context['rows'] = self.get_rows(object_list)
context['NO_ENTRIES_MSG'] = NO_ENTRIES_MSG
return context
class CrudCreateView(BaseMixin, FormMessagesMixin, CreateView):
form_class = crud.model_form
title = _('Adicionar %(verbose_name)s') % {
'verbose_name': BaseMixin.verbose_name}
form_valid_message = _('Registro criado com sucesso!')
form_invalid_message = make_form_invalid_message(
_('O registro não foi criado.'))
cancel_url = BaseMixin.list_url
def form_invalid(self, form):
"""
If the form is invalid, re-render the context data with the
data-filled form and errors.
"""
print(form.errors)
return self.render_to_response(self.get_context_data(form=form))
def get_success_url(self):
return self.detail_url
class CrudDetailView(BaseMixin, DetailView):
@property
def title(self):
return self.get_object()
def get_column(self, fieldname, span):
obj = self.get_object()
verbose_name, text = get_field_display(obj, fieldname)
return {
'id': fieldname,
'span': span,
'verbose_name': verbose_name,
'text': text,
}
@property
def fieldsets(self):
return [
{'legend': legend,
'rows': [[self.get_column(fieldname, span)
for fieldname, span in row]
for row in rows]
} for legend, *rows in layout]
class CrudUpdateView(BaseMixin, FormMessagesMixin, UpdateView):
form_class = crud.model_form
form_valid_message = _('Registro alterado com sucesso!')
form_invalid_message = make_form_invalid_message(
_('Suas alterações não foram salvas.'))
@property
def title(self):
return self.get_object()
def get_success_url(self):
return self.detail_url
def cancel_url(self):
return self.detail_url
class CrudDeleteView(BaseMixin, FormMessagesMixin, DeleteView):
form_valid_message = _('Registro excluído com sucesso!')
form_invalid_message = make_form_invalid_message(
_('O registro não foi excluído.'))
def get_success_url(self):
return self.list_url
crud.CrudListView = CrudListView
crud.CrudCreateView = CrudCreateView
crud.CrudDetailView = CrudDetailView
crud.CrudUpdateView = CrudUpdateView
crud.CrudDeleteView = CrudDeleteView
# XXX transform into a property of Crud to enable override
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'),
url(r'^(?P<pk>\d+)/edit$',
CrudUpdateView.as_view(), name='update'),
url(r'^(?P<pk>\d+)/delete$',
CrudDeleteView.as_view(), name='delete'),
]
crud.urls = crud.urlpatterns, crud.namespace, crud.namespace
return crud

58
compilacao/views.py

@ -20,7 +20,6 @@ from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, DeleteView, UpdateView
from django.views.generic.list import ListView
from compilacao import utils
from compilacao.forms import (NotaForm, PublicacaoForm, TaForm, TipoTaForm,
VideForm)
from compilacao.models import (Dispositivo, Nota,
@ -28,7 +27,7 @@ from compilacao.models import (Dispositivo, Nota,
TextoArticulado, TipoDispositivo, TipoNota,
TipoPublicacao, TipoTextoArticulado, TipoVide,
VeiculoPublicacao, Vide)
from compilacao.utils import NO_ENTRIES_MSG, build_crud
from sapl.crud import NO_ENTRIES_MSG, build_crud, make_pagination
DISPOSITIVO_SELECT_RELATED = (
'tipo_dispositivo',
@ -72,6 +71,57 @@ veiculo_publicacao_crud = build_crud(
])
perfil_estr_txt_norm = build_crud(
PerfilEstruturalTextoArticulado, 'perfil_estrutural', [
[_('Perfil Estrutural de Textos Articulados'),
[('sigla', 2), ('nome', 10)]],
])
tipo_dispositivo_crud = build_crud(
TipoDispositivo, 'tipo_dispositivo', [
[_('Dados Básicos'),
[('nome', 8), ('class_css', 4)]],
[_('Configurações para Edição do Rótulo'),
[('rotulo_prefixo_texto', 3),
('rotulo_sufixo_texto', 3),
('rotulo_ordinal', 3),
('contagem_continua', 3)],
],
[_('Configurações para Renderização de Rótulo e Texto'),
[('rotulo_prefixo_html', 6),
('rotulo_sufixo_html', 6), ],
[('texto_prefixo_html', 4),
('dispositivo_de_articulacao', 4),
('texto_sufixo_html', 4)],
],
[_('Configurações para Nota Automática'),
[('nota_automatica_prefixo_html', 6),
('nota_automatica_sufixo_html', 6),
],
],
[_('Configurações para Variações Numéricas'),
[('formato_variacao0', 12)],
[('rotulo_separador_variacao01', 5), ('formato_variacao1', 7), ],
[('rotulo_separador_variacao12', 5), ('formato_variacao2', 7), ],
[('rotulo_separador_variacao23', 5), ('formato_variacao3', 7), ],
[('rotulo_separador_variacao34', 5), ('formato_variacao4', 7), ],
[('rotulo_separador_variacao45', 5), ('formato_variacao5', 7), ],
],
])
class IntegracaoTaView(TemplateView):
def get(self, *args, **kwargs):
@ -259,7 +309,7 @@ class TaListView(ListView):
context = super(TaListView, self).get_context_data(**kwargs)
paginator = context['paginator']
page_obj = context['page_obj']
context['page_range'] = utils.make_pagination(
context['page_range'] = make_pagination(
page_obj.number, paginator.num_pages)
return context
@ -1551,7 +1601,7 @@ class PublicacaoListView(ListView):
@property
def title(self):
return _('%s da %s' % (
return _('%s de %s' % (
self.model._meta.verbose_name_plural,
self.ta))

54
compilacao/views2.py

@ -1,54 +0,0 @@
from django.utils.translation import ugettext_lazy as _
from compilacao.models import PerfilEstruturalTextoArticulado, TipoDispositivo
from sapl.crud import build_crud
perfil_estr_txt_norm = build_crud(
PerfilEstruturalTextoArticulado, 'perfil_estrutural', [
[_('Perfil Estrutural de Textos Articulados'),
[('sigla', 2), ('nome', 10)]],
])
tipo_dispositivo_crud = build_crud(
TipoDispositivo, 'tipo_dispositivo', [
[_('Dados Básicos'),
[('nome', 8), ('class_css', 4)]],
[_('Configurações para Edição do Rótulo'),
[('rotulo_prefixo_texto', 3),
('rotulo_sufixo_texto', 3),
('rotulo_ordinal', 3),
('contagem_continua', 3)],
],
[_('Configurações para Renderização de Rótulo e Texto'),
[('rotulo_prefixo_html', 6),
('rotulo_sufixo_html', 6), ],
[('texto_prefixo_html', 4),
('dispositivo_de_articulacao', 4),
('texto_sufixo_html', 4)],
],
[_('Configurações para Nota Automática'),
[('nota_automatica_prefixo_html', 6),
('nota_automatica_sufixo_html', 6),
],
],
[_('Configurações para Variações Numéricas'),
[('formato_variacao0', 12)],
[('rotulo_separador_variacao01', 5), ('formato_variacao1', 7), ],
[('rotulo_separador_variacao12', 5), ('formato_variacao2', 7), ],
[('rotulo_separador_variacao23', 5), ('formato_variacao3', 7), ],
[('rotulo_separador_variacao34', 5), ('formato_variacao4', 7), ],
[('rotulo_separador_variacao45', 5), ('formato_variacao5', 7), ],
],
])

38
templates/compilacao/detail.html

@ -1,38 +0,0 @@
{% extends "base.html" %}
{% load i18n %}
{% block base_content %}
{# FIXME is this the best markup to use? #}
<div class="clearfix">
{% block actions %}
<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>
{% endblock actions %}
{% block sections_nav %}{% endblock %}
</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 %}
{% endblock detail_content %}
{% endblock base_content %}

82
templates/compilacao/list.html

@ -1,82 +0,0 @@
{% extends "base.html" %}
{% load i18n %}
{% block base_content %}
{# FIXME is this the best markup to use? #}
<dl class="sub-nav">
<dd><a href="{{ view.create_url }}">
{% blocktrans with verbose_name=view.verbose_name %} Adicionar {{ verbose_name }} {% endblocktrans %}
</a></dd>
{% block more_buttons %}
{% endblock more_buttons %}
</dl>
{% if not rows %}
<p>{{ NO_ENTRIES_MSG }}</p>
{% else %}
<table class="table table-hover">
<thead>
<tr>
{% for name in headers %}
<th>{{ name }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for value_list in rows %}
<tr>
{% for value, href in value_list %}
<td>
{% if href %}
<a href="{{ href }}">{{ value }}</a>
{% else %}
{{ value }}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% 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 %}
{% endblock %}

1
templates/compilacao/publicacao_detail.html

@ -1,4 +1,5 @@
{% extends "base.html" %} {% load i18n %} {% load compilacao_filters %}
{% load common_tags %}
{% block base_content %} {# FIXME is this the best markup to use? #}
<div class="clearfix">

54
templates/compilacao/publicacao_list.html

@ -1,12 +1,13 @@
{% extends "base.html" %}
{% load i18n %}
{% load compilacao_filters %}
{% load common_tags %}
{% block base_content %}
<dl class="sub-nav">
<dd><a href="{{ view.create_url }}">
{% trans 'Adicionar'%} {%model_verbose_name 'Publicacao'%}
{% trans 'Adicionar'%} {%model_verbose_name 'compilacao.models.Publicacao'%}
</a></dd>
{% block more_buttons %}
<dd><a href="{% url 'ta_text' view.kwargs|lookup:'ta_id' %}">{% trans 'Voltar' %}</a></dd>
@ -20,13 +21,13 @@
<table class="table">
<thead>
<tr>
<th>{% fieldclass_verbose_name 'Publicacao' 'data' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'hora' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'numero' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'ano' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'edicao' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'veiculo_publicacao' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'tipo_publicacao' %}</th>
<th>{% fieldclass_verbose_name 'compilacao.models.Publicacao' 'data' %}</th>
<th>{% fieldclass_verbose_name 'compilacao.models.Publicacao' 'hora' %}</th>
<th>{% fieldclass_verbose_name 'compilacao.models.Publicacao' 'numero' %}</th>
<th>{% fieldclass_verbose_name 'compilacao.models.Publicacao' 'ano' %}</th>
<th>{% fieldclass_verbose_name 'compilacao.models.Publicacao' 'edicao' %}</th>
<th>{% fieldclass_verbose_name 'compilacao.models.Publicacao' 'veiculo_publicacao' %}</th>
<th>{% fieldclass_verbose_name 'compilacao.models.Publicacao' 'tipo_publicacao' %}</th>
</tr>
</thead>
<tbody>
@ -44,40 +45,5 @@
</tbody>
</table>
{%endif%}
{% 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 %}
{% include 'paginacao.html'%}
{% endblock %}

1
templates/compilacao/text_edit.html

@ -4,6 +4,7 @@
{% load staticfiles %}
{% load sass_tags %}
{% load crispy_forms_tags %}
{% load common_tags %}
{% block head_content %}{{block.super}}

1
templates/compilacao/text_edit_bloco.html

@ -1,5 +1,6 @@
{% load i18n %}
{% load compilacao_filters %}
{% load common_tags %}
{% for dpt in object_list %}
{% if dpt.nivel == view.flag_nivel_old %}

1
templates/compilacao/text_edit_blocoalteracao.html

@ -1,4 +1,5 @@
{% load compilacao_filters %}
{% load common_tags %}
{% for ch in dpt.pk|get_bloco_atualizador %}
{% spaceless %}
<div class="dpt" id="d{{ch.id}}">

1
templates/compilacao/text_list.html

@ -1,6 +1,7 @@
{% extends "compilacao/textoarticulado_detail.html" %}
{% load i18n %}
{% load compilacao_filters %}
{% load common_tags %}
{% load staticfiles %}
{% load sass_tags %}

1
templates/compilacao/text_list_bloco.html

@ -1,5 +1,6 @@
{% load i18n %}
{% load compilacao_filters %}
{% load common_tags %}
<div class="display"></div>

1
templates/compilacao/text_list_blocoalteracao.html

@ -1,4 +1,5 @@
{% load compilacao_filters %}
{% load common_tags %}
<i class="fa fa-quote-left fa-2x fa-pull-left fa-border"></i>
{% for ch in dpt.pk|get_bloco_atualizador %}
{% spaceless %}

28
templates/compilacao/textoarticulado_detail.html

@ -1,35 +1,41 @@
{% extends "base.html" %} {% load i18n %} {% load compilacao_filters %}
{% extends "base.html" %}
{% load i18n %}
{% load compilacao_filters %}
{% load common_tags %}
{% block sections_nav %}
{%if object %}
<dl class="sub-nav">
{% if object.content_object%}
<dd><a href="{% url object|urldetail_content_type object.content_object.pk %}"title="{% trans 'Ir para '%}{{object.content_object}}">Início</a></dd>
{%else%}
<dd><a href="{% url 'ta_detail' object.pk %}" {% trans 'Início' %}</a></dd>
<dd><a href="{% url 'ta_detail' object.pk %}">{% trans 'Início' %}</a></dd>
{%endif%}
<dd><a href="{% url 'ta_pub_list' object.pk %}">{% model_verbose_name_plural 'Publicacao' %}</a></dd>
<dd><a href="{% url 'ta_pub_list' object.pk %}">{% model_verbose_name_plural 'compilacao.models.Publicacao' %}</a></dd>
<dd><a href="{% url 'ta_text' object.pk %}">{% trans 'Texto' %}</a></dd>
<dd><a href="{% url 'ta_text_edit' object.pk %}">{% trans 'Edição do Texto' %}</a></dd>
</dl>
{%endif %}
{% endblock %}
{% block base_content %} {# FIXME is this the best markup to use? #}
<div class="clearfix">
{% block actions %}
<ul class="button-group right">
{%if object %}
<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>
{%endif%}
<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>
<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 '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 'tipovide:list' %}">{%model_verbose_name_plural 'TipoVide'%}</a></li>
<li><a href="{% url 'tipo_ta_list' %}">{%model_verbose_name_plural 'compilacao.models.TipoTextoArticulado'%}</a></li>
<li><a href="{% url 'tipopublicacao:list' %}">{%model_verbose_name_plural 'compilacao.models.TipoPublicacao'%}</a></li>
<li><a href="{% url 'veiculopublicacao:list' %}">{%model_verbose_name_plural 'compilacao.models.VeiculoPublicacao'%}</a></li>
<li><a href="{% url 'tiponota:list' %}">{%model_verbose_name_plural 'compilacao.models.TipoNota'%}</a></li>
<li><a href="{% url 'tipovide:list' %}">{%model_verbose_name_plural 'compilacao.models.TipoVide'%}</a></li>
<li><a href="#">TODO: Tipo de Dispositivo</a></li>
<li><a href="#">TODO: Perfil Estrutural de Textos Articulados</a></li>
</ul></li>

70
templates/compilacao/textoarticulado_list.html

@ -1,26 +1,17 @@
{% extends "base.html" %}
{% extends "compilacao/textoarticulado_detail.html" %}
{% load i18n %}
{% load compilacao_filters %}
{% load common_tags %}
{% block base_content %}
{% block actions %}{{block.super}}
{# FIXME is this the best markup to use? #}
<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>
<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 '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 'tipovide:list' %}">{%model_verbose_name_plural 'TipoVide'%}</a></li>
<li><a href="#">Tipo de Dispositivo</a></li>
<li><a href="#">Perfil Estrutural de Textos Articulados</a></li>
</ul>
{% endblock actions %}
{% block detail_content %}
{% endblock detail_content %}
<dl class="sub-nav">
<dd><a href="{{ view.create_url }}">
{% trans 'Adicionar'%} {%model_verbose_name 'TextoArticulado'%}
{% trans 'Adicionar'%} {%model_verbose_name 'compilacao.models.TextoArticulado'%}
</a></dd>
@ -33,11 +24,11 @@
<table class="table table-hover">
<thead>
<tr>
<th>{% trans 'Tipo'%}</th>
<th>{% trans 'Número'%}</th>
<th>{% trans 'Ano'%}</th>
<th>{% trans 'Data'%}</th>
<th>{% trans 'Ementa'%}</th>
<th>{% fieldclass_verbose_name 'compilacao.models.TextoArticulado' 'tipo_ta' %}</th>
<th>{% fieldclass_verbose_name 'compilacao.models.TextoArticulado' 'numero' %}</th>
<th>{% fieldclass_verbose_name 'compilacao.models.TextoArticulado' 'ano' %}</th>
<th>{% fieldclass_verbose_name 'compilacao.models.TextoArticulado' 'data' %}</th>
<th>{% fieldclass_verbose_name 'compilacao.models.TextoArticulado' 'ementa' %}</th>
</tr>
</thead>
<tbody>
@ -52,40 +43,5 @@
{% 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 %}
{% include 'paginacao.html'%}
{% endblock %}

1
templates/compilacao/tipotextoarticulado_detail.html

@ -1,4 +1,5 @@
{% extends "base.html" %} {% load i18n %} {% load compilacao_filters %}
{% load common_tags %}
{% block base_content %} {# FIXME is this the best markup to use? #}

46
templates/compilacao/tipotextoarticulado_list.html

@ -1,12 +1,13 @@
{% extends "base.html" %}
{% load i18n %}
{% load compilacao_filters %}
{% load common_tags %}
{% block base_content %}
<dl class="sub-nav">
<dd><a href="{{ view.create_url }}">
{% trans 'Adicionar'%} {%model_verbose_name 'TipoTextoArticulado'%}
{% trans 'Adicionar'%} {%model_verbose_name 'compilacao.models.TipoTextoArticulado'%}
</a></dd>
{% block more_buttons %}
@ -19,9 +20,9 @@
<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>
<th>{% fieldclass_verbose_name 'compilacao.models.TipoTextoArticulado' 'sigla' %}</th>
<th>{% fieldclass_verbose_name 'compilacao.models.TipoTextoArticulado' 'descricao' %}</th>
<th>{% fieldclass_verbose_name 'compilacao.models.TipoTextoArticulado' 'content_type' %}</th>
</tr>
</thead>
<tbody>
@ -34,41 +35,6 @@
{% 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%}
{% include 'paginacao.html'%}
{% endblock %}

4
templates/norma/normajuridica_detail.html

@ -2,7 +2,7 @@
{% load i18n %}
{% block sections_nav %}
<dl class="sub-nav left">
<dd><a href="{% url 'normajuridica:detail' object.pk %}" class="button secondary">{% trans 'Início' %}</a></dd>
<dd><a href="{% url 'normajuridica:detail' object.pk %}">{% trans 'Início' %}</a></dd>
{% comment %}
Opção adicionada para chamar o TextoArticulado da norma.
@ -10,7 +10,7 @@
e a view NormaTa(IntegracaoTaView) em views.py
Em nada mais a integração interfere em Norma Jurídica
{% endcomment %}
<dd><a href="{% url 'norma_ta' object.pk %}" class="button secondary">{% trans 'Texto' %}</a></dd>
<dd><a href="{% url 'norma_ta' object.pk %}">{% trans 'Texto' %}</a></dd>
</dl>
{% endblock sections_nav %}

Loading…
Cancel
Save