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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8bf3d87c81ba89dd3da95c28f4551d53bbf34de
|
4
|
+
data.tar.gz: 3a682953b85968b06d721388a7f92e2a12cbfb60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0f0ebb09058cbe59bf06949c38610242e46d01028dad4a204711a57a0fe3ceb1da8184a2bf2ab2fc539047ddd48c3d64ee2066d6dae7adf0f198c3a84529548
|
7
|
+
data.tar.gz: 133c54bf5aebae420014eae36b2754c07f18526d969aa3a7bf0ec936c1c35df330653ed460acc89b56c86491a08b33fa486dc2052116ca07b20c11f278218cad
|
data/.gitignore
CHANGED
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`:
|
@@ -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
|