From 8d173fcae98bb3328c2090894e9ef93a14dc8728 Mon Sep 17 00:00:00 2001 From: Edward Date: Tue, 13 Jun 2017 15:14:59 -0300 Subject: [PATCH] =?UTF-8?q?Permite=20a=20adi=C3=A7=C3=A3o=20de=20uma=20que?= =?UTF-8?q?ry=20param=20=3Fiframe=20para=20tirar=20adornos.=20(#1191)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Permite a adição de uma query param ?iframe para tirar adornos. * Muda setting para ?iframe=0 (desativa) e ?iframe=1 (ativa) Fixes #1189 --- sapl/base/templatetags/common_tags.py | 17 +++++++++++++++++ sapl/templates/base.html | 6 ++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/sapl/base/templatetags/common_tags.py b/sapl/base/templatetags/common_tags.py index 419899632..eb53629a0 100644 --- a/sapl/base/templatetags/common_tags.py +++ b/sapl/base/templatetags/common_tags.py @@ -117,6 +117,23 @@ def str2intabs(value): except: return '' +@register.filter +def has_iframe(request): + + iframe = request.session.get('iframe', False) + if not iframe and 'iframe' in request.GET: + ival = request.GET['iframe'] + if ival and int(ival) == 1: + request.session['iframe'] = True + return True + elif 'iframe' in request.GET: + ival = request.GET['iframe'] + if ival and int(ival) == 0: + del request.session['iframe'] + return False + + return iframe + @register.filter def url(value): diff --git a/sapl/templates/base.html b/sapl/templates/base.html index 88b877016..9feb3d90f 100644 --- a/sapl/templates/base.html +++ b/sapl/templates/base.html @@ -28,6 +28,7 @@
+ {% if not request|has_iframe %} {% block navigation %} {% endblock navigation %} + {% endif %} {# Header #} {% block main_header %} @@ -108,7 +110,6 @@ {# Main content #} {% block content_container %}
-
{# Feedback messages #} @@ -152,7 +153,7 @@ {% endblock content_container %} - + {% if not request|has_iframe %} {% block footer_container %}
@@ -209,6 +210,7 @@
{% endblock footer_container %} + {% endif %} {% block foot_js %}