kaminari-logarithmic 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 962826fa842b45f3e37e5b61296f16f8baab560b
4
- data.tar.gz: e9a3d9f8e9539b84526056acffa3af1fbc17a449
3
+ metadata.gz: e8bf3d87c81ba89dd3da95c28f4551d53bbf34de
4
+ data.tar.gz: 3a682953b85968b06d721388a7f92e2a12cbfb60
5
5
  SHA512:
6
- metadata.gz: ef7496175482093639ed57a59dbba40178117fd01bade464fb331f5d2ec08ecc0d0c2459a6f9795e2569e1bbf6c6effc088d7b3de8ed45adbef415c903f3a050
7
- data.tar.gz: fd33a556b2819a0fca4a6c81def08b4a944029dc87648d4ff483ad69c8543f4ebd56a6d4688d29ae8db7bc530b1a4fce1e67d8ab9910b54ff04a165eaceb6da2
6
+ metadata.gz: d0f0ebb09058cbe59bf06949c38610242e46d01028dad4a204711a57a0fe3ceb1da8184a2bf2ab2fc539047ddd48c3d64ee2066d6dae7adf0f198c3a84529548
7
+ data.tar.gz: 133c54bf5aebae420014eae36b2754c07f18526d969aa3a7bf0ec936c1c35df330653ed460acc89b56c86491a08b33fa486dc2052116ca07b20c11f278218cad
data/.gitignore CHANGED
@@ -13,3 +13,4 @@
13
13
  *.a
14
14
  mkmf.log
15
15
  *.DS_Store
16
+ *.gem
data/README.md CHANGED
@@ -18,6 +18,33 @@ Or install it yourself as:
18
18
 
19
19
  $ gem install kaminari-logarithmic
20
20
 
21
+ **Important**
22
+
23
+ Currently you will not see any changes if you use default kaminari views. To make it work you should customize views.
24
+
25
+ 1. First you should generate partials in `app/views/kaminari` folder (skip if you did that earlier):
26
+
27
+ ```ruby
28
+ rails g kaminari:views default
29
+ ```
30
+ More details and options on [kaminari documentation page](https://github.com/amatsuda/kaminari).
31
+ 2. Assuming you generated views in `erb` format find following lines in _paginator.erb partial:
32
+
33
+ ```ruby
34
+ <% if page.left_outer? || page.right_outer? || page.inside_window? -%>
35
+ <%= page_tag page %>
36
+ ```
37
+
38
+ 3. Add special condition (or supply your custom logic) :
39
+ ```
40
+ page.logarithmic?
41
+ ```
42
+ Example:
43
+ ```ruby
44
+ <% if page.left_outer? || page.right_outer? || page.inside_window? || page.logaritmic? -%>
45
+ <%= page_tag page %>
46
+ ```
47
+
21
48
  ## Usage
22
49
 
23
50
  Do all the pagination stuff in controller and model usually. In your view use special helper instead of `paginate`:
@@ -1,7 +1,7 @@
1
1
  module Kaminari
2
2
  module Logarithmic
3
3
  module PageProxyExtension
4
- def logaritmic_page?
4
+ def logaritmic?
5
5
  @options[:logarithmic_pages].include? @page
6
6
  end
7
7
  end
@@ -23,14 +23,6 @@ module Kaminari
23
23
 
24
24
  private
25
25
 
26
- def enough?(value)
27
- if asc?
28
- value < @global_finish
29
- else
30
- value > @global_finish
31
- end
32
- end
33
-
34
26
  def next_finish(start, step)
35
27
  variants = [@global_finish, next_point(start, step * @base)]
36
28
  asc? ? variants.min : variants.max
@@ -1,5 +1,5 @@
1
1
  module Kaminari
2
2
  module Logarithmic
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaminari-logarithmic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Lee