Commit 77670c4a authored by Elisa Nury's avatar Elisa Nury
Browse files

improved results display for papyri page.

parent 480a3e89
......@@ -59,6 +59,7 @@ declare function local:page-range($page as xs:integer, $page_total as xs:integer
(:~ returns pagination links.
:
: @param results - query results
: @param pagelength - number of results per page
:)
declare function local:pagination($results, $pagelength as xs:integer) {
......@@ -68,7 +69,8 @@ declare function local:pagination($results, $pagelength as xs:integer) {
let $query := request:get-query-string() => replace("page=.+?&", "")
return
let $pagination := if (count($results) <= $pagelength) then ()
else
<div>
<nav aria-label="Page navigation">
<ul class="pagination papyri-pagination">
......@@ -95,6 +97,28 @@ return
</ul>
</nav>
</div>
return $pagination
};
(:~ returns message with number of results for the query.
:
: @param results - query results
: @param page - current result page
: @param pagelength - number of results per page
:)
declare function local:results-nb($results, $pagelength as xs:integer, $page as xs:integer) {
let $nb := count($results)
let $message :=
if ($nb <= $pagelength)
then let $pap := if ($nb > 1) then " Papyri" else " Papyrus"
return $nb || $pap
else
let $start := ($pagelength*($page -1))+1
let $end := $start -1 + count(subsequence($results, ($pagelength*($page -1))+1, $pagelength))
return $start || "-" || $end || " of " || $nb || " Papyri"
return $message
};
(:~ returns formated search result for the papyri page.
......@@ -339,12 +363,8 @@ function search-facets:advanced-search ($node as node (), $model as map (*), $ke
<h3 class="h3 row">
<div class="col">
{
let $start := ($pagelength*($page -1))+1
let $end := $start -1 + count(subsequence($results, ($pagelength*($page -1))+1, $pagelength))
return $start || "-" || $end
local:results-nb($results, $pagelength, $page)
}
of {count($results)}
{if (count($results) gt 1) then " Papyri" else " Papyrus"}
</div>
<div class="col d-flex justify-content-end flex-wrap">
<div class="dropdown order-by">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment