Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completes the implementation of the nb_items_by_query parameter. #4330

Merged
Merged
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
15 changes: 12 additions & 3 deletions pages/items.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -3781,12 +3781,21 @@ function(teampassApplication) {
);
}

//Evaluate number of items to display - depends on screen height
//adapt to the screen height
// Evaluate number of items to display
let nb_items_by_query = '<?php echo !empty($SETTINGS['nb_items_by_query']) ? htmlspecialchars($SETTINGS['nb_items_by_query']) : 'auto'; ?>';
if (nb_items_by_query === 'auto' || isNaN(parseInt(nb_items_by_query))) {
// Based on screen height
nb_items_by_query = Math.max(Math.round((screenHeight - 450) / 23), 2);
} else {
// Admin choosen value
nb_items_by_query = parseInt(nb_items_by_query);
}

// Store parameter in teampassApplication.itemsShownByQuery
store.update(
'teampassApplication',
function(teampassApplication) {
teampassApplication.itemsShownByQuery = Math.max(Math.round((screenHeight - 450) / 23), 2);
teampassApplication.itemsShownByQuery = nb_items_by_query;
}
);

Expand Down