mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Update user admin, fix pagination
This commit is contained in:
parent
53042d295e
commit
43201a70e6
2 changed files with 4 additions and 4 deletions
|
@ -19,9 +19,9 @@ trait AdminUserController
|
|||
$search = $request->has('a') && $request->query('a') == 'search' ? $request->query('q') : null;
|
||||
$col = $request->query('col') ?? 'id';
|
||||
$dir = $request->query('dir') ?? 'desc';
|
||||
$offset = $request->has('page') ? $request->input('page') : 1;
|
||||
$offset = $request->has('page') ? $request->input('page') : 0;
|
||||
$pagination = [
|
||||
'prev' => $offset && $offset > 1 ? $offset - 1 : null,
|
||||
'prev' => $offset > 0 ? $offset - 1 : null,
|
||||
'next' => $offset + 1,
|
||||
'query' => $search ? '&a=search&q=' . $search : null
|
||||
];
|
||||
|
@ -30,7 +30,7 @@ trait AdminUserController
|
|||
->when($search, function($q, $search) {
|
||||
return $q->where('username', 'like', "%{$search}%");
|
||||
})
|
||||
->when($offset > 1, function($q, $offset) {
|
||||
->when($offset, function($q, $offset) {
|
||||
return $q->offset(($offset * 10));
|
||||
})
|
||||
->limit(10)
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
</div>
|
||||
<div class="d-flex justify-content-center mt-5 small">
|
||||
<ul class="pagination">
|
||||
@if($pagination['prev'])
|
||||
@if($pagination['prev'] !== null || $pagination['prev'] == 1)
|
||||
<li class="page-item"><a class="page-link pagination__prev" href="?page={{$pagination['prev']}}{{$pagination['query']}}" rel="prev">« Previous</a></li>
|
||||
@else
|
||||
<li class="page-item disabled"><span class="page-link" >« Previous</span></li>
|
||||
|
|
Loading…
Reference in a new issue