smart_pagination 0.2.0 → 0.2.1

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: f29d971452750acea3f9548fb9db34b667c6f7e9
4
- data.tar.gz: 8d3f5f61fed10007efd7e610b9ad39edd6edf711
3
+ metadata.gz: 338a3e6b702bd084479deb4e0d2b0bc43038a496
4
+ data.tar.gz: 01fb72960591a31c7b1447a3336ec22114c58af3
5
5
  SHA512:
6
- metadata.gz: 4d2781df39f31e3aaa6545950e5419e955f8ff9d68ce43662edeaddd10482646e68f89ebed13d767d3997232d66d6bb8817e81481aea81ee912cdbb2fb8a8384
7
- data.tar.gz: 9011741512d6112cc6dc55f50027edfee3cb00a21d345963fef0b51148bfc88b2f2d5732f972bf5e986d33798949baa176d2c9025963fbd3fcb2f9fbef56f358
6
+ metadata.gz: 7812a25b268ee04edaec35ff04a8e57571a6d9531d2731361fd8c43789ae0063ba95fae9ff90d7528913084df3110960ca57c6fa3a3836943da19e68fd90340f
7
+ data.tar.gz: 240314d129d9c3a5d3c954d422fd4875cad9c6ae52da55a47d65dfa3028c2d7e1b0504371178952876dee43d873d8d89cdbfb9ce06ddc1fba536c45fcf51b569
data/README.md CHANGED
@@ -50,16 +50,23 @@ And finally you can use the `smart_pagination_for` or `pagination_for` helper in
50
50
  <%= smart_pagination_for(@users) %>
51
51
  ```
52
52
 
53
- If you want to render only previous and next links you can use the `smart_pager_for` or `pager_for` helper in your views:
53
+ If you want to render only previous and next links, you can use the `smart_pager_for` or `pager_for` helper in your views:
54
54
 
55
55
  ```ruby
56
56
  <%= smart_pager_for(@users) %>
57
57
  ```
58
58
 
59
+ If you want to render the pagination information text (Displaying x of y Items), you can use the `smart_pagination_info_for` or `pagination_info_for` helper in your views:
60
+
61
+ ```ruby
62
+ <%= smart_pagination_info_for(@users) %>
63
+ ```
64
+
59
65
  There are a number of options you can use to customize the pagination links. The default options are:
60
66
 
61
67
  ```ruby
62
68
  options = {
69
+ info_mode: false,
63
70
  pager_mode: false,
64
71
  item_class: '',
65
72
  previous_text: '&laquo;',
@@ -90,6 +90,12 @@ module SmartPagination
90
90
  @options[:info_mode].present?
91
91
  end
92
92
 
93
+ # Current url parameters
94
+ def url_params
95
+ url = URI.parse(@context.request.url)
96
+ Rack::Utils.parse_nested_query(url.query).symbolize_keys
97
+ end
98
+
93
99
  # Get page numbers
94
100
  def page_numbers
95
101
  inner = @options[:inner_window].to_i
@@ -186,7 +192,7 @@ module SmartPagination
186
192
 
187
193
  # Render link tag
188
194
  def link_to(text, params={}, html_options={})
189
- url = @context.url_for params.merge(per_page: per_page)
195
+ url = @context.url_for url_params.merge(params)
190
196
  opt = html_options.to_h
191
197
 
192
198
  opt.merge!(href: url) if params[:page].present?
@@ -1,3 +1,3 @@
1
1
  module SmartPagination
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
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.0
4
+ version: 0.2.1
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-06-15 00:00:00.000000000 Z
11
+ date: 2017-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: smart_paginate
@@ -86,7 +86,7 @@ dependencies:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '5.0'
89
- description: Adds view helpers for SmartPaginate. A simple, smart and clean pagination
89
+ description: View helpers for SmartPaginate. A simple, smart and clean pagination
90
90
  extension for Active Record and plain Ruby Arrays.
91
91
  email:
92
92
  - jonian@hardpixel.eu
@@ -95,7 +95,6 @@ extensions: []
95
95
  extra_rdoc_files: []
96
96
  files:
97
97
  - Gemfile
98
- - Gemfile.lock
99
98
  - LICENSE.txt
100
99
  - README.md
101
100
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,61 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- smart_pagination (0.1.0)
5
- actionview (>= 4.0.0, < 5.2)
6
- smart_paginate (~> 0.2)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actionview (5.1.1)
12
- activesupport (= 5.1.1)
13
- builder (~> 3.1)
14
- erubi (~> 1.4)
15
- rails-dom-testing (~> 2.0)
16
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
17
- activemodel (5.1.1)
18
- activesupport (= 5.1.1)
19
- activerecord (5.1.1)
20
- activemodel (= 5.1.1)
21
- activesupport (= 5.1.1)
22
- arel (~> 8.0)
23
- activesupport (5.1.1)
24
- concurrent-ruby (~> 1.0, >= 1.0.2)
25
- i18n (~> 0.7)
26
- minitest (~> 5.1)
27
- tzinfo (~> 1.1)
28
- arel (8.0.0)
29
- builder (3.2.3)
30
- concurrent-ruby (1.0.5)
31
- erubi (1.6.0)
32
- i18n (0.8.4)
33
- loofah (2.0.3)
34
- nokogiri (>= 1.5.9)
35
- mini_portile2 (2.1.0)
36
- minitest (5.10.2)
37
- nokogiri (1.7.2)
38
- mini_portile2 (~> 2.1.0)
39
- rails-dom-testing (2.0.3)
40
- activesupport (>= 4.2.0)
41
- nokogiri (>= 1.6)
42
- rails-html-sanitizer (1.0.3)
43
- loofah (~> 2.0)
44
- rake (10.5.0)
45
- smart_paginate (0.2.0)
46
- activerecord (>= 4.0.0, < 5.2)
47
- thread_safe (0.3.6)
48
- tzinfo (1.2.3)
49
- thread_safe (~> 0.1)
50
-
51
- PLATFORMS
52
- ruby
53
-
54
- DEPENDENCIES
55
- bundler (~> 1.14)
56
- minitest (~> 5.0)
57
- rake (~> 10.0)
58
- smart_pagination!
59
-
60
- BUNDLED WITH
61
- 1.14.6