Browse Source

Tabelas Auxiliares da Compilação.

pull/98/head
LeandroRoberto 9 years ago
parent
commit
cdd220b02c
  1. 25
      compilacao/forms.py
  2. 16
      compilacao/templatetags/compilacao_filters.py
  3. 14
      compilacao/urls.py
  4. 235
      compilacao/utils.py
  5. 43
      compilacao/views.py
  6. 39
      compilacao/views2.py
  7. BIN
      static/img/ajax-loader.gif
  8. 3
      static/js/compilacao.js
  9. 5
      static/js/compilacao_view.js
  10. 11
      static/styles/app.scss
  11. 18
      static/styles/compilacao.scss
  12. 4
      templates/compilacao/text_edit.html
  13. 11
      templates/compilacao/text_list.html
  14. 5
      templates/compilacao/text_list_bloco.html
  15. 3
      templates/compilacao/text_list_blocoalteracao.html
  16. 31
      templates/compilacao/textoarticulado_detail.html
  17. 21
      templates/compilacao/textoarticulado_list.html
  18. 1
      templates/index.html

25
compilacao/forms.py

@ -1,7 +1,7 @@
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, Submit) Layout, Row)
from crispy_forms_foundation.layout.buttons import Button from crispy_forms_foundation.layout.buttons import Button
from crispy_forms_foundation.layout.fields import Field from crispy_forms_foundation.layout.fields import Field
from django import forms from django import forms
@ -9,10 +9,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 import models
from compilacao.models import (Dispositivo, Nota, TextoArticulado, TipoNota, from compilacao.models import (Dispositivo, Nota, TextoArticulado, TipoNota,
TipoTextoArticulado, TipoVide, Vide) TipoTextoArticulado, TipoVide, Vide,
from compilacao.utils import to_column, to_fieldsets, to_row PARTICIPACAO_SOCIAL_CHOICES)
from compilacao.utils import to_column, to_row, FormLayout
class UpLoadImportFileForm(forms.Form): class UpLoadImportFileForm(forms.Form):
@ -30,21 +30,6 @@ ta_error_messages = {
} }
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 TaForm(ModelForm): class TaForm(ModelForm):
tipo_ta = forms.ModelChoiceField( tipo_ta = forms.ModelChoiceField(
label=_('Tipo do Texto Articulado'), label=_('Tipo do Texto Articulado'),
@ -73,7 +58,7 @@ class TaForm(ModelForm):
required=False) required=False)
participacao_social = forms.NullBooleanField( participacao_social = forms.NullBooleanField(
label=_('Participação Social'), label=_('Participação Social'),
widget=forms.Select(choices=models.PARTICIPACAO_SOCIAL_CHOICES), widget=forms.Select(choices=PARTICIPACAO_SOCIAL_CHOICES),
required=False) required=False)
class Meta: class Meta:

16
compilacao/templatetags/compilacao_filters.py

@ -1,9 +1,11 @@
from compressor.utils import get_class
from django import template from django import template
from django.core.signing import Signer from django.core.signing import Signer
from django.db.models import Q from django.db.models import Q
from compilacao.models import Dispositivo, TipoDispositivo from compilacao.models import Dispositivo, TipoDispositivo
register = template.Library() register = template.Library()
@ -155,10 +157,22 @@ def nomenclatura_heranca(d, ignore_ultimo=0, ignore_primeiro=0):
@register.simple_tag @register.simple_tag
def verbose_name(instance, field_name): 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 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 @register.filter
def urldetail_content_type(obj): def urldetail_content_type(obj):
return '%s:detail' % obj.content_type.model return '%s:detail' % obj.content_type.model

14
compilacao/urls.py

@ -1,6 +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,\
tipo_publicacao_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'),
@ -11,6 +13,7 @@ urlpatterns_compilacao = [
url(r'^(?P<pk>[0-9]+)/delete$', url(r'^(?P<pk>[0-9]+)/delete$',
views.TaDeleteView.as_view(), name='ta_delete'), views.TaDeleteView.as_view(), name='ta_delete'),
url(r'^(?P<ta_id>[0-9]+)/text$', url(r'^(?P<ta_id>[0-9]+)/text$',
views.TextView.as_view(), name='ta_text'), views.TextView.as_view(), name='ta_text'),
url(r'^(?P<ta_id>[0-9]+)/text/vigencia/(?P<sign>.+)/$', url(r'^(?P<ta_id>[0-9]+)/text/vigencia/(?P<sign>.+)/$',
@ -57,6 +60,17 @@ urlpatterns_compilacao = [
url(r'^(?P<ta_id>[0-9]+)/text/search$', url(r'^(?P<ta_id>[0-9]+)/text/search$',
views.DispositivoSearchFragmentFormView.as_view(), views.DispositivoSearchFragmentFormView.as_view(),
name='search_dispositivo'), name='search_dispositivo'),
url(r'^config/tipo-nota/',
include(tipo_nota_crud.urls)),
url(r'^config/tipo-vide/',
include(tipo_vide_crud.urls)),
url(r'^config/tipo-publicacao/',
include(tipo_publicacao_crud.urls)),
url(r'^config/veiculo-publicacao/',
include(veiculo_publicacao_crud.urls)),
] ]
urlpatterns = [ urlpatterns = [

235
compilacao/utils.py

@ -1,5 +1,19 @@
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 import Column, Fieldset, Row
from crispy_forms_foundation.layout.base import Layout, Div, HTML
from crispy_forms_foundation.layout.buttons import Submit
from django import forms
from django.conf.urls import url
from django.core.urlresolvers import reverse_lazy, reverse
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.edit import CreateView, UpdateView, DeleteView
from django.views.generic.list import ListView
NO_ENTRIES_MSG = _('Não existem registros')
def to_column(name_span): def to_column(name_span):
@ -88,3 +102,224 @@ def make_pagination(index, num_pages):
None, num_pages - 1, num_pages] None, num_pages - 1, num_pages]
head = from_to(1, PAGINATION_LENGTH - len(tail) - 1) head = from_to(1, PAGINATION_LENGTH - len(tail) - 1)
return head + [None] + tail 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("crud/%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

43
compilacao/views.py

@ -1,6 +1,6 @@
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 django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
@ -23,7 +23,10 @@ from compilacao import forms, utils
from compilacao.models import (Dispositivo, Nota, from compilacao.models import (Dispositivo, Nota,
PerfilEstruturalTextoArticulado, PerfilEstruturalTextoArticulado,
TextoArticulado, TipoDispositivo, TipoNota, TextoArticulado, TipoDispositivo, TipoNota,
TipoTextoArticulado, Vide) TipoTextoArticulado, Vide, TipoVide,
TipoPublicacao, VeiculoPublicacao)
from compilacao.utils import build_crud
DISPOSITIVO_SELECT_RELATED = ( DISPOSITIVO_SELECT_RELATED = (
'tipo_dispositivo', 'tipo_dispositivo',
@ -36,6 +39,36 @@ DISPOSITIVO_SELECT_RELATED = (
'dispositivo_pai', 'dispositivo_pai',
'dispositivo_pai__tipo_dispositivo') 'dispositivo_pai__tipo_dispositivo')
tipo_nota_crud = build_crud(
TipoNota, 'tipo_nota', [
[_('Tipo da Nota'),
[('sigla', 2), ('nome', 10)],
[('modelo', 12)]],
])
tipo_vide_crud = build_crud(
TipoVide, 'tipo_vide', [
[_('Tipo de Vide'),
[('sigla', 2), ('nome', 10)]],
])
tipo_publicacao_crud = build_crud(
TipoPublicacao, 'tipo_publicacao', [
[_('Tipo de Publicação'),
[('sigla', 2), ('nome', 10)]],
])
veiculo_publicacao_crud = build_crud(
VeiculoPublicacao, 'veiculo_publicacao', [
[_('Veículo de Publicação'),
[('sigla', 2), ('nome', 10)]],
])
class TaListView(ListView): class TaListView(ListView):
model = TextoArticulado model = TextoArticulado
@ -58,7 +91,7 @@ class TaDetailView(DetailView):
@property @property
def title(self): def title(self):
if self.object.content_object: if self.get_object().content_object:
return _( return _(
'Metadados para o Texto Articulado da %s - %s') % ( 'Metadados para o Texto Articulado da %s - %s') % (
self.get_object().content_object._meta.verbose_name_plural, self.get_object().content_object._meta.verbose_name_plural,
@ -349,10 +382,6 @@ class TextView(ListView):
return self.itens_de_vigencia return self.itens_de_vigencia
def get_ta(self):
return TextoArticulado.objects.select_related('tipo_ta').get(
pk=self.kwargs['ta_id'])
def is_ta_alterador(self): def is_ta_alterador(self):
if self.flag_alteradora == -1: if self.flag_alteradora == -1:
self.flag_alteradora = Dispositivo.objects.select_related( self.flag_alteradora = Dispositivo.objects.select_related(

39
compilacao/views2.py

@ -5,38 +5,6 @@ from compilacao.models import (PerfilEstruturalTextoArticulado,
TipoVide, VeiculoPublicacao) TipoVide, VeiculoPublicacao)
from sapl.crud import build_crud from sapl.crud import build_crud
DISPOSITIVO_SELECT_RELATED = (
'tipo_dispositivo',
'ta_publicado',
'ta',
'dispositivo_atualizador',
'dispositivo_atualizador__dispositivo_pai',
'dispositivo_atualizador__dispositivo_pai__ta',
'dispositivo_atualizador__dispositivo_pai__ta__tipo',
'dispositivo_pai',
'dispositivo_pai__tipo_dispositivo')
tipo_nota_crud = build_crud(
TipoNota, 'tipo_nota', [
[_('Tipo da Nota'),
[('sigla', 2), ('nome', 10)],
[('modelo', 12)]],
])
tipo_vide_crud = build_crud(
TipoVide, 'tipo_vide', [
[_('Tipo de Vide'),
[('sigla', 2), ('nome', 10)]],
])
tipo_publicacao_crud = build_crud(
TipoPublicacao, 'tipo_publicacao', [
[_('Tipo de Publicação'),
[('sigla', 2), ('nome', 10)]],
])
perfil_estr_txt_norm = build_crud( perfil_estr_txt_norm = build_crud(
PerfilEstruturalTextoArticulado, 'perfil_estrutural', [ PerfilEstruturalTextoArticulado, 'perfil_estrutural', [
@ -46,13 +14,6 @@ perfil_estr_txt_norm = build_crud(
]) ])
veiculo_publicacao_crud = build_crud(
VeiculoPublicacao, 'veiculo_publicacao', [
[_('Veículo de Publicação'),
[('sigla', 2), ('nome', 10)]],
])
tipo_dispositivo_crud = build_crud( tipo_dispositivo_crud = build_crud(
TipoDispositivo, 'tipo_dispositivo', [ TipoDispositivo, 'tipo_dispositivo', [

BIN
static/img/ajax-loader.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

3
static/js/compilacao.js

@ -35,5 +35,6 @@ function ReadCookie(cookieName) {
} }
function insertWaitAjax(element) { function insertWaitAjax(element) {
jQuery(element).append('<div style="text-align:center;"><img src="/static/img/ajax-loader.gif"></div>'); //jQuery(element).append('<div style="text-align:center;"><img src="/static/img/ajax-loader.gif"></div>');
jQuery(element).append('<div style="text-align:center;"><i style="font-size: 200%;"class="fa fa-refresh fa-spin"></i></div>');
} }

5
static/js/compilacao_view.js

@ -154,7 +154,10 @@ $(document).ready(function() {
$(".dpt").css("font-size", "+=1"); $(".dpt").css("font-size", "+=1");
}); });
$(".dpt").each(function() {
var nivel = parseInt($(this).attr('nivel'));
$(this).css('z-index', 20-nivel)
});
}); });

11
static/styles/app.scss

@ -198,13 +198,6 @@ box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 1px 4px rgba(0, 0, 0, 0.23);
max-width: 960px; max-width: 960px;
} }
.sub-nav {
dt a, dd a, li a {
color: white !important;
}
}
.icon-bar { .icon-bar {
vertical-align: top; vertical-align: top;
} }
@ -262,10 +255,6 @@ font-size: 100%;
height: 100%; height: 100%;
background-color: #ffffff; background-color: #ffffff;
} }
.content a:hover {
color: #444444;
}
/* Layout */ /* Layout */
.footer { .footer {

18
static/styles/compilacao.scss

@ -221,7 +221,6 @@ a:link:after, a:visited:after {
font-size: 1.15em; font-size: 1.15em;
float:left; float:left;
.dptt { .dptt {
z-index: 8;
position: relative; position: relative;
} }
} }
@ -398,7 +397,7 @@ a:link:after, a:visited:after {
left: -1.6em; left: -1.6em;
right: -1.6em; right: -1.6em;
background-color: #2980b9; background-color: #2980b9;
z-index: 8; z-index: 18;
* { * {
font-size: 0.8rem; font-size: 0.8rem;
@ -419,7 +418,7 @@ a:link:after, a:visited:after {
border-spacing: 0; border-spacing: 0;
top: 0px; top: 0px;
right: 0px; right: 0px;
z-index: 9; z-index: 19;
li { li {
display: table-cell; display: table-cell;
background-color: $color_buttons; background-color: $color_buttons;
@ -447,7 +446,7 @@ a:link:after, a:visited:after {
margin: 1em 0 2em 0; margin: 1em 0 2em 0;
padding: 0em; padding: 0em;
border: 0px; border: 0px;
z-index: 9; z-index: 19;
ul.btns-action { ul.btns-action {
display: none; display: none;
} }
@ -895,7 +894,7 @@ a:link:after, a:visited:after {
padding: 0.3em; padding: 0.3em;
font-size: 80%; font-size: 80%;
text-align: right; text-align: right;
z-index: 5; z-index: 15;
display: table; display: table;
li { li {
display: table-cell; display: table-cell;
@ -903,7 +902,7 @@ a:link:after, a:visited:after {
} }
.actions_parents { .actions_parents {
z-index: 1; z-index: 11;
top: 0em; top: 0em;
left: 0em; left: 0em;
a { a {
@ -989,7 +988,7 @@ a:link:after, a:visited:after {
.actions_inserts { .actions_inserts {
background: transparent; background: transparent;
position: relative; position: relative;
z-index: 9; z-index: 19;
display: table; display: table;
width: 100%; width: 100%;
@ -1023,7 +1022,7 @@ a:link:after, a:visited:after {
} }
&::before { &::before {
z-index: 10; z-index: 20;
position: absolute; position: absolute;
background: url(/static/img/icon_delete_white.png) no-repeat 50% 50%; background: url(/static/img/icon_delete_white.png) no-repeat 50% 50%;
content:""; content:"";
@ -1327,7 +1326,8 @@ a:link:after, a:visited:after {
} }
@media print { @media print {
.cp .vigencias { .cp .vigencias, .toggle-topbar, .menu-icon, .button {
display:none; display:none;
} }
} }

4
templates/compilacao/text_edit.html

@ -14,12 +14,14 @@
{% block title%} {% block title%}
<h1><b>Edição:</b> {{ view.get_ta }} - <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}} {% 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> <dd><a href="{% url 'ta_text' object.pk %}" class="button secondary">{% trans 'Texto' %}</a></dd>
{%endif %}
{% endblock %} {% endblock %}
{% block base_content %}{{block.super}} {% block base_content %}{{block.super}}

11
templates/compilacao/text_list.html

@ -20,15 +20,16 @@
<dd><a href="{% url 'ta_text_edit' object.pk %}" class="button secondary">{% trans 'Edição' %}</a></dd> <dd><a href="{% url 'ta_text_edit' object.pk %}" class="button secondary">{% trans 'Edição' %}</a></dd>
{% endblock %} {% endblock %}
{% block base_content %}{{block.super}}
{% block actions %}{% endblock %} {% block actions %}{% endblock %}
{% block base_content %}{{block.super}}
<div class="cp"> <div class="cp">
{% if object_list %} {% if object_list %}
<div style="float: right; clear:right;"> <ul class="button-group right">
<a id="btn_font_menos" title="Diminuir tamanho da letra">a</a> <li><a class="button tiny" id="btn_font_menos" title="Diminuir tamanho da letra">a</a></li>
<a id="btn_font_mais" title="Aumentar tamanho da Letra">A</a> <li><a class="button tiny" id="btn_font_mais" title="Aumentar tamanho da Letra">A</a></li>
</div> </ul>
{% endif %} {% endif %}
{% for key, values in view.get_vigencias.items %} {% for key, values in view.get_vigencias.items %}

5
templates/compilacao/text_list_bloco.html

@ -13,7 +13,7 @@
{% if forloop.first and view|isinst:'DispositivoView' %} {% if forloop.first and view|isinst:'DispositivoView' %}
{% else %} {% else %}
<div class="dpt {%if dpt.tipo_dispositivo.class_css == 'bloco_alteracao'%}bloco_alteracao{%endif%}"> <div class="dpt {%if dpt.tipo_dispositivo.class_css == 'bloco_alteracao'%}bloco_alteracao{%endif%}" nivel="{{dpt.nivel}}">
{% endif%} {% endif%}
{% spaceless %} {% spaceless %}
@ -28,9 +28,10 @@
</a> </a>
{% endif %} {% endif %}
{% if user.is_authenticated and not dpt.tipo_dispositivo.dispositivo_de_articulacao%} {% if user.is_authenticated and not dpt.tipo_dispositivo.dispositivo_de_articulacao%}
{% if perms.compilacao.add_nota or perms.compilacao.add_vide %} {% if perms.compilacao.add_nota or perms.compilacao.add_vide or perms.compilacao.change_dispositivo%}
<div class="dne" id="dne{{dpt.pk}}" pk="{{dpt.pk}}">{# TODO: User - dne - Dispostivo Nota Editor - tratar permissão de usuário#} <div class="dne" id="dne{{dpt.pk}}" pk="{{dpt.pk}}">{# TODO: User - dne - Dispostivo Nota Editor - tratar permissão de usuário#}
<ul class="btns-action"> <ul class="btns-action">
{% if perms.compilacao.change_dispositivo %}<li><a href = "{% url 'ta_text_edit' dpt.ta.pk%}#{{dpt.pk}}" class="btn-action" title="{% trans 'Editar Dispositivo'%}">Ed</a></li>{% endif %}
{% if perms.compilacao.add_nota %}<li><a class="btn-action btn-nota-create" model="nota" pk="{{dpt.pk}}" title="{% trans 'Adicionar Nota'%}">N</a></li>{% endif %} {% if perms.compilacao.add_nota %}<li><a class="btn-action btn-nota-create" model="nota" pk="{{dpt.pk}}" title="{% trans 'Adicionar Nota'%}">N</a></li>{% endif %}
{% if perms.compilacao.add_vide %}<li><a class="btn-action btn-vide-create" model="vide" pk="{{dpt.pk}}" title="{% trans 'Adicionar Vide'%}">V</a></li>{% endif %} {% if perms.compilacao.add_vide %}<li><a class="btn-action btn-vide-create" model="vide" pk="{{dpt.pk}}" title="{% trans 'Adicionar Vide'%}">V</a></li>{% endif %}
</ul> </ul>

3
templates/compilacao/text_list_blocoalteracao.html

@ -1,8 +1,9 @@
{% load compilacao_filters %} {% load compilacao_filters %}
<i class="fa fa-quote-left fa-2x fa-pull-left fa-border"></i>
{% for ch in dpt.pk|get_bloco_atualizador %} {% for ch in dpt.pk|get_bloco_atualizador %}
{% spaceless %} {% spaceless %}
{% if ch.visibilidade %} {% if ch.visibilidade %}
<div class="dpt" id="d{{ch.id}}"> <div class="dpt" id="d{{ch.id}}" nivel="{{ch.nivel}}">
<div class="{{ ch.tipo_dispositivo.class_css }}" id="id{{ch.id}}" nivel="{{ch.nivel}}"> <div class="{{ ch.tipo_dispositivo.class_css }}" id="id{{ch.id}}" nivel="{{ch.nivel}}">
{{ ch.tipo_dispositivo.rotulo_prefixo_html|safe }}<a name="{{ch.pk}}" href="{%url 'ta_text' ch.ta.pk %}#{{ch.pk}}">{{ ch.rotulo }}</a>{{ ch.tipo_dispositivo.rotulo_sufixo_html|safe }}{{ ch.tipo_dispositivo.texto_prefixo_html|safe }}{{ ch.texto|safe }} {{ ch.tipo_dispositivo.rotulo_prefixo_html|safe }}<a name="{{ch.pk}}" href="{%url 'ta_text' ch.ta.pk %}#{{ch.pk}}">{{ ch.rotulo }}</a>{{ ch.tipo_dispositivo.rotulo_sufixo_html|safe }}{{ ch.tipo_dispositivo.texto_prefixo_html|safe }}{{ ch.texto|safe }}
</div> </div>

31
templates/compilacao/textoarticulado_detail.html

@ -3,10 +3,19 @@
{% block base_content %} {# FIXME is this the best markup to use? #} {% block base_content %} {# FIXME is this the best markup to use? #}
<div class="clearfix"> <div class="clearfix">
{% block actions %} {% block actions %}
<dl class="sub-nav right"> <ul class="button-group right">
<dd><a href="{% url 'ta_edit' object.pk %}" class="button">{% trans 'Edição dos Metadados do Texto Articulado' %}</a></dd> <li><a href="{% url 'ta_edit' object.pk %}" class="button tiny">{% trans 'Edição dos Metadados do Texto Articulado' %}</a></li>
<dd><a href="{% url 'ta_delete' object.pk %}" class="button alert">{% trans 'Excluir' %}</a></dd> <li><a href="{% url 'ta_delete' object.pk %}" class="button alert tiny">{% trans 'Excluir' %}</a></li>
</dl> <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 '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></li>
</ul>
{% endblock actions %} {% endblock actions %}
<dl class="sub-nav left"> <dl class="sub-nav left">
{% block sections_nav %} {% block sections_nav %}
@ -15,6 +24,8 @@
{%else%} {%else%}
<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="{% url 'ta_text' object.pk %}" class="button secondary">{% trans 'Texto' %}</a></dd>
{% endblock %} {% endblock %}
</dl> </dl>
</div> </div>
@ -27,7 +38,7 @@
<div class="columns large-3"> <div class="columns large-3">
<div id="div_id_tipo" class="holder"> <div id="div_id_tipo" class="holder">
<label>{% verbose_name object 'tipo_ta' %}</label> <label>{% field_verbose_name object 'tipo_ta' %}</label>
<p>{{ object.tipo_ta}}</p> <p>{{ object.tipo_ta}}</p>
</div> </div>
</div> </div>
@ -35,7 +46,7 @@
{% if object.content_object and object.content_object.tipo%} {% if object.content_object and object.content_object.tipo%}
<div class="columns large-3"> <div class="columns large-3">
<div id="div_id_tipo" class="holder"> <div id="div_id_tipo" class="holder">
<label>{% verbose_name object.content_object 'tipo' %}</label> <label>{% field_verbose_name object.content_object 'tipo' %}</label>
<p>{{ object.content_object.tipo}}</p> <p>{{ object.content_object.tipo}}</p>
</div> </div>
</div> </div>
@ -43,21 +54,21 @@
<div class="columns large-2"> <div class="columns large-2">
<div id="div_id_numero" class="holder"> <div id="div_id_numero" class="holder">
<label>{% verbose_name object 'numero' %}</label> <label>{% field_verbose_name object 'numero' %}</label>
<p>{{ object.numero}}</p> <p>{{ object.numero}}</p>
</div> </div>
</div> </div>
<div class="columns large-2"> <div class="columns large-2">
<div id="div_id_ano" class="holder"> <div id="div_id_ano" class="holder">
<label>{% verbose_name object 'ano' %}</label> <label>{% field_verbose_name object 'ano' %}</label>
<p>{{ object.ano}}</p> <p>{{ object.ano}}</p>
</div> </div>
</div> </div>
<div class="columns large-2"> <div class="columns large-2">
<div id="div_id_data" class="holder"> <div id="div_id_data" class="holder">
<label>{% verbose_name object 'data' %}</label> <label>{% field_verbose_name object 'data' %}</label>
<p>{{ object.data}}</p> <p>{{ object.data}}</p>
</div> </div>
</div> </div>
@ -66,7 +77,7 @@
<div class="row"> <div class="row">
<div class="columns large-12"> <div class="columns large-12">
<div id="div_id_ementa" class="holder"> <div id="div_id_ementa" class="holder">
<label>{% verbose_name object 'ementa' %}</label> <label>{% field_verbose_name object 'ementa' %}</label>
<p>{{ object.ementa|safe}}</p> <p>{{ object.ementa|safe}}</p>
</div> </div>
</div> </div>

21
templates/compilacao/textoarticulado_list.html

@ -1,15 +1,32 @@
{% extends "base.html" %} {% load i18n %} {% block base_content %} {% extends "base.html" %}
{% load i18n %}
{% load compilacao_filters %}
{% block base_content %}
{# FIXME is this the best markup to use? #} {# 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 '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>
<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 %}
</dl> </dl>
<table class="table table-hover"> <table class="table table-hover">

1
templates/index.html

@ -4,4 +4,3 @@
{% block title%} {% block title%}
<h1>Bem-vindo ao SAPL!</h1> <h1>Bem-vindo ao SAPL!</h1>
{% endblock %} {% endblock %}

Loading…
Cancel
Save