mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 08:44:49 +00:00
Merge pull request #2682 from pixelfed/staging
Update user admin, fix pagination
This commit is contained in:
commit
390c083d12
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;
|
$search = $request->has('a') && $request->query('a') == 'search' ? $request->query('q') : null;
|
||||||
$col = $request->query('col') ?? 'id';
|
$col = $request->query('col') ?? 'id';
|
||||||
$dir = $request->query('dir') ?? 'desc';
|
$dir = $request->query('dir') ?? 'desc';
|
||||||
$offset = $request->has('page') ? $request->input('page') : 1;
|
$offset = $request->has('page') ? $request->input('page') : 0;
|
||||||
$pagination = [
|
$pagination = [
|
||||||
'prev' => $offset && $offset > 1 ? $offset - 1 : null,
|
'prev' => $offset > 0 ? $offset - 1 : null,
|
||||||
'next' => $offset + 1,
|
'next' => $offset + 1,
|
||||||
'query' => $search ? '&a=search&q=' . $search : null
|
'query' => $search ? '&a=search&q=' . $search : null
|
||||||
];
|
];
|
||||||
|
@ -30,7 +30,7 @@ trait AdminUserController
|
||||||
->when($search, function($q, $search) {
|
->when($search, function($q, $search) {
|
||||||
return $q->where('username', 'like', "%{$search}%");
|
return $q->where('username', 'like', "%{$search}%");
|
||||||
})
|
})
|
||||||
->when($offset > 1, function($q, $offset) {
|
->when($offset, function($q, $offset) {
|
||||||
return $q->offset(($offset * 10));
|
return $q->offset(($offset * 10));
|
||||||
})
|
})
|
||||||
->limit(10)
|
->limit(10)
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-center mt-5 small">
|
<div class="d-flex justify-content-center mt-5 small">
|
||||||
<ul class="pagination">
|
<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>
|
<li class="page-item"><a class="page-link pagination__prev" href="?page={{$pagination['prev']}}{{$pagination['query']}}" rel="prev">« Previous</a></li>
|
||||||
@else
|
@else
|
||||||
<li class="page-item disabled"><span class="page-link" >« Previous</span></li>
|
<li class="page-item disabled"><span class="page-link" >« Previous</span></li>
|
||||||
|
|
Loading…
Reference in a new issue