kaminari 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of kaminari might be problematic. Click here for more details.
- data/CHANGELOG +6 -0
- data/README.rdoc +20 -14
- data/VERSION +1 -1
- data/kaminari.gemspec +2 -2
- data/lib/kaminari/helpers/action_view_extension.rb +2 -1
- data/lib/kaminari/helpers/tags.rb +2 -1
- metadata +4 -4
data/CHANGELOG
CHANGED
data/README.rdoc
CHANGED
@@ -27,9 +27,9 @@ The pagination helper outputs the HTML5 <nav> tag by default. Plus, the helper s
|
|
27
27
|
|
28
28
|
== Supported versions
|
29
29
|
|
30
|
-
* Ruby 1.8.7, 1.9.2, 1.9.3
|
30
|
+
* Ruby 1.8.7, 1.9.2, 1.9.3 (trunk)
|
31
31
|
|
32
|
-
* Rails 3.0.x, 3.1
|
32
|
+
* Rails 3.0.x, 3.1 (edge)
|
33
33
|
|
34
34
|
* Haml 3
|
35
35
|
|
@@ -47,16 +47,16 @@ Then bundle:
|
|
47
47
|
|
48
48
|
=== Query Basics
|
49
49
|
|
50
|
-
* the
|
50
|
+
* the +page+ scope
|
51
51
|
|
52
52
|
To fetch the 7th page of users (default +per_page+ is 25)
|
53
53
|
User.page(7)
|
54
54
|
|
55
|
-
* the
|
55
|
+
* the +per+ scope
|
56
56
|
|
57
57
|
To show a lot more users per each page (change the +per_page+ value)
|
58
58
|
User.page(7).per(50)
|
59
|
-
Note that the
|
59
|
+
Note that the +per+ scope is not directly defined on the models but is just a method defined on the page scope. This is absolutely reasonable because you will never actually use +per_page+ without specifying the +page+ number.
|
60
60
|
|
61
61
|
=== Configuring default +per_page+ value for each model
|
62
62
|
|
@@ -87,28 +87,33 @@ Then bundle:
|
|
87
87
|
|
88
88
|
* specifing the "inner window" size (4 by default)
|
89
89
|
|
90
|
-
This would output something like <tt>... 5 6 7 8 9 ...</tt> when 7 is the current page.
|
91
90
|
<%= paginate @users, :window => 2 %>
|
91
|
+
This would output something like <tt>... 5 6 7 8 9 ...</tt> when 7 is the current page.
|
92
92
|
|
93
93
|
* specifing the "outer window" size (1 by default)
|
94
94
|
|
95
|
-
This would output something like <tt>1 2 3 4 ...(snip)... 17 18 19 20</tt> while having 20 pages in total.
|
96
95
|
<%= paginate @users, :outer_window => 3 %>
|
96
|
+
This would output something like <tt>1 2 3 4 ...(snip)... 17 18 19 20</tt> while having 20 pages in total.
|
97
97
|
|
98
|
-
* outer window can be separetely specified by +left
|
98
|
+
* outer window can be separetely specified by +left+, +right+ (1 by default)
|
99
99
|
|
100
|
-
This would output something like <tt>1 ...(snip)... 18 19 20</tt> while having 20 pages in total.
|
101
100
|
<%= paginate @users, :left => 0, :right => 2 %>
|
101
|
+
This would output something like <tt>1 ...(snip)... 18 19 20</tt> while having 20 pages in total.
|
102
102
|
|
103
|
-
*
|
103
|
+
* changing the parameter name (:+param_name+) for the links
|
104
|
+
|
105
|
+
<%= paginate @users, :param_name => :pagina
|
106
|
+
This would modify the query parameter name on each links.
|
107
|
+
|
108
|
+
* extra parameters (:+params+) for the links
|
104
109
|
|
105
|
-
This would modify each link's +url_option+. +:controller+ and +:action+ might be the keys in common.
|
106
110
|
<%= paginate @users, :params => {:controller => 'foo', :action => 'bar'}
|
111
|
+
This would modify each link's +url_option+. :+controller+ and :+action+ might be the keys in common.
|
107
112
|
|
108
113
|
* Ajax links (crazy simple, but works perfectly!)
|
109
114
|
|
110
|
-
This would add <tt>data-remote="true"</tt> to all the links inside.
|
111
115
|
<%= paginate @users, :remote => true %>
|
116
|
+
This would add <tt>data-remote="true"</tt> to all the links inside.
|
112
117
|
|
113
118
|
=== I18n and labels
|
114
119
|
|
@@ -129,14 +134,15 @@ Kaminari includes a handy template generator.
|
|
129
134
|
* to edit your paginator
|
130
135
|
|
131
136
|
Run the generator first,
|
132
|
-
|
137
|
+
% rails g kaminari:views default
|
133
138
|
|
134
139
|
then edit the partials in your app's <tt>app/views/kaminari/</tt> directory.
|
135
140
|
|
136
141
|
* for Haml users
|
142
|
+
|
137
143
|
Haml templates generator is also available by adding the <tt>-e haml</tt> option (this is automatically invoked when the default template_engine is set to Haml).
|
138
144
|
|
139
|
-
|
145
|
+
% rails g kaminari:views default -e haml
|
140
146
|
|
141
147
|
* themes
|
142
148
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.2
|
data/kaminari.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{kaminari}
|
8
|
-
s.version = "0.10.
|
8
|
+
s.version = "0.10.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Akira Matsuda"]
|
12
|
-
s.date = %q{2011-02-
|
12
|
+
s.date = %q{2011-02-22}
|
13
13
|
s.description = %q{Kaminari is a Scope & Engine based clean and powerful and customizable and sophisticated paginator for Rails 3}
|
14
14
|
s.email = %q{ronnie@dio.jp}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -14,10 +14,11 @@ module Kaminari
|
|
14
14
|
# * <tt>:left</tt> - The "left outer window" size (1 by default).
|
15
15
|
# * <tt>:right</tt> - The "right outer window" size (1 by default).
|
16
16
|
# * <tt>:params</tt> - url_for parameters for the links (:controller, :action, etc.)
|
17
|
+
# * <tt>:param_name</tt> - parameter name for page number in the links (:page by default)
|
17
18
|
# * <tt>:remote</tt> - Ajax? (false by default)
|
18
19
|
# * <tt>:ANY_OTHER_VALUES</tt> - Any other hash key & values would be directly passed into each tag as :locals value.
|
19
20
|
def paginate(scope, options = {}, &block)
|
20
|
-
Kaminari::Helpers::PaginationRenderer.new self, options.reverse_merge(:current_page => scope.current_page, :num_pages => scope.num_pages, :per_page => scope.limit_value, :remote => false)
|
21
|
+
Kaminari::Helpers::PaginationRenderer.new self, options.reverse_merge(:current_page => scope.current_page, :num_pages => scope.num_pages, :per_page => scope.limit_value, :param_name => :page, :remote => false)
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
@@ -19,6 +19,7 @@ module Kaminari
|
|
19
19
|
class Tag
|
20
20
|
def initialize(template, options = {}) #:nodoc:
|
21
21
|
@template, @options = template, template.options.merge(options)
|
22
|
+
@param_name = @options.delete :param_name
|
22
23
|
end
|
23
24
|
|
24
25
|
def to_s(locals = {}) #:nodoc:
|
@@ -47,7 +48,7 @@ module Kaminari
|
|
47
48
|
end
|
48
49
|
|
49
50
|
def page_url_for(page)
|
50
|
-
@template.url_for @template.params.merge(
|
51
|
+
@template.url_for @template.params.merge(@param_name => (page <= 1 ? nil : page))
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaminari
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 10
|
9
|
-
-
|
10
|
-
version: 0.10.
|
9
|
+
- 2
|
10
|
+
version: 0.10.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Akira Matsuda
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-22 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|