Skip to content

Commit 08ba64b

Browse files
committed
Make pagination element fully standalone.
Sets explicit Bootstrap 5 templates to avoid app/Tools templates affecting the standalone admin layout.
1 parent 5cea4b0 commit 08ba64b

3 files changed

Lines changed: 28 additions & 28 deletions

File tree

templates/Admin/QueueProcesses/index.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* @var iterable<\Queue\Model\Entity\QueueProcess> $queueProcesses
55
*/
66

7-
use Cake\Core\Plugin;
87
use Queue\Queue\Config;
98

109
?>
@@ -124,12 +123,6 @@
124123
</div>
125124
</div>
126125
<div class="card-footer">
127-
<?php
128-
if (Plugin::isLoaded('Tools')) {
129-
echo $this->element('Tools.pagination');
130-
} else {
131-
echo $this->element('Queue.pagination');
132-
}
133-
?>
126+
<?= $this->element('Queue.pagination') ?>
134127
</div>
135128
</div>

templates/Admin/QueuedJobs/index.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,6 @@
237237
</div>
238238
</div>
239239
<div class="card-footer">
240-
<?php
241-
if (Plugin::isLoaded('Tools')) {
242-
echo $this->element('Tools.pagination');
243-
} else {
244-
echo $this->element('Queue.pagination');
245-
}
246-
?>
240+
<?= $this->element('Queue.pagination') ?>
247241
</div>
248242
</div>

templates/element/pagination.php

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,37 @@
11
<?php
22
/**
3-
* Pagination element with Bootstrap 5 styling.
4-
* Fallback when Tools plugin is not available.
3+
* Standalone pagination element with Bootstrap 5 styling.
54
*
6-
* @var \App\View\AppView $this
5+
* Sets explicit templates to avoid style leakage from app templates.
6+
*
7+
* @var \Cake\View\View $this
78
*/
89

910
if (!$this->Paginator->hasPage()) {
1011
return;
1112
}
13+
14+
// Set Bootstrap 5 templates explicitly to avoid app template leakage
15+
$this->Paginator->setTemplates([
16+
'nextActive' => '<li class="page-item"><a class="page-link" rel="next" href="{{url}}">{{text}}</a></li>',
17+
'nextDisabled' => '<li class="page-item disabled"><span class="page-link">{{text}}</span></li>',
18+
'prevActive' => '<li class="page-item"><a class="page-link" rel="prev" href="{{url}}">{{text}}</a></li>',
19+
'prevDisabled' => '<li class="page-item disabled"><span class="page-link">{{text}}</span></li>',
20+
'first' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>',
21+
'last' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>',
22+
'number' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>',
23+
'current' => '<li class="page-item active"><span class="page-link">{{text}}</span></li>',
24+
]);
1225
?>
13-
<nav aria-label="Page navigation">
14-
<ul class="pagination justify-content-center">
15-
<?= $this->Paginator->first('«', ['class' => 'page-link']) ?>
16-
<?= $this->Paginator->prev('', ['class' => 'page-link']) ?>
17-
<?= $this->Paginator->numbers(['class' => 'page-link']) ?>
18-
<?= $this->Paginator->next('', ['class' => 'page-link']) ?>
19-
<?= $this->Paginator->last('»', ['class' => 'page-link']) ?>
26+
<nav class="mt-3" aria-label="<?= __d('queue', 'Page navigation') ?>">
27+
<ul class="pagination justify-content-center mb-2">
28+
<?= $this->Paginator->first('<i class="fas fa-angle-double-left"></i>', ['escape' => false]) ?>
29+
<?= $this->Paginator->prev('<i class="fas fa-angle-left"></i>', ['escape' => false]) ?>
30+
<?= $this->Paginator->numbers() ?>
31+
<?= $this->Paginator->next('<i class="fas fa-angle-right"></i>', ['escape' => false]) ?>
32+
<?= $this->Paginator->last('<i class="fas fa-angle-double-right"></i>', ['escape' => false]) ?>
2033
</ul>
34+
<p class="text-center text-muted small mb-0">
35+
<?= $this->Paginator->counter(__d('queue', 'Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')) ?>
36+
</p>
2137
</nav>
22-
<p class="text-center text-muted small">
23-
<?= $this->Paginator->counter(__d('queue', 'Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')) ?>
24-
</p>

0 commit comments

Comments
 (0)