Browse Source

Enhance ui for pagination

pull/23/head
janpaulo 4 years ago
parent
commit
94e0f09c7c
No known key found for this signature in database
GPG Key ID: 50CA753050F1541C
  1. 6
      app/components/pagination_component/pagination_component.html.erb
  2. 7
      app/javascript/src/application.scss
  3. 9
      app/javascript/src/application/pagination.scss
  4. 2
      app/views/kaminari/_first_page.html.erb
  5. 2
      app/views/kaminari/_last_page.html.erb
  6. 2
      app/views/kaminari/_next_page.html.erb
  7. 2
      app/views/kaminari/_paginator.html.erb
  8. 2
      app/views/kaminari/_prev_page.html.erb

6
app/components/pagination_component/pagination_component.html.erb

@ -1,6 +1,6 @@
<div class="col col-md-12"> <div class="col col-md-12">
<header class="header bg-white b-b clearfix"> <header class="header bg-white b-b clearfix">
<div class="row m-t-sm"> <div class="row m-t-sm align-items-end pagination-body">
<div class="col-md-6"> <div class="col-md-6">
<% if opts[:is_subject_breadcrums].present? && subjects.present? %> <% if opts[:is_subject_breadcrums].present? && subjects.present? %>
<ol class="breadcrumb"> <ol class="breadcrumb">
@ -9,7 +9,7 @@
<li class="breadcrumb-item d-inline-flex"> <li class="breadcrumb-item d-inline-flex">
<h4> <%= link_to ancestor.name, subject_index_path(ancestor), class: "text-decoration-none" %> </h4> <h4> <%= link_to ancestor.name, subject_index_path(ancestor), class: "text-decoration-none" %> </h4>
</li> </li>
<% end %> <% end %>
<li class="breadcrumb-item d-inline-flex active"> <li class="breadcrumb-item d-inline-flex active">
<h4> <%= subject.name %> </h4> <h4> <%= subject.name %> </h4>
@ -17,7 +17,7 @@
<% end %> <% end %>
</ol> </ol>
<% else %> <% else %>
<h4 style="color: darkred">Search Results</h4> <h4 style="color: darkred" class="m-0">Search Results</h4>
<small style="color: darkred"> <small style="color: darkred">
<%= page_entries_info data, entry_name: 'records' if data.present? %> <%= page_entries_info data, entry_name: 'records' if data.present? %>
</small> </small>

7
app/javascript/src/application.scss

@ -1,6 +1,8 @@
@import "~bootstrap/scss/bootstrap"; @import "~bootstrap/scss/bootstrap";
@import "./application/sidenav"; @import "./application/sidenav";
@import "./application/sessions"; @import "./application/sessions";
@import "./application/pagination";
@import "./application/table";
.tableFixHead { .tableFixHead {
overflow: auto; overflow: auto;
@ -33,3 +35,8 @@
.accordion-button::after { .accordion-button::after {
margin-right: 10px; margin-right: 10px;
} }
.main-content-body {
min-height: 100vh !important;
overflow: auto;
}

9
app/javascript/src/application/pagination.scss

@ -0,0 +1,9 @@
.pagination-body .pagination .page-item a{
color: darkred;
}
.pagination-body .pagination span.page-item.page.current.page-link {
border: darkred;
background: darkred !important;
color: #fff !important;
}

2
app/views/kaminari/_first_page.html.erb

@ -7,5 +7,5 @@
remote: data-remote remote: data-remote
-%> -%>
<span class="page-item first"> <span class="page-item first">
<%= link_to_unless current_page.first?, t('views.pagination.first').html_safe, url, remote: remote, class: "page-link" %> <%= link_to_unless current_page.first?, '<i class="fas fa-angle-double-left"></i>'.html_safe, url, remote: remote, class: "page-link" %>
</span> </span>

2
app/views/kaminari/_last_page.html.erb

@ -7,5 +7,5 @@
remote: data-remote remote: data-remote
-%> -%>
<span class="page-item last"> <span class="page-item last">
<%= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, remote: remote, class: "page-link" %> <%= link_to_unless current_page.last?, '<i class="fas fa-angle-double-right"></i>'.html_safe, url, remote: remote, class: "page-link" %>
</span> </span>

2
app/views/kaminari/_next_page.html.erb

@ -7,5 +7,5 @@
remote: data-remote remote: data-remote
-%> -%>
<span class="page-item next"> <span class="page-item next">
<%= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, rel: 'next', remote: remote, class: "page-link" %> <%= link_to_unless current_page.last?, '<i class="fas fa-angle-right"></i>'.html_safe, url, rel: 'next', remote: remote, class: "page-link" %>
</span> </span>

2
app/views/kaminari/_paginator.html.erb

@ -7,7 +7,7 @@
paginator: the paginator that renders the pagination tags inside paginator: the paginator that renders the pagination tags inside
-%> -%>
<%= paginator.render do -%> <%= paginator.render do -%>
<nav class="pagination" role="navigation" aria-label="pager"> <nav class="pagination pagination-sm" role="navigation" aria-label="pager">
<%= first_page_tag unless current_page.first? %> <%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %> <%= prev_page_tag unless current_page.first? %>
<% each_page do |page| -%> <% each_page do |page| -%>

2
app/views/kaminari/_prev_page.html.erb

@ -7,5 +7,5 @@
remote: data-remote remote: data-remote
-%> -%>
<span class="page-item prev"> <span class="page-item prev">
<%= link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, rel: 'prev', remote: remote, class: "page-link" %> <%= link_to_unless current_page.first?, '<i class="fas fa-angle-left"></i>'.html_safe, url, rel: 'prev', remote: remote, class: "page-link" %>
</span> </span>

Loading…
Cancel
Save