Skip to content

Commit

Permalink
PROBE-220: Add current page
Browse files Browse the repository at this point in the history
  • Loading branch information
MPParsley committed Jul 2, 2024
1 parent 30e0a02 commit 03a7c42
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions webcomponents/besluiten-lijst/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h1>Besluiten lijst</h1>
</besluiten-lijst>
<besluiten-lijst
sparql-endpoint="https://probe.stad.gent/sparql"
aantal="20"
aantal="5"
pager="true"
taxonomy="http://stad.gent/id/concepts/decision_making_themes"
concepts="http://stad.gent/id/concepts/decision_making_themes/concept_36"
Expand All @@ -48,12 +48,12 @@ <h1>Besluiten lijst</h1>
</besluiten-lijst>
<besluiten-lijst
sparql-endpoint="https://probe.stad.gent/sparql"
aantal="5"
aantal="5"
pager="true"
start="2024-01-01"
eind="2024-01-31"
eind="2024-01-07"
>
<span slot="title">Alle besluiten tussen 1 januari 2024 en 31 januari 2024 (probe)</span>
<span slot="title">Alle besluiten tussen 1 januari 2024 en 7 januari 2024 (probe)</span>
</besluiten-lijst>
<besluiten-lijst
sparql-endpoint="https://probe.stad.gent/sparql"
Expand Down
3 changes: 3 additions & 0 deletions webcomponents/besluiten-lijst/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ class BesluitenLijst extends HTMLElement {
getPager() {
let previous = '';
let next = '';
let currentPage = Math.floor(this.offset / this.amount) + 1;
let totalPages = Math.ceil(this.maxCount / this.amount);

if (this.offset >= this.amount) {
previous = `
Expand All @@ -291,6 +293,7 @@ class BesluitenLijst extends HTMLElement {
<h2 id="pagination" class="visually-hidden">Paginatie</h2>
<ul class="pager__items">
${previous}
<li class="current-page">Pagina ${currentPage} van ${totalPages}</li>
${next}
</ul>
</nav>
Expand Down
3 changes: 3 additions & 0 deletions webcomponents/reglementen-lijst/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ class ReglementenLijst extends HTMLElement {
getPager() {
let previous = '';
let next = '';
let currentPage = Math.floor(this.offset / this.amount) + 1;
let totalPages = Math.ceil(this.maxCount / this.amount);

if (this.offset >= this.amount) {
previous = `
Expand All @@ -317,6 +319,7 @@ class ReglementenLijst extends HTMLElement {
<h2 id="pagination" class="visually-hidden">Paginatie</h2>
<ul class="pager__items">
${previous}
<li class="current-page">Pagina ${currentPage} van ${totalPages}</li>
${next}
</ul>
</nav>
Expand Down

0 comments on commit 03a7c42

Please sign in to comment.