legendary-doc-site/apps/content/lib/content_web/templates/posts/pagination.html.eex

15 lines
455 B
Elixir
Raw Normal View History

<%= if Content.Post.paginated_post?(@post) do %>
<nav class="paginator">
Page:
<%= Enum.map(
1..Content.Post.content_page_count(@post),
fn page ->
if assigns[:current_page] == nil || assigns[:current_page] != page do
link page, to: Routes.paged_post_path(@conn, :show, @post, page)
else
content_tag :span, page, class: "paginator-page"
end
end) %>
</nav>
<% end %>