From f694301baa2a1ed2e0a711f531bf74a4577ac9e8 Mon Sep 17 00:00:00 2001 From: LeandroRoberto Date: Thu, 6 Oct 2016 10:19:36 -0300 Subject: [PATCH] =?UTF-8?q?Add=20config=20de=20ativa=C3=A7=C3=A3o=20de=20T?= =?UTF-8?q?extos=20articulados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/base/forms.py | 7 +++-- .../migrations/0020_auto_20161006_0950.py | 30 +++++++++++++++++++ .../migrations/0021_auto_20161006_1019.py | 20 +++++++++++++ sapl/base/models.py | 15 +++++++++- sapl/templates/base/layouts.yaml | 2 ++ sapl/templates/materia/subnav.yaml | 4 ++- sapl/templates/norma/subnav.yaml | 4 ++- 7 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 sapl/base/migrations/0020_auto_20161006_0950.py create mode 100644 sapl/base/migrations/0021_auto_20161006_1019.py diff --git a/sapl/base/forms.py b/sapl/base/forms.py index 4334f7e94..605d23b84 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -1,4 +1,3 @@ -import django_filters from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML, Button, Fieldset, Layout from django import forms @@ -7,6 +6,7 @@ from django.core.exceptions import ValidationError from django.db import models from django.forms import ModelForm from django.utils.translation import ugettext_lazy as _ +import django_filters from sapl.crispy_layout_mixin import form_actions, to_row from sapl.materia.models import MateriaLegislativa @@ -272,4 +272,7 @@ class ConfiguracoesAppForm(ModelForm): model = AppConfig fields = ['documentos_administrativos', 'sequencia_numeracao', - 'painel_aberto'] + 'painel_aberto', + 'texto_articulado_proposicao', + 'texto_articulado_materia', + 'texto_articulado_norma'] diff --git a/sapl/base/migrations/0020_auto_20161006_0950.py b/sapl/base/migrations/0020_auto_20161006_0950.py new file mode 100644 index 000000000..71f9f9a6b --- /dev/null +++ b/sapl/base/migrations/0020_auto_20161006_0950.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-10-06 12:50 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0019_auto_20160928_1951'), + ] + + operations = [ + migrations.AddField( + model_name='appconfig', + name='texto_articulado_materia', + field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Usar Textos Articulados para Matérias'), + ), + migrations.AddField( + model_name='appconfig', + name='texto_articulado_norma', + field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Usar Textos Articulados para Normas'), + ), + migrations.AddField( + model_name='appconfig', + name='texto_articulado_proposicao', + field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Usar Textos Articulados para Proposições'), + ), + ] diff --git a/sapl/base/migrations/0021_auto_20161006_1019.py b/sapl/base/migrations/0021_auto_20161006_1019.py new file mode 100644 index 000000000..107cca4d4 --- /dev/null +++ b/sapl/base/migrations/0021_auto_20161006_1019.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-10-06 13:19 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0020_auto_20161006_0950'), + ] + + operations = [ + migrations.AlterField( + model_name='appconfig', + name='texto_articulado_norma', + field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=True, verbose_name='Usar Textos Articulados para Normas'), + ), + ] diff --git a/sapl/base/models.py b/sapl/base/models.py index 71f2634fe..1762aaa0a 100644 --- a/sapl/base/models.py +++ b/sapl/base/models.py @@ -7,11 +7,12 @@ from django.contrib.contenttypes.models import ContentType from django.core import exceptions from django.db import models, router from django.db.utils import DEFAULT_DB_ALIAS -from django.utils.translation import ugettext_lazy as _ from django.utils.translation import string_concat +from django.utils.translation import ugettext_lazy as _ from sapl.utils import UF, YES_NO_CHOICES + TIPO_DOCUMENTO_ADMINISTRATIVO = (('O', _('Ostensivo')), ('R', _('Restritivo'))) @@ -98,6 +99,18 @@ class AppConfig(models.Model): verbose_name=_('Painel aberto para usuário anônimo'), choices=YES_NO_CHOICES, default=False) + texto_articulado_proposicao = models.BooleanField( + verbose_name=_('Usar Textos Articulados para Proposições'), + choices=YES_NO_CHOICES, default=False) + + texto_articulado_materia = models.BooleanField( + verbose_name=_('Usar Textos Articulados para Matérias'), + choices=YES_NO_CHOICES, default=False) + + texto_articulado_norma = models.BooleanField( + verbose_name=_('Usar Textos Articulados para Normas'), + choices=YES_NO_CHOICES, default=True) + class Meta: verbose_name = _('Configurações da Aplicação') verbose_name_plural = _('Configurações da Aplicação') diff --git a/sapl/templates/base/layouts.yaml b/sapl/templates/base/layouts.yaml index ebe0abc8b..b657d4b79 100644 --- a/sapl/templates/base/layouts.yaml +++ b/sapl/templates/base/layouts.yaml @@ -13,3 +13,5 @@ CasaLegislativa: AppConfig: {% trans 'Configurações da Aplicação' %}: - documentos_administrativos sequencia_numeracao painel_aberto + {% trans 'Textos Articulados' %}: + - texto_articulado_proposicao texto_articulado_materia texto_articulado_norma diff --git a/sapl/templates/materia/subnav.yaml b/sapl/templates/materia/subnav.yaml index dbbf8eddf..d59930cc4 100644 --- a/sapl/templates/materia/subnav.yaml +++ b/sapl/templates/materia/subnav.yaml @@ -1,4 +1,4 @@ -{% load i18n %} +{% load i18n common_tags %} - title: {% trans 'Início' %} url: materialegislativa_detail - title: {% trans 'Anexada' %} @@ -18,5 +18,7 @@ url: tramitacao_list - title: {% trans 'Relatoria' %} url: relatoria_list +{% if 'texto_articulado_materia'|get_config_attr %} - title: {% trans 'Texto' %} url: materia_ta +{% endif %} diff --git a/sapl/templates/norma/subnav.yaml b/sapl/templates/norma/subnav.yaml index 7704bfeb9..d35607335 100644 --- a/sapl/templates/norma/subnav.yaml +++ b/sapl/templates/norma/subnav.yaml @@ -1,4 +1,4 @@ -{% load i18n %} +{% load i18n common_tags%} - title: {% trans 'Início' %} url: normajuridica_detail @@ -6,5 +6,7 @@ # para integração foram necessárias apenas criar a url norma_ta em urls.py # e a view NormaTaView(IntegracaoTaView) em views.py # Em nada mais a integração interfere em NormaJuridica +{% if 'texto_articulado_norma'|get_config_attr %} - title: {% trans 'Texto' %} url: norma_ta +{% endif %}