diff options
author | hellekin <hellekin@cepheide.org> | 2020-10-06 18:45:11 +0200 |
---|---|---|
committer | hellekin <hellekin@cepheide.org> | 2020-10-06 18:45:11 +0200 |
commit | 77ffadf166b9bc02b8e66949b5157ebf8375ec35 (patch) | |
tree | 315ab887fc493abadad0cd784874039fdf55a834 | |
parent | ef5ceea94aa60c4df8c653495bfd2bf1eb40e65a (diff) | |
download | incommon-map-77ffadf166b9bc02b8e66949b5157ebf8375ec35.tar.gz |
User Kaminari gem for pagination
Since we're dealing with lots of resources, we need a way to
handle pagination. This gem seems to be the new kid on the block
and doing things right, including pagination by default an I18n
support. Let's see.
Kaminari: https://github.com/kaminari/kaminari
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 13 | ||||
-rw-r--r-- | config/initializers/kaminari_config.rb | 14 |
3 files changed, 29 insertions, 0 deletions
@@ -28,6 +28,8 @@ gem 'jbuilder', '~> 2.7' gem 'bitfields' # Use Discourse API gem 'discourse_api' +# User pagination +gem 'kaminari' # Enforce stable UUIDs for models gem 'uuid_parameter', '~> 0.2.5' diff --git a/Gemfile.lock b/Gemfile.lock index 7a464f2..6b28c92 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -83,6 +83,18 @@ GEM jbuilder (2.10.1) activesupport (>= 5.0.0) json (2.3.1) + kaminari (1.2.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.2.1) + kaminari-activerecord (= 1.2.1) + kaminari-core (= 1.2.1) + kaminari-actionview (1.2.1) + actionview + kaminari-core (= 1.2.1) + kaminari-activerecord (1.2.1) + activerecord + kaminari-core (= 1.2.1) + kaminari-core (1.2.1) listen (3.2.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -203,6 +215,7 @@ DEPENDENCIES byebug discourse_api jbuilder (~> 2.7) + kaminari listen (~> 3.2) pg (>= 0.18, < 2.0) pry diff --git a/config/initializers/kaminari_config.rb b/config/initializers/kaminari_config.rb new file mode 100644 index 0000000..4ba6ee3 --- /dev/null +++ b/config/initializers/kaminari_config.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +Kaminari.configure do |config| + # config.default_per_page = 25 + # 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.max_pages = nil + # config.params_on_first_page = false +end |