From abc83298cdc9f63a1956ee5a7d30f75b7c7dec07 Mon Sep 17 00:00:00 2001 From: Tobias Jordans Date: Wed, 30 Dec 2020 14:20:13 +0100 Subject: [PATCH] Diary entries #index: Migrate to bootstrap pagination Use https://getbootstrap.com/docs/4.5/components/pagination/ for the pagination. I tried using link_to_if but this does not work well in this case since multiple changes need to happen for the disabled state. --- app/views/diary_entries/index.html.erb | 36 ++++++++++++++++---------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/app/views/diary_entries/index.html.erb b/app/views/diary_entries/index.html.erb index 96c052da6..28cb69b24 100644 --- a/app/views/diary_entries/index.html.erb +++ b/app/views/diary_entries/index.html.erb @@ -28,21 +28,29 @@ <%= render @entries %> - + <% if @page > 1 -%> +
  • + <%= link_to_if @page > 1, t(".newer_entries"), @params.merge(:page => @page - 1), :class => 'page-link' %> +
  • + <% else -%> +
  • + <%= link_to t('.newer_entries'), '#', :class => 'page-link', :tabindex => '-1', :'aria-disabled' => true %> +
  • + <% end -%> + + <% end %> <% unless params[:friends] or params[:nearby] -%>