% params = assigns[:params] || [] %> <%= if @page.total_pages > 1 do %> <%= if not first_page?(@page) do %> <%= link("« First", to: first_page_path(@page, @route, params)) %> <%= link("‹ Prev", to: prev_page_path(@page, @route, params), class: "js-prev") %> <% end %> <%= if left_gap?(@page) do %> … <% end %> <%= for number <- left_page_numbers(@page) do %> <%= link(number, to: page_path(@route, params, number)) %> <% end %> <%= @page.page_number %> <%= for number <- right_page_numbers(@page) do %> <%= link(number, to: page_path(@route, params, number)) %> <% end %> <%= if right_gap?(@page) do %> … <% end %> <%= if not last_page?(@page) do %> <%= link("Next ›", to: next_page_path(@page, @route, params), class: "js-next") %> <%= link("Last »", to: last_page_path(@page, @route, params)) %> <% end %> <%= if first_page?(@page) do %> « First ‹ Prev <% else %> <%= link("« First", to: first_page_path(@page, @route, params)) %> <%= link("‹ Prev", to: prev_page_path(@page, @route, params), class: "js-prev") %> <% end %> <%= @page.page_number %> <%= if left_gap?(@page) do %> … <% end %> <%= for number <- left_page_numbers(@page) do %> <%= link(number, to: page_path(@route, params, number)) %> <% end %> <%= @page.page_number %> <%= for number <- right_page_numbers(@page) do %> <%= link(number, to: page_path(@route, params, number)) %> <% end %> <%= if right_gap?(@page) do %> … <% end %> <%= if last_page?(@page) do %> Next › Last » <% else %> <%= link("Next ›", to: next_page_path(@page, @route, params), class: "js-next") %> <%= link("Last »", to: last_page_path(@page, @route, params)) %> <% end %> <% end %>