backend: move pager HTML into a partial template

This commit is contained in:
Lucas 2023-03-17 19:58:12 +00:00
parent 72412a7889
commit daefabd1af
2 changed files with 12 additions and 11 deletions

11
templates/_pager.html.ep Normal file
View File

@ -0,0 +1,11 @@
<% if (my $pager = stash("pager")) { %>
<footer>
<nav class="text-center">
<%= link_to "<<" => $pager->{first_page} if exists $pager->{first_page} %>
<%= link_to "<" => $pager->{previous_page} if exists $pager->{previous_page} %>
<span><%= $pager->{current_page} %></span>
<%= link_to ">" => $pager->{next_page} if exists $pager->{next_page} %>
<%= link_to ">>" => $pager->{last_page} if exists $pager->{last_page} %>
</nav>
</footer>
<% } %>

View File

@ -20,17 +20,7 @@
<div class="viewport flex-i-fullsize flex-c-vertical"> <div class="viewport flex-i-fullsize flex-c-vertical">
<h1><%= title %></h1> <h1><%= title %></h1>
<div class="flex-i-fullsize"><%= content %></div> <div class="flex-i-fullsize"><%= content %></div>
<% if (defined $pager) { %> <%= include '_pager' %>
<footer>
<nav class="text-center">
<%= link_to "<<" => $pager->{first_page} if exists $pager->{first_page} %>
<%= link_to "<" => $pager->{previous_page} if exists $pager->{previous_page} %>
<span><%= $pager->{current_page} %></span>
<%= link_to ">" => $pager->{next_page} if exists $pager->{next_page} %>
<%= link_to ">>" => $pager->{last_page} if exists $pager->{last_page} %>
</nav>
</footer>
<% } %>
</div> </div>
</main> </main>
<footer class="border-top"> <footer class="border-top">