From 65449120447f36436b32c0bd52abf5af4c445f69 Mon Sep 17 00:00:00 2001 From: KemuelAlves Date: Thu, 21 May 2026 08:43:43 -0300 Subject: [PATCH] =?UTF-8?q?Feat=20(GED):=20Configura=C3=A7=C3=A3o=20para?= =?UTF-8?q?=20apresenta=C3=A7=C3=A3o=20do=20ged=20dentro=20do=20legislativ?= =?UTF-8?q?o=20pelo=20iframe=20[AB#1326]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/context_processors.py | 6 ++++++ sapl/materia/views_ged.py | 7 +++++-- sapl/settings.py | 1 + sapl/templates/index.html | 2 ++ sapl/templates/materia/ged_historico.html | 18 ++++++++++++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/sapl/context_processors.py b/sapl/context_processors.py index 820589d30..b62c56ebc 100644 --- a/sapl/context_processors.py +++ b/sapl/context_processors.py @@ -84,6 +84,12 @@ def pendencias_assinatura(request): } +def ged_configurado(request): + """Injeta flag indicando se o GED (acervo histórico) está configurado.""" + from sapl.materia.views_ged import GED_URL + return {'ged_configurado': bool(GED_URL)} + + @cached_call("site-title", timeout=60 * 2) def enable_sapn(request): verbose_name = _('SGVP') \ diff --git a/sapl/materia/views_ged.py b/sapl/materia/views_ged.py index 2e8836f05..cc4cd567f 100644 --- a/sapl/materia/views_ged.py +++ b/sapl/materia/views_ged.py @@ -2,10 +2,12 @@ View pública para acesso ao acervo histórico via GED (sistema legado). Issue #1326 / Task #1348 – Adicionar tela do GED dentro do Legislativo. """ +from decouple import config from django.shortcuts import render from django.views.decorators.cache import cache_control -GED_URL = "https://franco-ged.up.railway.app/" +# Sem default: se GED_URL não estiver no .env, retorna string vazia. +GED_URL = config('GED_URL', default='') @cache_control(public=True, max_age=300) @@ -13,7 +15,8 @@ def ged_historico(request): """ Exibe o sistema GED (acervo histórico – matérias anteriores a 2026) incorporado em iframe. Acesso público, sem autenticação. + Se GED_URL não estiver configurado, exibe mensagem informativa. """ return render(request, 'materia/ged_historico.html', { - 'ged_url': GED_URL, + 'ged_url': GED_URL or '', }) diff --git a/sapl/settings.py b/sapl/settings.py index 3db706fa4..454c07f3c 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -235,6 +235,7 @@ TEMPLATES = [ 'sapl.context_processors.google_recaptcha_configured', 'sapl.context_processors.enable_sapn', 'sapl.context_processors.pendencias_assinatura', + 'sapl.context_processors.ged_configurado', ], 'debug': DEBUG }, diff --git a/sapl/templates/index.html b/sapl/templates/index.html index 6bb30a551..15aae85c7 100644 --- a/sapl/templates/index.html +++ b/sapl/templates/index.html @@ -156,6 +156,7 @@ + {% if ged_configurado %}
@@ -168,6 +169,7 @@
+ {% endif %}
diff --git a/sapl/templates/materia/ged_historico.html b/sapl/templates/materia/ged_historico.html index eac4189cd..40a11ff58 100644 --- a/sapl/templates/materia/ged_historico.html +++ b/sapl/templates/materia/ged_historico.html @@ -62,6 +62,7 @@ {% block footer_container %}{% endblock %} {% block content_container %} +{% if ged_url %}
@@ -130,4 +131,21 @@ frame.addEventListener('load', function () { clearTimeout(timeout); }); })(); + +{% else %} +
+ +

+ Acervo Histórico não disponível +

+

+ Esta instalação não possui proposições legadas configuradas.
+ Caso necessite acessar matérias de sistemas anteriores, entre em contato com o administrador do sistema. +

+ + Voltar à página inicial + +
+{% endif %} {% endblock content_container %}