kaminari 0.9.0 → 0.9.1
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 +4 -0
- data/README.rdoc +20 -4
- data/VERSION +1 -1
- data/app/views/kaminari/_next_link.html.erb +1 -1
- data/app/views/kaminari/_next_link.html.haml +1 -1
- data/app/views/kaminari/_prev_link.html.erb +1 -1
- data/app/views/kaminari/_prev_link.html.haml +1 -1
- data/app/views/kaminari/google/_current_page.html.erb +9 -0
- data/app/views/kaminari/google/_current_page.html.haml +10 -0
- data/app/views/kaminari/google/_first_page_link.html.erb +10 -0
- data/app/views/kaminari/google/_first_page_link.html.haml +9 -0
- data/app/views/kaminari/google/_last_page_link.html.erb +10 -0
- data/app/views/kaminari/google/_last_page_link.html.haml +9 -0
- data/app/views/kaminari/google/_next_link.html.erb +8 -0
- data/app/views/kaminari/google/_next_link.html.haml +8 -0
- data/app/views/kaminari/google/_next_span.html.erb +7 -0
- data/app/views/kaminari/google/_next_span.html.haml +7 -0
- data/app/views/kaminari/google/_page_link.html.erb +9 -0
- data/app/views/kaminari/google/_page_link.html.haml +9 -0
- data/app/views/kaminari/google/_paginator.html.erb +19 -0
- data/app/views/kaminari/google/_paginator.html.haml +20 -0
- data/app/views/kaminari/google/_prev_link.html.erb +8 -0
- data/app/views/kaminari/google/_prev_link.html.haml +8 -0
- data/app/views/kaminari/google/_prev_span.html.erb +7 -0
- data/app/views/kaminari/google/_prev_span.html.haml +7 -0
- data/app/views/kaminari/google/_truncated_span.html.erb +7 -0
- data/app/views/kaminari/google/_truncated_span.html.haml +6 -0
- data/kaminari.gemspec +21 -1
- data/lib/generators/kaminari/views_generator.rb +22 -4
- metadata +23 -3
data/CHANGELOG
CHANGED
data/README.rdoc
CHANGED
@@ -81,16 +81,32 @@ This will render several "?page=N" pagination links surrounded by an HTML5 <nav>
|
|
81
81
|
|
82
82
|
=== Customizing the pagination helper
|
83
83
|
|
84
|
-
|
84
|
+
Kaminari includes a handy template generator.
|
85
85
|
|
86
|
-
|
86
|
+
* The default generator
|
87
|
+
|
88
|
+
% rails g kaminari:views default
|
87
89
|
Then edit the partials in your app's app/views/kaminari/ directory.
|
88
90
|
|
89
91
|
* For Haml users
|
90
92
|
|
91
|
-
Haml templates generator is also available by adding "-e haml" option.
|
93
|
+
Haml templates generator is also available by adding "-e haml" option (this would actually be automatically invoked while the default template_engine is set to Haml).
|
94
|
+
|
95
|
+
% rails g kaminari:views default -e haml
|
96
|
+
|
97
|
+
* themes
|
98
|
+
|
99
|
+
Kaminari is shipped with template themes in addition to the "default" one, which will help you creating a nice looking paginator.
|
100
|
+
|
101
|
+
% rails g kaminari:views THEME
|
102
|
+
|
103
|
+
To see the full list of avaliable themes, just hit the generator without specifying THEME argument.
|
104
|
+
% rails g kaminari:views
|
105
|
+
|
106
|
+
|
107
|
+
== Questions, Feedbacks
|
92
108
|
|
93
|
-
|
109
|
+
Feel free to message me on Github (amatsuda) or Twitter (@a_matsuda) :)
|
94
110
|
|
95
111
|
|
96
112
|
== Contributing to Kaminari
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.1
|
@@ -6,5 +6,5 @@
|
|
6
6
|
remote: data-remote
|
7
7
|
-%>
|
8
8
|
<span class="next">
|
9
|
-
<%=
|
9
|
+
<%= link_to raw('Next »'), next_url, :class => 'next', :rel => 'next', :remote => remote %>
|
10
10
|
</span>
|
@@ -5,4 +5,4 @@
|
|
5
5
|
per_page: number of items to fetch per page
|
6
6
|
remote: data-remote
|
7
7
|
%span.next
|
8
|
-
=
|
8
|
+
= link_to raw('Next »'), next_url, :class => 'next', :rel => 'next', :remote => remote
|
@@ -6,5 +6,5 @@
|
|
6
6
|
remote: data-remote
|
7
7
|
-%>
|
8
8
|
<span class="prev">
|
9
|
-
<%=
|
9
|
+
<%= link_to raw('« Prev'), prev_url, :class => 'prev', :rel => 'prev', :remote => remote %>
|
10
10
|
</span>
|
@@ -5,4 +5,4 @@
|
|
5
5
|
per_page: number of items to fetch per page
|
6
6
|
remote: data-remote
|
7
7
|
%span.prev
|
8
|
-
=
|
8
|
+
= link_to raw('« Prev'), prev_url, :class => 'prev', :rel => 'prev', :remote => remote
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%# available local variables:
|
2
|
+
page: the page number of this page
|
3
|
+
page_url: url to this page
|
4
|
+
current_page: the page number of currently displayed page
|
5
|
+
num_pages: total number of pages
|
6
|
+
per_page: number of items to fetch per page
|
7
|
+
remote: data-remote
|
8
|
+
-%>
|
9
|
+
<td class="cur"><span class="csb" style="background-position:-53px 0;width:20px"></span><%= page %></td>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
-# available local variables:
|
2
|
+
page: the page number of this page
|
3
|
+
page_url: url to this page
|
4
|
+
current_page: the page number of currently displayed page
|
5
|
+
num_pages: total number of pages
|
6
|
+
per_page: number of items to fetch per page
|
7
|
+
remote: data-remote
|
8
|
+
%td.cur
|
9
|
+
%span.csb{:style => 'background-position:-53px 0;width:20px'}
|
10
|
+
= page
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%# available local variables:
|
2
|
+
page: the page number of this page
|
3
|
+
page_url: url to this page
|
4
|
+
current_page: the page number of currently displayed page
|
5
|
+
num_pages: total number of pages
|
6
|
+
per_page: number of items to fetch per page
|
7
|
+
remote: data-remote
|
8
|
+
-%>
|
9
|
+
<%# this kind of works even though looks a bit hackish... -%>
|
10
|
+
<%= render :partial => 'kaminari/page_link', :locals => @_partial_renderer.instance_variable_get('@locals') %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
-# available local variables:
|
2
|
+
page: the page number of this page
|
3
|
+
page_url: url to this page
|
4
|
+
current_page: the page number of currently displayed page
|
5
|
+
num_pages: total number of pages
|
6
|
+
per_page: number of items to fetch per page
|
7
|
+
remote: data-remote
|
8
|
+
-# this kind of works even though looks a bit hackish...
|
9
|
+
= render :partial => 'kaminari/page_link', :locals => @_partial_renderer.instance_variable_get('@locals')
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%# available local variables:
|
2
|
+
page: the page number of this page
|
3
|
+
page_url: url to this page
|
4
|
+
current_page: the page number of currently displayed page
|
5
|
+
num_pages: total number of pages
|
6
|
+
per_page: number of items to fetch per page
|
7
|
+
remote: data-remote
|
8
|
+
-%>
|
9
|
+
<%# this kind of works even though looks a bit hackish... -%>
|
10
|
+
<%= render :partial => 'kaminari/page_link', :locals => @_partial_renderer.instance_variable_get('@locals') %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
-# available local variables:
|
2
|
+
page: the page number of this page
|
3
|
+
page_url: url to this page
|
4
|
+
current_page: the page number of currently displayed page
|
5
|
+
num_pages: total number of pages
|
6
|
+
per_page: number of items to fetch per page
|
7
|
+
remote: data-remote
|
8
|
+
-# this kind of works even though looks a bit hackish...
|
9
|
+
= render :partial => 'kaminari/page_link', :locals => @_partial_renderer.instance_variable_get('@locals')
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%# available local variables:
|
2
|
+
next_url: url to the next page
|
3
|
+
current_page: the page number of currently displayed page
|
4
|
+
num_pages: total number of pages
|
5
|
+
per_page: number of items to fetch per page
|
6
|
+
remote: data-remote
|
7
|
+
-%>
|
8
|
+
<td class="b"><%= link_to raw('<span class="csb ch" style="background-position:-96px 0;width:71px"></span><span style="display:block;margin-left:53px;text-decoration:underline">Next</span>'), next_url, :class => 'pn knavi', :id => 'pnnext', :style => 'text-align:left;text-decoration:none', :remote => remote %></td>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
-# available local variables:
|
2
|
+
next_url: url to the next page
|
3
|
+
current_page: the page number of currently displayed page
|
4
|
+
num_pages: total number of pages
|
5
|
+
per_page: number of items to fetch per page
|
6
|
+
remote: data-remote
|
7
|
+
%td.b
|
8
|
+
= link_to raw('<span class="csb ch" style="background-position:-96px 0;width:71px"></span><span style="display:block;margin-left:53px;text-decoration:underline">Next</span>'), next_url, :class => 'pn knavi', :id => 'pnnext', :style => 'text-align:left;text-decoration:none', :remote => remote
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<%# available local variables:
|
2
|
+
current_page: the page number of currently displayed page
|
3
|
+
num_pages: total number of pages
|
4
|
+
per_page: number of items to fetch per page
|
5
|
+
remote: data-remote
|
6
|
+
-%>
|
7
|
+
<td class="b"><span class="csb" style="background-position:-96px 0;width:45px"></span></td>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%# available local variables:
|
2
|
+
page: the page number of this page
|
3
|
+
page_url: url to this page
|
4
|
+
current_page: the page number of currently displayed page
|
5
|
+
num_pages: total number of pages
|
6
|
+
per_page: number of items to fetch per page
|
7
|
+
remote: data-remote
|
8
|
+
-%>
|
9
|
+
<td><%= link_to raw(%Q[<span class="csb ch" style="background-position:-74px 0;width:20px"></span>#{page}]), page_url, :class => 'fl', :remote => remote %></td>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
-# available local variables:
|
2
|
+
page: the page number of this page
|
3
|
+
page_url: url to this page
|
4
|
+
current_page: the page number of currently displayed page
|
5
|
+
num_pages: total number of pages
|
6
|
+
per_page: number of items to fetch per page
|
7
|
+
remote: data-remote
|
8
|
+
%td
|
9
|
+
= link_to raw(%Q[<span class="csb ch" style="background-position:-74px 0;width:20px"></span>#{page}]), page_url, :class => 'fl', :remote => remote
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%# available local variables:
|
2
|
+
current_page: the page number of currently displayed page
|
3
|
+
num_pages: total number of pages
|
4
|
+
per_page: number of items to fetch per page
|
5
|
+
remote: data-remote
|
6
|
+
-%>
|
7
|
+
<style>
|
8
|
+
#nav a{display:block}
|
9
|
+
#nav td{padding:0;text-align:center}
|
10
|
+
.cur {font-weight:bold}
|
11
|
+
.csb {background:url(http://www.google.co.jp/images/srpr/nav_logo27.png) no-repeat;overflow:hidden;background-position:0 0;height:40px;display:block}
|
12
|
+
#nav {font-family: arial,sans-serif; font-size:small}
|
13
|
+
#nav a:link {text-decoration:none; color:#4496d3}
|
14
|
+
#nav a:hover {text-decoration:underline}
|
15
|
+
#nav a:active {color:#c11}
|
16
|
+
#nav a:visited {color:#2200C1}
|
17
|
+
.b {font-weight:bold}
|
18
|
+
</style>
|
19
|
+
<table id="nav" style="border-collapse:collapse;text-align:left;direction:ltr;margin:17px auto 0"><tbody><tr valign="top"><%= content_for :kaminari_paginator_tags %></tr></tbody></table>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
-# available local variables:
|
2
|
+
current_page: the page number of currently displayed page
|
3
|
+
num_pages: total number of pages
|
4
|
+
per_page: number of items to fetch per page
|
5
|
+
remote: data-remote
|
6
|
+
:css
|
7
|
+
#nav a{display:block}
|
8
|
+
#nav td{padding:0;text-align:center}
|
9
|
+
.cur {font-weight:bold}
|
10
|
+
.csb {background:url(http://www.google.co.jp/images/srpr/nav_logo27.png) no-repeat;overflow:hidden;background-position:0 0;height:40px;display:block}
|
11
|
+
#nav {font-family: arial,sans-serif; font-size:small}
|
12
|
+
#nav a:link {text-decoration:none; color:#4496d3}
|
13
|
+
#nav a:hover {text-decoration:underline}
|
14
|
+
#nav a:active {color:#c11}
|
15
|
+
#nav a:visited {color:#2200C1}
|
16
|
+
.b {font-weight:bold}
|
17
|
+
%table#nav{:style => 'border-collapse:collapse;text-align:left;direction:ltr;margin:17px auto 0'}
|
18
|
+
%tbody
|
19
|
+
%tr{:valign => 'top'}
|
20
|
+
= content_for :kaminari_paginator_tags
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%# available local variables:
|
2
|
+
prev_url: url to the previous page
|
3
|
+
current_page: the page number of currently displayed page
|
4
|
+
num_pages: total number of pages
|
5
|
+
per_page: number of items to fetch per page
|
6
|
+
remote: data-remote
|
7
|
+
-%>
|
8
|
+
<td class="b"><%= link_to raw('<span class="csb ch" style="background-position:0 0;float:right;width:53px"></span><span style="display:block;margin-right:35px;clear:right;text-decoration:underline">Previous</span>'), prev_url, :class => 'pn knavi', :id => 'pnprev', :style => 'text-decoration:none', :remote => remote %></td>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
-# available local variables:
|
2
|
+
prev_url: url to the previous page
|
3
|
+
current_page: the page number of currently displayed page
|
4
|
+
num_pages: total number of pages
|
5
|
+
per_page: number of items to fetch per page
|
6
|
+
remote: data-remote
|
7
|
+
%td.b
|
8
|
+
= link_to raw('<span class="csb ch" style="background-position:0 0;float:right;width:53px"></span><span style="display:block;margin-right:35px;clear:right;text-decoration:underline">Previous</span>'), prev_url, :class => 'pn knavi', :id => 'pnprev', :style => 'text-decoration:none', :remote => remote
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<%# available local variables:
|
2
|
+
current_page: the page number of currently displayed page
|
3
|
+
num_pages: total number of pages
|
4
|
+
per_page: number of items to fetch per page
|
5
|
+
remote: data-remote
|
6
|
+
-%>
|
7
|
+
<td class="b"><span class="csb" style="background-position:-24px 0;width:28px"></span></td>
|
data/kaminari.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{kaminari}
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.1"
|
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"]
|
@@ -47,6 +47,26 @@ Gem::Specification.new do |s|
|
|
47
47
|
"app/views/kaminari/_prev_span.html.haml",
|
48
48
|
"app/views/kaminari/_truncated_span.html.erb",
|
49
49
|
"app/views/kaminari/_truncated_span.html.haml",
|
50
|
+
"app/views/kaminari/google/_current_page.html.erb",
|
51
|
+
"app/views/kaminari/google/_current_page.html.haml",
|
52
|
+
"app/views/kaminari/google/_first_page_link.html.erb",
|
53
|
+
"app/views/kaminari/google/_first_page_link.html.haml",
|
54
|
+
"app/views/kaminari/google/_last_page_link.html.erb",
|
55
|
+
"app/views/kaminari/google/_last_page_link.html.haml",
|
56
|
+
"app/views/kaminari/google/_next_link.html.erb",
|
57
|
+
"app/views/kaminari/google/_next_link.html.haml",
|
58
|
+
"app/views/kaminari/google/_next_span.html.erb",
|
59
|
+
"app/views/kaminari/google/_next_span.html.haml",
|
60
|
+
"app/views/kaminari/google/_page_link.html.erb",
|
61
|
+
"app/views/kaminari/google/_page_link.html.haml",
|
62
|
+
"app/views/kaminari/google/_paginator.html.erb",
|
63
|
+
"app/views/kaminari/google/_paginator.html.haml",
|
64
|
+
"app/views/kaminari/google/_prev_link.html.erb",
|
65
|
+
"app/views/kaminari/google/_prev_link.html.haml",
|
66
|
+
"app/views/kaminari/google/_prev_span.html.erb",
|
67
|
+
"app/views/kaminari/google/_prev_span.html.haml",
|
68
|
+
"app/views/kaminari/google/_truncated_span.html.erb",
|
69
|
+
"app/views/kaminari/google/_truncated_span.html.haml",
|
50
70
|
"kaminari.gemspec",
|
51
71
|
"lib/generators/kaminari/views_generator.rb",
|
52
72
|
"lib/kaminari.rb",
|
@@ -1,20 +1,38 @@
|
|
1
1
|
module Kaminari
|
2
2
|
module Generators
|
3
|
-
class ViewsGenerator < Rails::Generators::
|
3
|
+
class ViewsGenerator < Rails::Generators::NamedBase
|
4
4
|
source_root File.expand_path('../../../../app/views/kaminari', __FILE__)
|
5
5
|
|
6
6
|
class_option :template_engine, :type => :string, :aliases => '-e', :desc => 'Template engine for the views. Available options are "erb" and "haml".'
|
7
7
|
|
8
|
-
|
8
|
+
def self.banner
|
9
|
+
<<-BANNER.chomp
|
10
|
+
rails g kaminari:views THEME [options]
|
11
|
+
|
12
|
+
Copies all paginator partial templates to your application.
|
13
|
+
You can choose a template THEME by specifying one from the list below:
|
14
|
+
|
15
|
+
default: The default one.
|
16
|
+
This one is used internally while you don't override the partials.
|
17
|
+
google: Looks googlish! (note that this is just an example...)
|
18
|
+
Make sure to specify a very big number (like 65536) for the "window" value.
|
19
|
+
BANNER
|
20
|
+
end
|
21
|
+
|
22
|
+
desc ''
|
9
23
|
def copy_views
|
10
24
|
Dir.glob(filename_pattern).map {|f| File.basename f}.each do |f|
|
11
|
-
copy_file f, "app/views/kaminari/#{f}"
|
25
|
+
copy_file File.join([template_name.presence, f].compact), "app/views/kaminari/#{f}"
|
12
26
|
end
|
13
27
|
end
|
14
28
|
|
15
29
|
private
|
30
|
+
def template_name
|
31
|
+
(f = file_name.downcase) == 'default' ? '' : f
|
32
|
+
end
|
33
|
+
|
16
34
|
def filename_pattern
|
17
|
-
File.join self.class.source_root, "*.html.#{options[:template_engine] || 'erb'}"
|
35
|
+
File.join self.class.source_root, template_name, "*.html.#{options[:template_engine].try(:to_s).try(:downcase) || 'erb'}"
|
18
36
|
end
|
19
37
|
end
|
20
38
|
end
|
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: 57
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 1
|
10
|
+
version: 0.9.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Akira Matsuda
|
@@ -273,6 +273,26 @@ files:
|
|
273
273
|
- app/views/kaminari/_prev_span.html.haml
|
274
274
|
- app/views/kaminari/_truncated_span.html.erb
|
275
275
|
- app/views/kaminari/_truncated_span.html.haml
|
276
|
+
- app/views/kaminari/google/_current_page.html.erb
|
277
|
+
- app/views/kaminari/google/_current_page.html.haml
|
278
|
+
- app/views/kaminari/google/_first_page_link.html.erb
|
279
|
+
- app/views/kaminari/google/_first_page_link.html.haml
|
280
|
+
- app/views/kaminari/google/_last_page_link.html.erb
|
281
|
+
- app/views/kaminari/google/_last_page_link.html.haml
|
282
|
+
- app/views/kaminari/google/_next_link.html.erb
|
283
|
+
- app/views/kaminari/google/_next_link.html.haml
|
284
|
+
- app/views/kaminari/google/_next_span.html.erb
|
285
|
+
- app/views/kaminari/google/_next_span.html.haml
|
286
|
+
- app/views/kaminari/google/_page_link.html.erb
|
287
|
+
- app/views/kaminari/google/_page_link.html.haml
|
288
|
+
- app/views/kaminari/google/_paginator.html.erb
|
289
|
+
- app/views/kaminari/google/_paginator.html.haml
|
290
|
+
- app/views/kaminari/google/_prev_link.html.erb
|
291
|
+
- app/views/kaminari/google/_prev_link.html.haml
|
292
|
+
- app/views/kaminari/google/_prev_span.html.erb
|
293
|
+
- app/views/kaminari/google/_prev_span.html.haml
|
294
|
+
- app/views/kaminari/google/_truncated_span.html.erb
|
295
|
+
- app/views/kaminari/google/_truncated_span.html.haml
|
276
296
|
- kaminari.gemspec
|
277
297
|
- lib/generators/kaminari/views_generator.rb
|
278
298
|
- lib/kaminari.rb
|