mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Paginator: Add options for advanced users in backend (#3697)
* Paginator: Add options for advanced users in backend * Update src/pretix/static/pretixcontrol/js/ui/main.js Co-authored-by: Richard Schreiber <schreiber@rami.io> * Update src/pretix/static/pretixcontrol/js/ui/main.js Co-authored-by: Richard Schreiber <schreiber@rami.io> * Add clickability --------- Co-authored-by: Richard Schreiber <schreiber@rami.io>
This commit is contained in:
@@ -6,26 +6,48 @@
|
|||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
{% if is_paginated %}
|
{% if is_paginated %}
|
||||||
{% if page_obj.has_previous %}
|
{% if page_obj.has_previous %}
|
||||||
|
{% if page_obj.previous_page_number > 1 %}
|
||||||
|
<li>
|
||||||
|
<a href="?{% url_replace request 'page' page_obj.num_pages %}" title="{% trans "Go to page 1" %}">
|
||||||
|
<span class="fa fa-angle-double-left"></span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
<li>
|
<li>
|
||||||
<a href="?{% url_replace request 'page' page_obj.previous_page_number %}">
|
<a href="?{% url_replace request 'page' page_obj.previous_page_number %}" title="{% blocktrans with page=page_obj.previous_page_number %}Go to page {{ page }}{% endblocktrans %}">
|
||||||
<span>«</span>
|
<span class="fa fa-angle-left"></span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="page-current"><a>
|
<li class="page-current">
|
||||||
|
<a {% if page_obj.paginator.count %}
|
||||||
|
class="pagination-selection"
|
||||||
|
data-href="?{% url_replace request 'page' '_PAGE_' %}"
|
||||||
|
data-max="{{ page_obj.paginator.num_pages }}"
|
||||||
|
title="{% trans "Click to choose a page" %}"
|
||||||
|
href="#"
|
||||||
|
{% endif %}>
|
||||||
{% blocktrans trimmed with page=page_obj.number of=page_obj.paginator.num_pages count=page_obj.paginator.count|intcomma %}
|
{% blocktrans trimmed with page=page_obj.number of=page_obj.paginator.num_pages count=page_obj.paginator.count|intcomma %}
|
||||||
Page {{ page }} of {{ of }} ({{ count }} elements)
|
Page {{ page }} of {{ of }} ({{ count }} elements)
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
</a></li>
|
</a>
|
||||||
|
</li>
|
||||||
{% if page_obj.has_next %}
|
{% if page_obj.has_next %}
|
||||||
<li>
|
<li>
|
||||||
<a href="?{% url_replace request 'page' page_obj.next_page_number %}">
|
<a href="?{% url_replace request 'page' page_obj.next_page_number %}" title="{% blocktrans with page=page_obj.next_page_number %}Go to page {{ page }}{% endblocktrans %}">
|
||||||
<span>»</span>
|
<span class="fa fa-angle-right"></span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if page_obj.paginator.count and page_obj.paginator.num_pages > page_obj.next_page_number %}
|
||||||
|
<li>
|
||||||
|
<a href="?{% url_replace request 'page' page_obj.paginator.num_pages %}" title="{% blocktrans with page=page_obj.paginator.num_pages %}Go to page {{ page }}{% endblocktrans %}">
|
||||||
|
<span class="fa fa-angle-double-right"></span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if page_obj.paginator.count > 1 %}
|
{% if page_obj.paginator.count > 1 %}
|
||||||
<li class="page-current"><a>
|
<li class="page-current"><a>
|
||||||
{% blocktrans trimmed with count=page_obj.paginator.count|intcomma %}
|
{% blocktrans trimmed with count=page_obj.paginator.count|intcomma %}
|
||||||
{{ count }} elements
|
{{ count }} elements
|
||||||
|
|||||||
@@ -772,6 +772,19 @@ function setup_basics(el) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
el.find('a.pagination-selection').click(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var max = parseInt($(this).data("max"))
|
||||||
|
var inp = prompt(gettext("Enter page number between 1 and %(max)s.").replace("%(max)s", max));
|
||||||
|
if (inp) {
|
||||||
|
if (!parseInt(inp) || parseInt(inp) < 1 || parseInt(inp) > max) {
|
||||||
|
alert(gettext("Invalid page number."));
|
||||||
|
} else {
|
||||||
|
location.href = $(this).attr("data-href").replace("_PAGE_", inp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var url = document.location.toString();
|
var url = document.location.toString();
|
||||||
if (url.match('#')) {
|
if (url.match('#')) {
|
||||||
$('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
|
$('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
|
||||||
|
|||||||
Reference in New Issue
Block a user