1
0
Fork 0

Install Kaminari

This commit is contained in:
Alex Kotov 2019-09-03 19:59:12 +05:00
parent 153cbf1be5
commit 451370df8a
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
12 changed files with 116 additions and 1 deletions

View file

@ -107,6 +107,10 @@ gem 'sidekiq', '~> 5.2'
# Helpers for the reCAPTCHA API.
gem 'recaptcha', '~> 4.13'
# Kaminari is a Scope & Engine based, clean, powerful, agnostic, customizable
# and sophisticated paginator for Rails 4+.
gem 'kaminari', '~> 1.1'
group :development, :test do
# factory_bot provides a framework and DSL for defining and using factories.
gem 'factory_bot_rails', '~> 4.10'

View file

@ -184,6 +184,18 @@ GEM
thor (>= 0.14, < 2.0)
json (2.2.0)
jwt (2.2.1)
kaminari (1.1.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.1.1)
kaminari-activerecord (= 1.1.1)
kaminari-core (= 1.1.1)
kaminari-actionview (1.1.1)
actionview
kaminari-core (= 1.1.1)
kaminari-activerecord (1.1.1)
activerecord
kaminari-core (= 1.1.1)
kaminari-core (1.1.1)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.7.0)
@ -450,6 +462,7 @@ DEPENDENCIES
font-awesome-sass (~> 5.5.0)
interactor (~> 3.1)
jquery-rails (~> 4.3)
kaminari (~> 1.1)
letter_opener (~> 1.6)
listen (>= 3.0.5, < 3.2)
omniauth (~> 1.9)
@ -489,4 +502,4 @@ RUBY VERSION
ruby 2.6.2p47
BUNDLED WITH
2.0.1
2.0.2

View file

@ -0,0 +1,7 @@
<li class="page-item">
<%= link_to_unless current_page.first?,
raw(translate('pagination.first')),
url,
remote: remote,
class: 'page-link' %>
</li>

View file

@ -0,0 +1,5 @@
<li class='page-item disabled'>
<%= link_to raw(translate('pagination.truncate')),
'#',
class: 'page-link' %>
</li>

View file

@ -0,0 +1,7 @@
<li class="page-item">
<%= link_to_unless current_page.last?,
raw(translate('pagination.last')),
url,
remote: remote,
class: 'page-link' %>
</li>

View file

@ -0,0 +1,8 @@
<li class="page-item">
<%= link_to_unless current_page.last?,
raw(translate('pagination.next')),
url,
rel: 'next',
remote: remote,
class: 'page-link' %>
</li>

View file

@ -0,0 +1,17 @@
<% if page.current? %>
<li class="page-item active">
<%= content_tag :a,
page,
data: { remote: remote },
rel: page.rel,
class: 'page-link' %>
</li>
<% else %>
<li class="page-item">
<%= link_to page,
url,
remote: remote,
rel: page.rel,
class: 'page-link' %>
</li>
<% end %>

View file

@ -0,0 +1,19 @@
<%= paginator.render do %>
<nav class="d-flex justify-content-center">
<ul class="pagination">
<%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>
<% each_page do |page| %>
<% if page.left_outer? || page.right_outer? || page.inside_window? %>
<%= page_tag page %>
<% elsif !page.was_truncated? -%>
<%= gap_tag %>
<% end %>
<% end %>
<%= next_page_tag unless current_page.last? %>
<%= last_page_tag unless current_page.last? %>
</ul>
</nav>
<% end %>

View file

@ -0,0 +1,8 @@
<li class="page-item">
<%= link_to_unless current_page.first?,
raw(translate('pagination.previous')),
url,
rel: 'prev',
remote: remote,
class: 'page-link' %>
</li>

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
Kaminari.configure do |config|
config.default_per_page = 10
# config.max_per_page = nil
# config.window = 4
# config.outer_window = 0
# config.left = 0
# config.right = 0
# config.page_method_name = :page
# config.param_name = :page
# config.params_on_first_page = false
end

View file

@ -0,0 +1,7 @@
en:
pagination:
first: '&laquo; First'
last: 'Last &raquo;'
previous: '&lsaquo; Prev'
next: 'Next &rsaquo;'
truncate: '&hellip;'

View file

@ -0,0 +1,7 @@
ru:
pagination:
first: '&laquo; Первая'
last: 'Последняя &raquo;'
previous: '&lsaquo; Пред.'
next: 'След. &rsaquo;'
truncate: '&hellip;'