kopia lustrzana https://github.com/wagtail/wagtail
replace ajax_pagination_nav with pagination_nav
rodzic
cb661a0d0b
commit
d69f73aa37
|
@ -43,9 +43,8 @@ const TASK_CHOOSER_MODAL_ONLOAD_HANDLERS = {
|
|||
|
||||
// eslint-disable-next-line func-names
|
||||
$('.pagination a', context).on('click', function () {
|
||||
const page = this.getAttribute('data-page');
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
setPage(page);
|
||||
fetchResults(this.href);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
@ -58,14 +57,10 @@ const TASK_CHOOSER_MODAL_ONLOAD_HANDLERS = {
|
|||
|
||||
const searchUrl = $('form.task-search', modal.body).attr('action');
|
||||
let request;
|
||||
function search() {
|
||||
request = $.ajax({
|
||||
url: searchUrl,
|
||||
data: {
|
||||
// eslint-disable-next-line id-length
|
||||
q: $('#id_q').val(),
|
||||
task_type: $('#id_task_type').val(),
|
||||
},
|
||||
|
||||
function fetchResults(url, requestData) {
|
||||
var opts = {
|
||||
url: url,
|
||||
success(data) {
|
||||
request = null;
|
||||
$('#search-results').html(data);
|
||||
|
@ -73,32 +68,19 @@ const TASK_CHOOSER_MODAL_ONLOAD_HANDLERS = {
|
|||
},
|
||||
error() {
|
||||
request = null;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
function setPage(page) {
|
||||
let dataObj;
|
||||
|
||||
if ($('#id_q').val().length) {
|
||||
// eslint-disable-next-line id-length
|
||||
dataObj = { q: $('#id_q').val(), p: page };
|
||||
} else {
|
||||
// eslint-disable-next-line id-length
|
||||
dataObj = { p: page };
|
||||
},
|
||||
};
|
||||
if (requestData) {
|
||||
opts.data = requestData;
|
||||
}
|
||||
request = $.ajax(opts);
|
||||
}
|
||||
|
||||
request = $.ajax({
|
||||
url: searchUrl,
|
||||
data: dataObj,
|
||||
success(data) {
|
||||
request = null;
|
||||
$('#search-results').html(data);
|
||||
ajaxifyLinks($('#search-results'));
|
||||
},
|
||||
error() {
|
||||
request = null;
|
||||
}
|
||||
function search() {
|
||||
fetchResults(searchUrl, {
|
||||
// eslint-disable-next-line id-length
|
||||
q: $('#id_q').val(),
|
||||
task_type: $('#id_task_type').val(),
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{# DEPRECATED. Use pagination_nav.html with meaningful URLs instead #}
|
||||
{% load i18n %}
|
||||
{% load wagtailadmin_tags %}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
{% include "wagtailadmin/shared/ajax_pagination_nav.html" with items=tasks %}
|
||||
{% include "wagtailadmin/shared/pagination_nav.html" with items=tasks linkurl='wagtailadmin_workflows:task_chooser_results' %}
|
||||
{% else %}
|
||||
{% if all_tasks.exists %}
|
||||
<p role="alert">{% blocktrans %}Sorry, no tasks match "<em>{{ query_string }}</em>"{% endblocktrans %}</p>
|
||||
|
|
Ładowanie…
Reference in New Issue