Traces: Migrate pagination to bootstrap

Same feature, different style.
- Change pagination to use bootstrap default styles
- … but with empty span-tags instead of non-active a-tags
- refactor partial to not use @-variables but get the variables via
the render-call, simplify render-call-syntax
- remove the additional `if @traces.size > 1` inside the pagination
partial since that caused the pagination to disappear on the last page.
The partial will be visible with inactive links.
- Add bootstrap spacer-classes to overwrite commons-css so removing. Eg.
commons also has a pagination class same as bootstrap.
This commit is contained in:
Tobias Jordans 2021-01-02 22:48:25 +01:00
parent 430872ad7b
commit 18ec273038
2 changed files with 28 additions and 19 deletions

View file

@ -1,18 +1,27 @@
<p>
<nav>
<ul class="pagination my-3 py-0">
<% if page > 1 %>
<li class="page-item">
<%= link_to t(".newer"), params.merge(:page => page - 1), :class => "page-link" %>
</li>
<% else %>
<li class="page-item disabled">
<span class="page-link"><%= t(".newer") %></span>
</li>
<% end %>
<% if @traces.size > 1 %>
<% if @page > 1 %>
<%= link_to t(".newer"), @params.merge(:page => @page - 1) %>
<% else %>
<%= t(".newer") %>
<% end %>
<li class="page-item disabled">
<span class="page-link"><%= t(".showing_page", :page => page) %></span>
</li>
| <%= t(".showing_page", :page => @page) %> |
<% if @traces.size < @page_size %>
<%= t(".older") %>
<% else %>
<%= link_to t(".older"), @params.merge(:page => @page + 1) %>
<% end %>
<% end %>
</p>
<% if traces.size < page_size %>
<li class="page-item disabled">
<span class="page-link"><%= t(".older") %></span>
</li>
<% else %>
<li class="page-item">
<%= link_to t(".older"), params.merge(:page => page + 1), :class => "page-link" %>
</li>
<% end %>
</ul>
</nav>

View file

@ -23,15 +23,15 @@
<% end %>
<% if @traces.size > 0 %>
<%= render :partial => "trace_paging_nav" %>
<%= render "trace_paging_nav", :page => @page, :page_size => @page_size, :traces => @traces, :params => @params %>
<table id="trace_list" class="table table-borderless table-striped">
<table id="trace_list" class="table table-borderless table-striped mb-0">
<tbody>
<%= render @traces unless @traces.nil? %>
</tbody>
</table>
<%= render :partial => "trace_paging_nav" %>
<%= render "trace_paging_nav", :page => @page, :page_size => @page_size, :traces => @traces, :params => @params %>
<% else %>
<h4><%= t ".empty_html", :upload_link => new_trace_path %></h4>
<% end %>