mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 21:45:37 +02:00
MDL-68463 user: Show count link should always exist in DOM
This commit is contained in:
parent
07c9106476
commit
50ba817fda
2
user/amd/build/participants.min.js
vendored
2
user/amd/build/participants.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -153,7 +153,10 @@ export const init = ({
|
||||
if (totalRowCount <= defaultPageSize) {
|
||||
// There are fewer than the default page count numbers of rows.
|
||||
showCountLink.classList.add('hidden');
|
||||
checkCountButton.classList.add('hidden');
|
||||
|
||||
if (checkCountButton) {
|
||||
checkCountButton.classList.add('hidden');
|
||||
}
|
||||
} else if (totalRowCount <= currentPageSize) {
|
||||
// The are fewer than the current page size.
|
||||
pageCountStrings.push({
|
||||
@ -172,8 +175,10 @@ export const init = ({
|
||||
showCountLink.classList.remove('hidden');
|
||||
showCountLink.dataset.targetPageSize = defaultPageSize;
|
||||
|
||||
// The 'Check all [x]' button is only visible when there are values to set.
|
||||
checkCountButton.classList.add('hidden');
|
||||
if (checkCountButton) {
|
||||
// The 'Check all [x]' button is only visible when there are values to set.
|
||||
checkCountButton.classList.add('hidden');
|
||||
}
|
||||
} else {
|
||||
pageCountStrings.push({
|
||||
key: 'showall',
|
||||
@ -190,7 +195,10 @@ export const init = ({
|
||||
// Show both the 'Show [x]' link, and the 'Check all [x]' button.
|
||||
showCountLink.classList.remove('hidden');
|
||||
showCountLink.dataset.targetPageSize = totalRowCount;
|
||||
checkCountButton.classList.remove('hidden');
|
||||
|
||||
if (checkCountButton) {
|
||||
checkCountButton.classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
Str.get_strings(pageCountStrings)
|
||||
@ -202,7 +210,7 @@ export const init = ({
|
||||
showCountLink.innerHTML = showCountString;
|
||||
}
|
||||
|
||||
if (selectCountString) {
|
||||
if (selectCountString && checkCountButton) {
|
||||
checkCountButton.value = selectCountString;
|
||||
}
|
||||
|
||||
|
@ -310,30 +310,32 @@ echo $participanttablehtml;
|
||||
|
||||
$perpageurl = clone($baseurl);
|
||||
$perpageurl->remove_params('perpage');
|
||||
$perpagesize = DEFAULT_PAGE_SIZE;
|
||||
$perpagevisible = false;
|
||||
|
||||
if ($perpage == SHOW_ALL_PAGE_SIZE && $participanttable->totalrows > DEFAULT_PAGE_SIZE) {
|
||||
$perpageurl->param('perpage', DEFAULT_PAGE_SIZE);
|
||||
echo $OUTPUT->container(html_writer::link(
|
||||
$perpageurl,
|
||||
get_string('showperpage', '', DEFAULT_PAGE_SIZE),
|
||||
[
|
||||
'data-action' => 'showcount',
|
||||
'data-target-page-size' => DEFAULT_PAGE_SIZE,
|
||||
]
|
||||
), [], 'showall');
|
||||
|
||||
$perpagevisible = true;
|
||||
} else if ($participanttable->get_page_size() < $participanttable->totalrows) {
|
||||
$perpageurl->param('perpage', SHOW_ALL_PAGE_SIZE);
|
||||
echo $OUTPUT->container(html_writer::link(
|
||||
$perpageurl,
|
||||
get_string('showall', '', $participanttable->totalrows),
|
||||
[
|
||||
'data-action' => 'showcount',
|
||||
'data-target-page-size' => SHOW_ALL_PAGE_SIZE,
|
||||
]
|
||||
),
|
||||
[], 'showall');
|
||||
$pagesize = SHOW_ALL_PAGE_SIZE;
|
||||
$perpagevisible = true;
|
||||
}
|
||||
|
||||
$perpageclasses = '';
|
||||
if (!$perpagevisible) {
|
||||
$perpageclasses = 'hidden';
|
||||
}
|
||||
echo $OUTPUT->container(html_writer::link(
|
||||
$perpageurl,
|
||||
get_string('showperpage', '', DEFAULT_PAGE_SIZE),
|
||||
[
|
||||
'data-action' => 'showcount',
|
||||
'data-target-page-size' => $perpagesize,
|
||||
'class' => $perpageclasses,
|
||||
]
|
||||
), [], 'showall');
|
||||
|
||||
if ($bulkoperations) {
|
||||
echo '<br /><div class="buttons"><div class="form-inline">';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user