smart_pagination 0.2.4 → 0.2.5

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: 145f8e33c31b461c53ad4fccb923d0956c461ede
4
- data.tar.gz: 2c5c0650cf4231a66c18232350f3a878fb2daf80
3
+ metadata.gz: 00e6fccac0756e19a50a2b3f358ada4f1f9869dd
4
+ data.tar.gz: d075f233e1aedc7e3b559a7fac659772be8ce9c5
5
5
  SHA512:
6
- metadata.gz: 21614fec26fb446aa71df2972bc04e4bbbe3b6494909710648f4d2ad33fc4cca35c0f4f9be4906e881b4548386b424906a400524947df753bd4e338c0ba716c1
7
- data.tar.gz: a3c27c79e1e02c8aeeabb7cd29a7950826ac0fd55e64e0bc643ac4f452e5a59ef9c56b64cab44837c690f70b388bb134f3ecec8c51bd14246d0b03da40adf3ba
6
+ metadata.gz: 5ece1130297f2a3590e8db2ff865b7df588ae12dd8c83d8ab044bd76ed16afb972f05a867e5f477571c1fb5a544ad40ff97b10792612314f2346e88da64d6be6
7
+ data.tar.gz: aea6aeb5174753f27674b369a5a7c7f6d2ca8201ca7815227849e7756fa8f8fee3ef1793d7569441e1bed768ce8554c9e13cf6a8b8a48bff96ed32310abdbc22
data/README.md CHANGED
@@ -68,6 +68,7 @@ There are a number of options you can use to customize the pagination links. The
68
68
  options = {
69
69
  info_mode: false,
70
70
  pager_mode: false,
71
+ auto_hide: false,
71
72
  item_class: '',
72
73
  previous_text: '«',
73
74
  previous_class: 'previous',
@@ -99,4 +100,4 @@ The gem is available as open source under the terms of the [MIT License](http://
99
100
 
100
101
  ## Code of Conduct
101
102
 
102
- Everyone interacting in the ActiveContent project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hardpixel/smart-pagination/blob/master/CODE_OF_CONDUCT.md).
103
+ Everyone interacting in the SmartPagination project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hardpixel/smart-pagination/blob/master/CODE_OF_CONDUCT.md).
@@ -9,7 +9,9 @@ module SmartPagination
9
9
 
10
10
  # Render pagination links
11
11
  def render
12
- if info_mode?
12
+ if auto_hide?
13
+ nil
14
+ elsif info_mode?
13
15
  pagination_info
14
16
  elsif pager_mode?
15
17
  pager
@@ -25,6 +27,7 @@ module SmartPagination
25
27
  {
26
28
  info_mode: false,
27
29
  pager_mode: false,
30
+ auto_hide: false,
28
31
  item_class: '',
29
32
  previous_text: '«',
30
33
  previous_class: 'previous',
@@ -80,6 +83,11 @@ module SmartPagination
80
83
  @total_entries ||= @collection.total_entries.to_i
81
84
  end
82
85
 
86
+ # Check if should hide pagination
87
+ def auto_hide?
88
+ @options[:auto_hide].present? and total_pages < 2
89
+ end
90
+
83
91
  # Check if pager mode enabled
84
92
  def pager_mode?
85
93
  @options[:pager_mode].present?
@@ -1,3 +1,3 @@
1
1
  module SmartPagination
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_pagination
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonian Guveli
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-14 00:00:00.000000000 Z
11
+ date: 2017-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: smart_paginate