Browse Source

Melhora navigator e permite x-frame-extempt

pull/160/head 3.0.20
Sesostris Vieira 2 years ago
parent
commit
278b9b3948
  1. 18
      sigi/apps/servicos/templates/servicos/navigator_snippet.html
  2. 5
      sigi/apps/servicos/views.py

18
sigi/apps/servicos/templates/servicos/navigator_snippet.html

@ -3,11 +3,23 @@
<div class="table-responsive"> <div class="table-responsive">
<nav aria-label="Page navigation"> <nav aria-label="Page navigation">
<ul class="pagination pagination-sm mt-3"> <ul class="pagination pagination-sm mt-3">
<li class="page-item{% if not page_obj.has_previous %} disabled{% endif %}"><a class="page-link" href="?page={% if page_obj.has_previous %}{{ page_obj.previous_page_number }}{% else %}1{% endif %}" aria-label="{% trans "Página anterior" %}"><i class="bi bi-chevron-double-left"></i></a></li> <li class="page-item{% if not page_obj.has_previous %} disabled{% endif %}"><a class="page-link" href="?page=1" aria-label="{% trans "Primeira página" %}" title="{% trans "Primeira página" %}"><i class="bi bi-chevron-double-left"></i></a></li>
<li class="page-item{% if not page_obj.has_previous %} disabled{% endif %}"><a class="page-link" href="?page={% if page_obj.has_previous %}{{ page_obj.previous_page_number }}{% else %}1{% endif %}" aria-label="{% trans "Página anterior" %}" title="{% trans "Página anterior" %}"><i class="bi bi-chevron-left"></i></a></li>
{% for page in paginator.page_range %} {% for page in paginator.page_range %}
<li class="page-item{% if page == page_obj.number %} active{% endif %} "><a class="page-link" href="?page={{ page }}">{{ page }}</a></li> {% with minor=page_obj.number|add:"-3" major=page_obj.number|add:"3" %}
{% if page == minor and minor > 1 %}
<li class="page-item disabled"><p class="page-link" >...</p></li>
{% endif %}
{% if page > minor and page < major %}
<li class="page-item{% if page == page_obj.number %} active{% endif %} "><a class="page-link" href="?page={{ page }}">{{ page }}</a></li>
{% endif %}
{% if page == major and major < page_obj.paginator.num_pages %}
<li class="page-item disabled"><p class="page-link" >...</p></li>
{% endif %}
{% endwith %}
{% endfor %} {% endfor %}
<li class="page-item{% if not page_obj.has_next %} disabled{% endif %}"><a class="page-link" href="?page={% if page_obj.has_next %}{{ page_obj.next_page_number }}{% else %}1{% endif %}" aria-label="{% trans "Próxima página" %}"><i class="bi bi-chevron-double-right"></i></a></li> <li class="page-item{% if not page_obj.has_next %} disabled{% endif %}"><a class="page-link" href="?page={% if page_obj.has_next %}{{ page_obj.next_page_number }}{% else %}{{ page_obj.paginator.num_pages }}{% endif %}" aria-label="{% trans "Próxima página" %}" title="{% trans "Próxima página" %}"><i class="bi bi-chevron-right"></i></a></li>
<li class="page-item{% if not page_obj.has_next %} disabled{% endif %}"><a class="page-link" href="?page={{ page_obj.paginator.num_pages }}" aria-label="{% trans "Última página" %}" title="{% trans "Última página" %}"><i class="bi bi-chevron-double-right"></i></a></li>
</ul> </ul>
</nav> </nav>
</div> </div>

5
sigi/apps/servicos/views.py

@ -3,6 +3,7 @@ from django.db.models import Q
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import render from django.shortcuts import render
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from django.views.decorators.clickjacking import xframe_options_exempt
from django.views.generic import ListView from django.views.generic import ListView
from import_export import resources from import_export import resources
from import_export.fields import Field from import_export.fields import Field
@ -111,3 +112,7 @@ class CasasAtendidasListView(ListView):
}, },
) )
return super().render_to_response(context, **response_kwargs) return super().render_to_response(context, **response_kwargs)
@xframe_options_exempt
def dispatch(self, *args, **kwargs):
return super().dispatch(*args, **kwargs)

Loading…
Cancel
Save