Dodano możliwość wprowadzania numeru strony w paginacji oraz poprawiono style dla elementów paginacji.

This commit is contained in:
2024-12-25 11:54:55 +01:00
parent 2cf3eb683a
commit 4d322eebeb
4 changed files with 29 additions and 3 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -2219,4 +2219,13 @@ textarea.form-control {
#g-list {
margin-bottom: 15px !important;
}
.pagination {
input[type="number"] {
border: 1px solid #dddddd;
height: 31px;
width: 50px;
text-align: center;
}
}

View File

@@ -63,7 +63,7 @@
</li>
<li>
<div>
Strona <span id="current-page"><?= $this -> current_page;?></span> z <span id="max_page"><?= $this -> pagination_max;?></span>
Strona <input type="number" id="current-page" value="<?= $this -> current_page;?>"> z <span id="max_page"><?= $this -> pagination_max;?></span>
</div>
</li>
<li>
@@ -92,6 +92,23 @@
ajax_load_products( 1 );
});
$( 'body' ).on( 'change', '.pagination input[type="number"]', function() {
var current_page = $( this ).val();
var pagination_max = parseInt( $( '.pagination' ).attr( 'pagination_max' ) );
if ( current_page > pagination_max ) {
current_page = pagination_max;
$( this ).val( current_page );
}
if ( current_page < 1 ) {
current_page = 1;
$( this ).val( current_page );
}
ajax_load_products( current_page );
});
$( 'body' ).on( 'click', '.pagination a', function() {
var current_page = $( this ).attr( 'page' );
ajax_load_products( current_page );