Browse Source

Permite a adição de uma query param ?iframe para tirar adornos. (#1191)

* Permite a adição de uma query param ?iframe para tirar adornos.

* Muda setting para ?iframe=0 (desativa) e ?iframe=1 (ativa)

Fixes #1189
pull/1194/head
Edward 8 years ago
committed by GitHub
parent
commit
8d173fcae9
  1. 17
      sapl/base/templatetags/common_tags.py
  2. 6
      sapl/templates/base.html

17
sapl/base/templatetags/common_tags.py

@ -117,6 +117,23 @@ def str2intabs(value):
except: except:
return '' 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 @register.filter
def url(value): def url(value):

6
sapl/templates/base.html

@ -28,6 +28,7 @@
<body> <body>
<div class="page fadein"> <div class="page fadein">
{% if not request|has_iframe %}
{% block navigation %} {% block navigation %}
<nav class="navbar navbar-inverse navbar-static-top"> <nav class="navbar navbar-inverse navbar-static-top">
<div class="container"> <div class="container">
@ -78,6 +79,7 @@
</div> </div>
</nav> </nav>
{% endblock navigation %} {% endblock navigation %}
{% endif %}
{# Header #} {# Header #}
{% block main_header %} {% block main_header %}
@ -108,7 +110,6 @@
{# Main content #} {# Main content #}
{% block content_container %} {% block content_container %}
<main id="content" class="content page__row"> <main id="content" class="content page__row">
<div class="container"> <div class="container">
{# Feedback messages #} {# Feedback messages #}
@ -152,7 +153,7 @@
{% endblock content_container %} {% endblock content_container %}
{% if not request|has_iframe %}
{% block footer_container %} {% block footer_container %}
<footer id="footer" class="footer page__row hidden-print"> <footer id="footer" class="footer page__row hidden-print">
<div class="container"> <div class="container">
@ -209,6 +210,7 @@
</footer> </footer>
</div> </div>
{% endblock footer_container %} {% endblock footer_container %}
{% endif %}
{% block foot_js %} {% block foot_js %}
<!-- Bootstrap core JavaScript ================================================== --> <!-- Bootstrap core JavaScript ================================================== -->

Loading…
Cancel
Save