Format page numbers in pagination
Change-Id: I66a5ed4c9d01e5df5ec43a3acc07a80403a0734b
diff --git a/Changes b/Changes
index 369ed99..cce08ac 100755
--- a/Changes
+++ b/Changes
@@ -1,7 +1,8 @@
0.44 2022-01-04
- Fixed autosecrets migration. (diewald)
+ - Format page numbers in pagination (diewald).
-0.43 2021-12-14
+0.43 2021-12-01
- New menu class that has an entry at the very end,
similar to the input text prefix,
that is always available. (lerepp)
@@ -460,8 +461,8 @@
- Improved menu using sliders.
- Improved menu to make prefixes chooseable,
even if list can't be filtered.
- - Improve pageup/pagedown behaviour in menus.
- - Fixed multiple bugs in menu.
+ - Improve pageup/pagedown behaviour in menus.
+ - Fixed multiple bugs in menu.
0.19 2016-04-28
- Improved datepicker to enter date strings.
@@ -525,7 +526,7 @@
0.06 2014-09-22
- Updated certain Notifications and AssetPack plugins
- - Updated pagination plugin
+ - Updated pagination plugin
0.05 2014-07-15
- Improved tutorial support
diff --git a/Makefile.PL b/Makefile.PL
index 8ae14e3..893879f 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -17,7 +17,7 @@
LICENSE => 'freebsd',
PREREQ_PM => {
'Mojolicious' => '9.19',
- 'Mojolicious::Plugin::TagHelpers::Pagination' => 0.08,
+ 'Mojolicious::Plugin::TagHelpers::Pagination' => 0.10,
'Mojolicious::Plugin::TagHelpers::MailToChiffre' => 0.13,
'Mojolicious::Plugin::ClosedRedirect' => 0.15,
'Mojolicious::Plugin::Notifications' => 1.07,
diff --git a/README.md b/README.md
index b813c95..a028a87 100644
--- a/README.md
+++ b/README.md
@@ -297,7 +297,7 @@
### Original Software
-Copyright (C) 2015-2021, [IDS Mannheim](https://www.ids-mannheim.de/)<br>
+Copyright (C) 2015-2022, [IDS Mannheim](https://www.ids-mannheim.de/)<br>
Author: [Nils Diewald](https://www.nils-diewald.de/), Helge Stallkamp<br>
Contributor: Eliza Margaretha (Documentation), Susanne Feix (Translation),
Leo Repp
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index b850be0..97bb173 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -400,7 +400,7 @@
=head2 COPYRIGHT AND LICENSE
-Copyright (C) 2015-2021, L<IDS Mannheim|https://www.ids-mannheim.de/>
+Copyright (C) 2015-2022, L<IDS Mannheim|https://www.ids-mannheim.de/>
Author: L<Nils Diewald|https://www.nils-diewald.de/>
Kalamar is developed as part of the L<KorAP|http://korap.ids-mannheim.de/>
diff --git a/t/query.t b/t/query.t
index 737dbb6..9fb3d7d 100644
--- a/t/query.t
+++ b/t/query.t
@@ -154,7 +154,7 @@
# Query with page information
-$err = $t->get_ok('/?q=der&p=1&count=2')
+$err = $t->get_ok('/?q=der&p=1&count=2' => { 'Accept-Language' => 'en-US, en, de-DE' })
->status_is(200)
->text_is('title', 'KorAP: Find »der« with Poliqarp')
@@ -163,7 +163,7 @@
# Total pages
->element_count_is('#pagination > a', 7)
- ->text_is('#pagination a:nth-of-type(6) span', 7291)
+ ->text_is('#pagination a:nth-of-type(6) span', '7,291')
->element_exists('#pagination a.ellipsis.inactive')
->content_like(qr!${q}count${q}:2!)
->content_like(qr!${q}startIndex${q}:0!)
@@ -191,17 +191,17 @@
unlike($next_href, qr/p=1/);
# Query with page information - next page
-$err = $t->get_ok('/?q=der&p=2&count=2')
+$err = $t->get_ok('/?q=der&p=2&count=2' => { 'Accept-Language' => 'de-DE, en-US, en' })
->status_is(200)
- ->text_is('title', 'KorAP: Find »der« with Poliqarp')
+ ->text_is('title', 'KorAP: Finde »der« mit Poliqarp')
->element_exists('#search')
# Total results
- ->text_is('#total-results', '14,581')
+ ->text_is('#total-results', '14.581')
# Total pages
->element_count_is('#pagination > a', 7)
- ->text_is('#pagination a:nth-of-type(6) span', 7291)
+ ->text_is('#pagination a:nth-of-type(6) span', '7.291')
->content_like(qr!${q}count${q}:2!)
->content_like(qr!${q}itemsPerPage${q}:2!)
->content_like(qr!${q}startIndex${q}:2!)
diff --git a/templates/search.html.ep b/templates/search.html.ep
index df52efd..d91195f 100644
--- a/templates/search.html.ep
+++ b/templates/search.html.ep
@@ -1,11 +1,12 @@
% layout 'main', schematype => 'SearchResultsPage';
+% my $numf = sub { return loc('numf', number => $_[0]) };
<div id="pagination"
class="button-group button-panel"
data-page="<%= stash('start_page') %>"
data-total="<%= stash('total_pages') %>"
data-count="<%= stash('items_per_page') %>"
- ><%= pagination(stash('start_page'), stash('total_pages'), url_with->query({'p' => '{page}'})) =%></div>
+ ><%= pagination(stash('start_page'), stash('total_pages'), url_with->query({'p' => '{page}'}), { num_format => $numf }) =%></div>
<div id="resultinfo" <% if (stash('results')->size) { %> class="found"<%} %>>
% my $found = stash('total_results') // 0;