Architecture review fixes: partials carry the locale, mountable locales/, shared core words
CI / full-gate (push) Successful in 2m36s
CI / full-gate (push) Successful in 2m36s
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
options: (number | { value, label })[]; hidden: { name, value }[] carries list state
|
||||
prev?, next? { href? } page step; omit href ⇒ disabled
|
||||
pages? { label, href?, current?, ellipsis? }[]
|
||||
Every href is run through localeHref, and the rows form carries the locale as a hidden input —
|
||||
a GET submit replaces the whole query string, so it would drop the visitor's language otherwise.
|
||||
%><%
|
||||
const label = locals.label || t("pagination.label");
|
||||
const summary = locals.summary;
|
||||
@@ -22,10 +24,13 @@
|
||||
<span><%= summary.from %>–<%= summary.to %> <%= t("pagination.of") %> <b><%= summary.total %></b></span>
|
||||
<% } -%>
|
||||
<% if (rows) { -%>
|
||||
<form class="pager-rows" method="get"<% if (rows.action) { %> action="<%= rows.action %>"<% } %>>
|
||||
<form class="pager-rows" method="get"<% if (rows.action) { %> action="<%= localeHref(rows.action) %>"<% } %>>
|
||||
<% (rows.hidden || []).forEach((h) => { -%>
|
||||
<input type="hidden" name="<%= h.name %>" value="<%= h.value %>">
|
||||
<% }) -%>
|
||||
<% if (localeParam) { -%>
|
||||
<input type="hidden" name="locale" value="<%= localeParam %>">
|
||||
<% } -%>
|
||||
<label for="pager-rows"><%= rows.label || t("pagination.rows") %></label>
|
||||
<span class="select"><select id="pager-rows" name="<%= rows.name %>"><% (rows.options || []).forEach((o) => { const v = o && o.value != null ? o.value : o; const text = o && o.label != null ? o.label : o; %><option value="<%= v %>"<% if (eq(rows.value, v)) { %> selected<% } %>><%= text %></option><% }) %></select></span>
|
||||
<button class="page-btn" type="submit"><%= rows.submitLabel || t("pagination.go") %></button>
|
||||
@@ -35,7 +40,7 @@
|
||||
<nav class="page-nums" aria-label="<%= label %>">
|
||||
<% if (prev) { -%>
|
||||
<% if (prev.href) { -%>
|
||||
<a class="page-btn" href="<%= prev.href %>" aria-label="<%= t("pagination.previous") %>"><svg class="ico ico-sm" style="transform:rotate(180deg)"><use href="#i-chev"/></svg></a>
|
||||
<a class="page-btn" href="<%= localeHref(prev.href) %>" aria-label="<%= t("pagination.previous") %>"><svg class="ico ico-sm" style="transform:rotate(180deg)"><use href="#i-chev"/></svg></a>
|
||||
<% } else { -%>
|
||||
<button class="page-btn" type="button" disabled aria-label="<%= t("pagination.previous") %>"><svg class="ico ico-sm" style="transform:rotate(180deg)"><use href="#i-chev"/></svg></button>
|
||||
<% } -%>
|
||||
@@ -46,12 +51,12 @@
|
||||
<% } else if (p.current) { -%>
|
||||
<span class="page-btn" aria-current="page"><%= p.label %></span>
|
||||
<% } else { -%>
|
||||
<a class="page-btn" href="<%= p.href %>"><%= p.label %></a>
|
||||
<a class="page-btn" href="<%= localeHref(p.href) %>"><%= p.label %></a>
|
||||
<% } -%>
|
||||
<% }) -%>
|
||||
<% if (next) { -%>
|
||||
<% if (next.href) { -%>
|
||||
<a class="page-btn" href="<%= next.href %>" aria-label="<%= t("pagination.next") %>"><svg class="ico ico-sm"><use href="#i-chev"/></svg></a>
|
||||
<a class="page-btn" href="<%= localeHref(next.href) %>" aria-label="<%= t("pagination.next") %>"><svg class="ico ico-sm"><use href="#i-chev"/></svg></a>
|
||||
<% } else { -%>
|
||||
<button class="page-btn" type="button" disabled aria-label="<%= t("pagination.next") %>"><svg class="ico ico-sm"><use href="#i-chev"/></svg></button>
|
||||
<% } -%>
|
||||
|
||||
Reference in New Issue
Block a user