diff --git a/templates/_page-navigation.html.ep b/templates/_page-navigation.html.ep new file mode 100644 index 0000000..d6ff7cf --- /dev/null +++ b/templates/_page-navigation.html.ep @@ -0,0 +1,27 @@ +

+Page <%= $pager->current_page %> of <%= $pager->last_page %> + +    +<%= link_to url_for(page_number => 1) +->query($query_params) +->to_abs => begin %>◄ First<% end %> + +% if (my $prev = $pager->previous_page) { + <%= link_to url_for(page_number => $prev) + ->query($query_params) + ->to_abs => begin %>◄ Prev<% end %> +% } else { +◄ Prev +% } + +% if (my $next = $pager->next_page) { + <%= link_to url_for(page_number => $next) + ->query($query_params) + ->to_abs => begin %>Next ►<% end %> +% } else { +Next ► +% } + +<%= link_to url_for(page_number => $pager->last_page) +->query($query_params) +->to_abs => begin %>Last ►<% end %> diff --git a/templates/book/author.html.ep b/templates/book/author.html.ep index 1f8b7e7..182d1b5 100644 --- a/templates/book/author.html.ep +++ b/templates/book/author.html.ep @@ -26,30 +26,4 @@ -

-Page <%= $pager->current_page %> of <%= $pager->last_page %> - -    -<%= link_to url_for(page_number => 1) -->query($query_params) -->to_abs => begin %>◄ First<% end %> - -% if (my $prev = $pager->previous_page) { - <%= link_to url_for(page_number => $prev) - ->query($query_params) - ->to_abs => begin %>◄ Prev<% end %> -% } else { -◄ Prev -% } - -% if (my $next = $pager->next_page) { - <%= link_to url_for(page_number => $next) - ->query($query_params) - ->to_abs => begin %>Next ►<% end %> -% } else { -Next ► -% } - -<%= link_to url_for(page_number => $pager->last_page) -->query($query_params) -->to_abs => begin %>Last ►<% end %> +%= include '_page-navigation' diff --git a/templates/book/index.html.ep b/templates/book/index.html.ep index d33496b..d759a64 100644 --- a/templates/book/index.html.ep +++ b/templates/book/index.html.ep @@ -27,30 +27,4 @@ -

-Page <%= $pager->current_page %> of <%= $pager->last_page %> - -    -<%= link_to url_for(page_number => 1) -->query($query_params) -->to_abs => begin %>◄ First<% end %> - -% if (my $prev = $pager->previous_page) { - <%= link_to url_for(page_number => $prev) - ->query($query_params) - ->to_abs => begin %>◄ Prev<% end %> -% } else { -◄ Prev -% } - -% if (my $next = $pager->next_page) { - <%= link_to url_for(page_number => $next) - ->query($query_params) - ->to_abs => begin %>Next ►<% end %> -% } else { -Next ► -% } - -<%= link_to url_for(page_number => $pager->last_page) -->query($query_params) -->to_abs => begin %>Last ►<% end %> +%= include '_page-navigation' diff --git a/templates/home/index.html.ep b/templates/home/index.html.ep index ddcd46d..e6354ed 100644 --- a/templates/home/index.html.ep +++ b/templates/home/index.html.ep @@ -6,6 +6,7 @@

<%= link_to("About" => 'about') %>

<%= link_to("Books" => 'book_page' => { page_number => 1 }) %>

+

<%= link_to("Authors" => 'author_page' => { page_number => 1 }) %>

For this, you'll need to log in, then MyApp will redirect you:

<%= link_to("Account" => 'account') %>