Skip to content

Commit 8038d77

Browse files
Improve pagination
1 parent 72a1219 commit 8038d77

File tree

6 files changed

+66
-93
lines changed

6 files changed

+66
-93
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ The main reasoning behind this choice is the software is not built to be extende
2424
- Added a new configuration option to set URLs used throughout the interface (MediaWiki API, CentralAuth, Privacy Policy, Terms of Use, and Miraheze Meta).
2525
- Added `Special:MyLanguage` to Miraheze Meta and Policy URLs.
2626
- Added a new configuration option, `app.dpaUsernamePrefix` to set the DPA username prefix.
27+
- Added pagination for users on the top of the table as well.
2728

2829
### Fixed
2930

@@ -40,6 +41,7 @@ The main reasoning behind this choice is the software is not built to be extende
4041
- Changed sidebar navigation to be collapsed by default on mobile.
4142
- Changed sidebar handling to save and restore the state if collapsed on desktop.
4243
- Changed MirahezeUsernameRule to MediaWikiUsernameRule.
44+
- Changed to numbered pagination for IAL and Users.
4345
- Upgraded external libraries:
4446
- Upgraded laravel/framework from 13.1.1 to 13.2.0.
4547
- Upgraded laravel/socialite from 5.25.0 to 5.26.0.

app/Http/Controllers/IALController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class IALController
2525
*/
2626
public function index( Request $request ): View
2727
{
28-
$query = IAL::latest( 'id' )->cursorPaginate( 25 );
28+
$query = IAL::latest( 'id' )->paginate( 25 );
2929
return view( 'ial' )->with( 'ials', $query );
3030
}
3131

app/Http/Controllers/UserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class UserController
2121
*/
2222
public function index(): View
2323
{
24-
$query = User::cursorPaginate( 500 );
24+
$query = User::paginate( 500 );
2525
return view( 'users' )->with( 'users', $query );
2626
}
2727

resources/lang/en.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,6 @@
169169
"login": "Login with Miraheze",
170170
"login-disabled": "Login for this user account has been disabled!",
171171
"logout": "Logout",
172-
"nav-next": "Next",
173-
"nav-previous": "Previous",
174172
"no": "No",
175173
"open-appeals": "Open Appeals",
176174
"open-dpa": "Open Data Protection Requests",

resources/views/ial.blade.php

Lines changed: 37 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9,60 +9,49 @@
99
<div class="table-responsive table mt-2" id="dataTable" role="grid" aria-describedby="dataTable_info">
1010
<table class="table table-striped my-0 text-center align-middle" id="dataTable">
1111
<thead>
12-
<tr>
13-
<th style="width: 10%;">{{ __( 'id' ) }}</th>
14-
<th style="width: 20%;">{{ __( 'username' ) }}</th>
15-
<th style="width: 15%;">{{ __( 'wiki' ) }}</th>
16-
<th style="width: 10%;">{{ __( 'ial-type' ) }}</th>
17-
<th style="width: 35%">{{ __( 'comments' ) }}</th>
18-
<th style="width: 10%;">{{ __( 'assigned' ) }}</th>
19-
</tr>
20-
</thead>
21-
<tbody>
22-
@foreach ( $ials as $ial )
2312
<tr>
24-
<td>{{ $ial->id }}</td>
25-
<td><a class="nav-link" href="/user/{{ $ial->user->id }}">{{ $ial->user->username }}</a></td>
26-
<td>{{ $ial->wiki }}</td>
27-
<td>{{ $ial->type }}</td>
28-
<td>{{ $ial->comments }}</td>
29-
@if ( $ial->dpa )
30-
<td><a class="nav-link" href="/dpa/{{ $ial->dpa }}">{{ __( 'dpa' ) }}</a></td>
31-
@elseif ( $ial->investigation )
32-
<td><a class="nav-link" href="/investigation/{{ $ial->investigation }}">{{ __( 'investigation' ) }}</a></td>
33-
@else
34-
<td>
35-
<button class="btn btn-danger text-white" type="button" data-bs-target="#ial-{{ $ial->id }}-modal" data-bs-toggle="modal">
36-
<i class="fa-solid fa-link"></i> {{ __( 'assign' ) }}
37-
</button>
38-
</td>
39-
@endif
13+
<th style="width: 10%;">{{ __( 'id' ) }}</th>
14+
<th style="width: 20%;">{{ __( 'username' ) }}</th>
15+
<th style="width: 15%;">{{ __( 'wiki' ) }}</th>
16+
<th style="width: 10%;">{{ __( 'ial-type' ) }}</th>
17+
<th style="width: 35%">{{ __( 'comments' ) }}</th>
18+
<th style="width: 10%;">{{ __( 'assigned' ) }}</th>
4019
</tr>
41-
@endforeach
20+
</thead>
21+
<tbody>
22+
@foreach ( $ials as $ial )
23+
<tr>
24+
<td>{{ $ial->id }}</td>
25+
<td><a class="nav-link" href="/user/{{ $ial->user->id }}">{{ $ial->user->username }}</a></td>
26+
<td>{{ $ial->wiki }}</td>
27+
<td>{{ $ial->type }}</td>
28+
<td>{{ $ial->comments }}</td>
29+
@if ( $ial->dpa )
30+
<td><a class="nav-link" href="/dpa/{{ $ial->dpa }}">{{ __( 'dpa' ) }}</a></td>
31+
@elseif ( $ial->investigation )
32+
<td><a class="nav-link" href="/investigation/{{ $ial->investigation }}">{{ __( 'investigation' ) }}</a></td>
33+
@else
34+
<td>
35+
<button class="btn btn-danger text-white" type="button" data-bs-target="#ial-{{ $ial->id }}-modal" data-bs-toggle="modal">
36+
<i class="fa-solid fa-link"></i> {{ __( 'assign' ) }}
37+
</button>
38+
</td>
39+
@endif
40+
</tr>
41+
@endforeach
4242
</tbody>
4343
<tfoot>
44-
<tr>
45-
<th style="width: 10%;">{{ __( 'id' ) }}</th>
46-
<th style="width: 20%;">{{ __( 'username' ) }}</th>
47-
<th style="width: 15%;">{{ __( 'wiki' ) }}</th>
48-
<th style="width: 10%;">{{ __( 'ial-type' ) }}</th>
49-
<th style="width: 35%">{{ __( 'comments' ) }}</th>
50-
<th style="width: 10%;">{{ __( 'assigned' ) }}</th>
51-
</tr>
44+
<tr>
45+
<th style="width: 10%;">{{ __( 'id' ) }}</th>
46+
<th style="width: 20%;">{{ __( 'username' ) }}</th>
47+
<th style="width: 15%;">{{ __( 'wiki' ) }}</th>
48+
<th style="width: 10%;">{{ __( 'ial-type' ) }}</th>
49+
<th style="width: 35%">{{ __( 'comments' ) }}</th>
50+
<th style="width: 10%;">{{ __( 'assigned' ) }}</th>
51+
</tr>
5252
</tfoot>
5353
</table>
54-
@if ( $ials->hasPages() )
55-
<nav>
56-
<ul class="pagination justify-content-center">
57-
<li class="page-item @disabled($ials->onFirstPage())">
58-
<a class="page-link" {{ $ials->onFirstPage() ? '' : 'href=' . $ials->previousPageUrl() }} ">{{ __( 'nav-previous' ) }}</a>
59-
</li>
60-
<li class="page-item @disabled(!$ials->hasMorePages())">
61-
<a class="page-link" {{ $ials->hasMorePages() ? 'href=' . $ials->nextPageUrl() : '' }}>{{ __( 'nav-next' ) }}</a>
62-
</li>
63-
</ul>
64-
</nav>
65-
@endif
54+
{{ $ials->links() }}
6655
</div>
6756
@foreach ( $ials as $ial )
6857
@unless ( $ial->investigation || $ial->dpa )

resources/views/users.blade.php

Lines changed: 25 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,39 @@
77
<div class="card shadow">
88
<div class="card-body">
99
<div class="table-responsive table mt-2" id="dataTable" role="grid" aria-describedby="dataTable_info">
10+
{{ $users->links() }}
1011
<table class="table table-striped my-0 text-center align-middle" id="dataTable">
1112
<thead>
12-
<tr>
13-
<th style="width: 10%;">{{ __( 'id' ) }}</th>
14-
<th style="width: 40%;">{{ __( 'username' ) }}</th>
15-
<th style="width: 20%;">{{ __( 'status' ) }}</th>
16-
<th style="width: 10%;">{{ __( 'verified' ) }}</th>
17-
<th style="width: 20%;">{{ __( 'flags' ) }}</th>
18-
</tr>
19-
</thead>
20-
<tbody>
21-
@foreach ( $users as $user )
2213
<tr>
23-
<td><a class="nav-link" href="/user/{{ $user->id }}">{{ $user->id }}</a></td>
24-
<td>{{ $user->username }}</td>
25-
<td>
26-
<x-user.standing :user="$user"/>
27-
</td>
28-
<td>
29-
<x-user.verified :user="$user"/>
30-
</td>
31-
<td>
32-
<x-user.flags :user="$user"/>
33-
</td>
14+
<th style="width: 10%;">{{ __( 'id' ) }}</th>
15+
<th style="width: 40%;">{{ __( 'username' ) }}</th>
16+
<th style="width: 20%;">{{ __( 'status' ) }}</th>
17+
<th style="width: 10%;">{{ __( 'verified' ) }}</th>
18+
<th style="width: 20%;">{{ __( 'flags' ) }}</th>
3419
</tr>
35-
@endforeach
20+
</thead>
21+
<tbody>
22+
@foreach ( $users as $user )
23+
<tr>
24+
<td><a class="nav-link" href="/user/{{ $user->id }}">{{ $user->id }}</a></td>
25+
<td>{{ $user->username }}</td>
26+
<td><x-user.standing :user="$user" /></td>
27+
<td><x-user.verified :user="$user" /></td>
28+
<td><x-user.flags :user="$user" /></td>
29+
</tr>
30+
@endforeach
3631
</tbody>
3732
<tfoot>
38-
<tr>
39-
<th style="width: 10%;">{{ __( 'id' ) }}</th>
40-
<th style="width: 40%;">{{ __( 'username' ) }}</th>
41-
<th style="width: 20%;">{{ __( 'status' ) }}</th>
42-
<th style="width: 10%;">{{ __( 'verified' ) }}</th>
43-
<th style="width: 20%;">{{ __( 'flags' ) }}</th>
44-
</tr>
33+
<tr>
34+
<th style="width: 10%;">{{ __( 'id' ) }}</th>
35+
<th style="width: 40%;">{{ __( 'username' ) }}</th>
36+
<th style="width: 20%;">{{ __( 'status' ) }}</th>
37+
<th style="width: 10%;">{{ __( 'verified' ) }}</th>
38+
<th style="width: 20%;">{{ __( 'flags' ) }}</th>
39+
</tr>
4540
</tfoot>
4641
</table>
47-
@if ( $users->hasPages() )
48-
<nav>
49-
<ul class="pagination justify-content-center">
50-
<li class="page-item @disabled($users->onFirstPage())">
51-
<a class="page-link" {{ $users->onFirstPage() ? '' : 'href=' . $users->previousPageUrl() }} ">{{ __( 'nav-previous' ) }}</a>
52-
</li>
53-
<li class="page-item @disabled(!$users->hasMorePages())">
54-
<a class="page-link" {{ $users->hasMorePages() ? 'href=' . $users->nextPageUrl() : '' }}>{{ __( 'nav-next' ) }}</a>
55-
</li>
56-
</ul>
57-
</nav>
58-
@endif
42+
{{ $users->links() }}
5943
</div>
6044
</div>
6145
</div>

0 commit comments

Comments
 (0)