Skip to content

Clean up pagination controls (CMF-55) #5

Merged
merged 2 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/resources/locales/en_US/operation.po
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ msgid "next"
msgstr "Next"

msgid "page.display"
msgstr "Display"
msgstr "Display records"

msgid "page.goto"
msgstr "Go To Page"
msgstr "Go to page"

msgid "previous"
msgstr "Previous"
Expand Down
11 changes: 6 additions & 5 deletions app/templates/element/pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ class="pagination-form"
return false;">
<label for="pageNum"><?= __d('operation', 'page.goto'); ?></label>
<input type="text" size="3" name="pageNum" id="pageNum"/>
<input type="submit" value="<?= __d('operation', 'op.go'); ?>"/>
<input type="submit" value="<?= __d('operation', 'go'); ?>"/>
</form>
<?php endif; ?>

<?php
if($this->Paginator->counter('{{pages}}') > 25) {
// XXX Change this test to 25 when the default is 25
if($this->Paginator->counter('{{count}}') > 20) {
// Provide a form for setting the page limit.
// Default is 25 records, current maximum is 100.
// Default is 20 records (XXX but will be 25), maximum is 100.
// For now we will simply hard-code the options from 25 - 100.

print $this->Form->create(null, [ 'type' => 'get', 'class' => 'pagination-form' ]);
Expand All @@ -96,10 +97,10 @@ class="pagination-form"
'type' => 'select',
'label' => __d('operation', 'page.display'),
'value' => $this->request->getQuery('limit'),
'options' => [25 => 25, 50 => 50, 100 => 100],
'onChange' => 'this.form.submit()'
'options' => [25 => 25, 50 => 50, 75 => 75, 100 => 100]
]);

print $this->Form->submit(__d('operation', 'go'));
print $this->Form->end();
}
?>
Expand Down
27 changes: 19 additions & 8 deletions app/webroot/css/co-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,9 @@ th.actions {
}
#pagination .pagination-form {
display: inline-block;
margin-left: 2em;
}
#pagination #goto-page {
margin: 0 2em;
}
#pagination .pagination-form label {
margin-bottom: 0;
Expand All @@ -840,24 +842,27 @@ th.actions {
padding: 2px;
font-size: 0.9em;
background-color: var(--cmg-color-lightgray-004);
border: 1px solid var(--cmg-color-green-005);
border: 1px solid var(--cmg-color-lightgray-004);
border-radius: 0.25rem;
text-align: center;
}
#pagination .pagination-form select {
margin: 0 0.5rem;
padding: 0 0.25rem;
margin: 0 0.25rem 0 0.5rem;
padding: 0 2rem 0 0.25rem;
font-size: 0.9em;
display: inline-block;
line-height: unset;
width: unset;
height: unset;
border: 1px solid var(--cmg-color-lightgray-001);
background-color: var(--cmg-color-lightgray-001);
}
#pagination .pagination-form option {
padding: 0;
}
#pagination .pagination-form input[type="submit"] {
width: auto;
margin: 0 0 0 2px;
margin: -3px 0 0 2px;
padding: 0 4px;
min-width: 0;
min-height: 0;
Expand All @@ -871,13 +876,19 @@ th.actions {
top: 1px;
}
#pagination .btn-primary {
background-color: var(--cmg-color-green-006);
border-color: var(--cmg-color-green-005);
background-color: var(--cmg-color-blue-003);
border-color: var(--cmg-color-blue-002);
}
#pagination .btn-primary:hover {
#pagination .btn-primary:hover,
#pagination .btn-primary:focus,
#pagination .btn-primary:active {
background-color: var(--cmg-color-gray-001) !important;
border-color: var(--cmg-color-black);
}
#pagination div.submit,
#pagination div.select {
display: inline-block;
}
::-webkit-input-placeholder,
::-moz-placeholder,
:-ms-input-placeholder,
Expand Down