diff --git a/sapl/sessao/urls.py b/sapl/sessao/urls.py index 16231d881..e5932af0b 100644 --- a/sapl/sessao/urls.py +++ b/sapl/sessao/urls.py @@ -21,7 +21,7 @@ from sapl.sessao.views import (AdicionarVariasMateriasExpediente, abrir_votacao_expediente_view, abrir_votacao_ordem_view, reordernar_materias_expediente, - reordernar_materias_ordem) + reordernar_materias_ordem, recuperar_materia) from .apps import AppConfig @@ -37,6 +37,9 @@ urlpatterns = [ ExpedienteMateriaCrud.get_urls() + MateriaOrdemDiaCrud.get_urls())), + + url(r'^recuperar_materia/', recuperar_materia, name="recuperar_materia"), + url(r'^(?P\d+)/(?P\d+)/abrir-votacao-expediente$', abrir_votacao_expediente_view, name="abrir_votacao_exp"), diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index fdc1959ed..091a05021 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -6,6 +6,7 @@ from django.contrib.auth.mixins import PermissionRequiredMixin from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.core.urlresolvers import reverse from django.forms.utils import ErrorList +from django.http import HttpResponse, JsonResponse from django.http.response import HttpResponseRedirect from django.utils.datastructures import MultiValueDictKeyError from django.utils.html import strip_tags @@ -20,7 +21,8 @@ from sapl.crud.base import (Crud, CrudBaseMixin, CrudCreateView, CrudUpdateView, make_pagination) from sapl.crud.masterdetail import MasterDetailCrud from sapl.materia.forms import pega_ultima_tramitacao -from sapl.materia.models import Autoria, DocumentoAcessorio, Tramitacao +from sapl.materia.models import (Autoria, DocumentoAcessorio, + TipoMateriaLegislativa, Tramitacao) from sapl.materia.views import MateriaLegislativaPesquisaView from sapl.norma.models import NormaJuridica from sapl.parlamentares.models import Parlamentar @@ -275,6 +277,23 @@ class MateriaOrdemDiaCrud(MasterDetailCrud): return [self._as_row(obj) for obj in object_list] +def recuperar_materia(request): + tipo = TipoMateriaLegislativa.objects.get(pk=request.GET['tipo_materia']) + numero = request.GET['numero_materia'] + ano = request.GET['ano_materia'] + + try: + materia = MateriaLegislativa.objects.get(tipo=tipo, + ano=ano, + numero=numero) + response = JsonResponse({'ementa': materia.ementa, + 'id': materia.id}) + except ObjectDoesNotExist: + response = JsonResponse({'ementa': '', 'id': 0}) + + return response + + class ExpedienteMateriaCrud(MasterDetailCrud): model = ExpedienteMateria parent_field = 'sessao_plenaria' diff --git a/sapl/static/js/app.js b/sapl/static/js/app.js index 127bf2b86..b9d4d08f8 100644 --- a/sapl/static/js/app.js +++ b/sapl/static/js/app.js @@ -13,7 +13,9 @@ function initTinymce(elements, readonly=false) { } if (readonly) { - config_tinymce.readonly = 1 + config_tinymce.readonly = 1, + config_tinymce.menubar = false, + config_tinymce.toolbar = false } if (elements != null) { diff --git a/sapl/templates/sessao/expediente.html b/sapl/templates/sessao/expediente.html index 66aacb226..981b71cd8 100644 --- a/sapl/templates/sessao/expediente.html +++ b/sapl/templates/sessao/expediente.html @@ -35,7 +35,7 @@ {% endif %} {% endblock detail_content %} - + {% block extra_js %} {% if perms|get_add_perm:view %} + +{% endblock %} diff --git a/sapl/templates/sessao/ordemdia_form.html b/sapl/templates/sessao/ordemdia_form.html new file mode 100644 index 000000000..dbb2739c8 --- /dev/null +++ b/sapl/templates/sessao/ordemdia_form.html @@ -0,0 +1,4 @@ +{% extends "sessao/expedientemateria_form.html" %} +{% load i18n %} +{% load crispy_forms_tags %} +{% load common_tags %}