Skip to content
Snippets Groups Projects
Verified Commit 3860ea0e authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[TASK] Remove inline code from pagination

parent 79ead314
No related branches found
No related tags found
1 merge request!45Cleanup backend module
......@@ -42,25 +42,16 @@
<li class="page-item">
<span class="page-link">
<f:translate key="widget.pagination.page" />
<form id="paginator-form" onsubmit="goToPage(this); return false;" style="display:inline;">
<script type="text/javascript">
function goToPage(formObject) {
var page = formObject.elements['paginator-target-page'].value;
var url = '{f:uri.action(action: 'index', arguments: {currentPage: 987654321}) -> f:format.raw()}';
url = url.replace('987654321', page);
self.location.href = url;
}
</script>
<f:form.textfield id="paginator"
name="paginator-target-page"
additionalAttributes="{min: '1'}"
additionalAttributes="{
min: '1',
data-uri: '{f:uri.action(action: actionName, arguments: {currentPage: 987654321}) -> f:format.raw()}'
}"
class="form-control input-sm paginator-input"
size="5"
value="{pagination.currentPage}"
type="number" />
</form>
/ {pagination.lastPage}
</span>
</li>
......
......@@ -50,6 +50,17 @@ define([
});
});
const paginators = document.querySelectorAll('.paginator-input');
for (const paginator of paginators) {
paginator.addEventListener('keypress', (event) => {
if (event.keyCode === 13) {
event.preventDefault();
const page = event.currentTarget.value;
const url = event.currentTarget.dataset.uri;
self.location.href = url.replace('987654321', page);
}
})
}
},
/**
* Switch the page and select it in the pagetree
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment