Dodanie paginacji z możliwością wprowadzania numeru strony w formacie input oraz poprawa stylów dla elementów paginacji
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -2219,4 +2219,13 @@ textarea.form-control {
|
|||||||
|
|
||||||
#g-list {
|
#g-list {
|
||||||
margin-bottom: 15px !important;
|
margin-bottom: 15px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination {
|
||||||
|
input[type="number"] {
|
||||||
|
border: 1px solid #dddddd;
|
||||||
|
height: 31px;
|
||||||
|
width: 50px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div>
|
<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>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@@ -92,6 +92,23 @@
|
|||||||
ajax_load_products( 1 );
|
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() {
|
$( 'body' ).on( 'click', '.pagination a', function() {
|
||||||
var current_page = $( this ).attr( 'page' );
|
var current_page = $( this ).attr( 'page' );
|
||||||
ajax_load_products( current_page );
|
ajax_load_products( current_page );
|
||||||
|
|||||||
Reference in New Issue
Block a user