kaminari 0.9.1 → 0.9.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 CHANGED
@@ -1,6 +1,12 @@
1
+ == 0.9.2
2
+
3
+ * stop adding extra LF between templates when joining
4
+
5
+ * githubish template theme [maztomo]
6
+
1
7
  == 0.9.1
2
8
 
3
- * googlish template theme
9
+ * googlish template theme [maztomo]
4
10
 
5
11
  == 0.9.0
6
12
 
data/README.rdoc CHANGED
@@ -40,64 +40,64 @@ Then bundle:
40
40
 
41
41
  === Query Basics
42
42
 
43
- * Fetch the 7th page of the users (per_page = 25 by default)
44
-
43
+ * the :page scope
44
+ To fetch the 7th page of the users (per_page = 25 by default)
45
45
  User.page(7)
46
46
 
47
- * Show a lot more users per each page (change the per_page value)
48
-
47
+ * the :per scope
48
+ To show a lot more users per each page (change the per_page value)
49
49
  User.page(7).per(50)
50
+ 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.
50
51
 
51
52
  === Controllers
52
53
 
53
- * Typically, your controller code will look like this:
54
-
54
+ * the page parameter is in params[:page]
55
+ Typically, your controller code will look like this:
55
56
  @users = User.order(:name).page params[:page]
56
57
 
57
58
  === Views
58
59
 
59
- * Just call the "paginate" helper
60
-
60
+ * the same old helper method
61
+ Just call the "paginate" helper:
61
62
  <%= paginate @users %>
63
+
62
64
  This will render several "?page=N" pagination links surrounded by an HTML5 <nav> tag.
63
65
 
64
66
  === Helper Options
65
67
 
66
- * Specifing the "inner window" size (4 by default)
67
-
68
- <%= paginate @users, :window => 3 %>
69
-
70
- * Specifing the "outer window" size (1 by default)
68
+ * specifing the "inner window" size (4 by default)
69
+ This would output something like ... 5 6 7 8 9 ... when 7 is the current page.
70
+ <%= paginate @users, :window => 2 %>
71
71
 
72
+ * specifing the "outer window" size (1 by default)
73
+ This would output something like 1 2 3 4 ...(snip)... 17 18 19 20 while having 20 pages in total.
72
74
  <%= paginate @users, :outer_window => 3 %>
73
75
 
74
76
  * outer window can be separetely specified by "left", "right" (1 by default)
75
-
77
+ This would output something like 1 ...(snip)... 18 19 20 while having 20 pages in total.
76
78
  <%= paginate @users, :left => 0, :right => 2 %>
77
79
 
78
80
  * Ajax links (crazy simple, but works perfectly!)
79
-
81
+ This would add data-remote="true" to all the links inside.
80
82
  <%= paginate @users, :remote => true %>
81
83
 
82
84
  === Customizing the pagination helper
83
85
 
84
86
  Kaminari includes a handy template generator.
85
87
 
86
- * The default generator
87
-
88
+ * to edit your paginator
89
+ Run the generator first,
88
90
  % rails g kaminari:views default
89
- Then edit the partials in your app's app/views/kaminari/ directory.
90
91
 
91
- * For Haml users
92
+ then edit the partials in your app's app/views/kaminari/ directory.
92
93
 
94
+ * for Haml users
93
95
  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
96
 
95
97
  % rails g kaminari:views default -e haml
96
98
 
97
99
  * themes
98
-
99
100
  Kaminari is shipped with template themes in addition to the "default" one, which will help you creating a nice looking paginator.
100
-
101
101
  % rails g kaminari:views THEME
102
102
 
103
103
  To see the full list of avaliable themes, just hit the generator without specifying THEME argument.
@@ -106,7 +106,7 @@ To see the full list of avaliable themes, just hit the generator without specify
106
106
 
107
107
  == Questions, Feedbacks
108
108
 
109
- Feel free to message me on Github (amatsuda) or Twitter (@a_matsuda) :)
109
+ Feel free to message me on Github (amatsuda) or Twitter (@a_matsuda) ☇☇☇ :)
110
110
 
111
111
 
112
112
  == Contributing to Kaminari
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.1
1
+ 0.9.2
@@ -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
+ <%# EMPTY! %>
@@ -0,0 +1,8 @@
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
+ -# EMPTY!
@@ -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
+ <%# EMPTY! %>
@@ -0,0 +1,8 @@
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
+ -# EMPTY!
@@ -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
+ <%# EMPTY! %>
@@ -0,0 +1,8 @@
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
+ -# EMPTY!
@@ -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
+ <%= link_to raw('Older &raquo;'), next_url, :remote => remote -%>
@@ -0,0 +1,7 @@
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
+ ~ link_to raw('Older &raquo;'), next_url, :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
+ <span class="disabled">Older &raquo;</span>
@@ -0,0 +1,6 @@
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
+ <span class="disabled">Older &raquo;</span>
@@ -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
+ <%# EMPTY! %>
@@ -0,0 +1,8 @@
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
+ -# EMPTY!
@@ -0,0 +1,14 @@
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
+ .pagination{padding:.3em;margin:.3em; font: 13.34px helvetica,arial,freesans,clean,sans-serif;}
9
+ .pagination a{padding:.1em .3em;margin:.2em;border:1px solid #aad;text-decoration:none;color:#369;}
10
+ .pagination a:hover,.pagination a:active{border:1px solid #369;color:#000;}
11
+ .pagination span.current{padding:.1em .3em;margin:.2em;border:1px solid #369;font-weight:bold;background-color:#369;color:#FFF;}
12
+ .pagination span.disabled{padding:.1em .3em;margin:.2em;border:1px solid #eee;color:#ddd;}
13
+ </style>
14
+ <div class="pagination"><%= content_for :kaminari_paginator_tags %></div>
@@ -0,0 +1,12 @@
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
+ .pagination{padding:.3em;margin:.3em; font: 13.34px helvetica,arial,freesans,clean,sans-serif;}
8
+ .pagination a{padding:.1em .3em;margin:.2em;border:1px solid #aad;text-decoration:none;color:#369;}
9
+ .pagination a:hover,.pagination a:active{border:1px solid #369;color:#000;}
10
+ .pagination span.current{padding:.1em .3em;margin:.2em;border:1px solid #369;font-weight:bold;background-color:#369;color:#FFF;}
11
+ .pagination span.disabled{padding:.1em .3em;margin:.2em;border:1px solid #eee;color:#ddd;}
12
+ .pagination= 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
+ <%= link_to raw('&laquo; Newer'), prev_url, :remote => remote -%>
@@ -0,0 +1,7 @@
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
+ ~ link_to raw('&laquo; Newer'), prev_url, :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
+ <%= content_tag :span, raw('&laquo; Newer'), :class => 'disabled' -%>
@@ -0,0 +1,6 @@
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
+ ~ content_tag :span, raw('&laquo; Newer'), :class => 'disabled'
@@ -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
+ <%# EMPTY! %>
@@ -0,0 +1,6 @@
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
+ -# EMPTY!
@@ -4,4 +4,4 @@
4
4
  per_page: number of items to fetch per page
5
5
  remote: data-remote
6
6
  %td.b
7
- %span.csb{:style => 'background-position:-96px 0;width:45px'
7
+ %span.csb{:style => 'background-position:-96px 0;width:45px'}
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.9.1"
8
+ s.version = "0.9.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-09}
12
+ s.date = %q{2011-02-10}
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 = [
@@ -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/github/_current_page.html.erb",
51
+ "app/views/kaminari/github/_current_page.html.haml",
52
+ "app/views/kaminari/github/_first_page_link.html.erb",
53
+ "app/views/kaminari/github/_first_page_link.html.haml",
54
+ "app/views/kaminari/github/_last_page_link.html.erb",
55
+ "app/views/kaminari/github/_last_page_link.html.haml",
56
+ "app/views/kaminari/github/_next_link.html.erb",
57
+ "app/views/kaminari/github/_next_link.html.haml",
58
+ "app/views/kaminari/github/_next_span.html.erb",
59
+ "app/views/kaminari/github/_next_span.html.haml",
60
+ "app/views/kaminari/github/_page_link.html.erb",
61
+ "app/views/kaminari/github/_page_link.html.haml",
62
+ "app/views/kaminari/github/_paginator.html.erb",
63
+ "app/views/kaminari/github/_paginator.html.haml",
64
+ "app/views/kaminari/github/_prev_link.html.erb",
65
+ "app/views/kaminari/github/_prev_link.html.haml",
66
+ "app/views/kaminari/github/_prev_span.html.erb",
67
+ "app/views/kaminari/github/_prev_span.html.haml",
68
+ "app/views/kaminari/github/_truncated_span.html.erb",
69
+ "app/views/kaminari/github/_truncated_span.html.haml",
50
70
  "app/views/kaminari/google/_current_page.html.erb",
51
71
  "app/views/kaminari/google/_current_page.html.haml",
52
72
  "app/views/kaminari/google/_first_page_link.html.erb",
@@ -16,6 +16,7 @@ rails g kaminari:views THEME [options]
16
16
  This one is used internally while you don't override the partials.
17
17
  google: Looks googlish! (note that this is just an example...)
18
18
  Make sure to specify a very big number (like 65536) for the "window" value.
19
+ github: A very simple one with only "Older" and "Newer" links.
19
20
  BANNER
20
21
  end
21
22
 
@@ -93,7 +93,7 @@ module Kaminari
93
93
  def to_s
94
94
  suppress_logging_render_partial do
95
95
  clear_content_for :kaminari_paginator_tags
96
- @template.content_for :kaminari_paginator_tags, tagify_links.join("\n").html_safe
96
+ @template.content_for :kaminari_paginator_tags, tagify_links.join.html_safe
97
97
  Paginator.new(self).to_s
98
98
  end
99
99
  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: 57
4
+ hash: 63
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 1
10
- version: 0.9.1
9
+ - 2
10
+ version: 0.9.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-09 00:00:00 +09:00
18
+ date: 2011-02-10 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -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/github/_current_page.html.erb
277
+ - app/views/kaminari/github/_current_page.html.haml
278
+ - app/views/kaminari/github/_first_page_link.html.erb
279
+ - app/views/kaminari/github/_first_page_link.html.haml
280
+ - app/views/kaminari/github/_last_page_link.html.erb
281
+ - app/views/kaminari/github/_last_page_link.html.haml
282
+ - app/views/kaminari/github/_next_link.html.erb
283
+ - app/views/kaminari/github/_next_link.html.haml
284
+ - app/views/kaminari/github/_next_span.html.erb
285
+ - app/views/kaminari/github/_next_span.html.haml
286
+ - app/views/kaminari/github/_page_link.html.erb
287
+ - app/views/kaminari/github/_page_link.html.haml
288
+ - app/views/kaminari/github/_paginator.html.erb
289
+ - app/views/kaminari/github/_paginator.html.haml
290
+ - app/views/kaminari/github/_prev_link.html.erb
291
+ - app/views/kaminari/github/_prev_link.html.haml
292
+ - app/views/kaminari/github/_prev_span.html.erb
293
+ - app/views/kaminari/github/_prev_span.html.haml
294
+ - app/views/kaminari/github/_truncated_span.html.erb
295
+ - app/views/kaminari/github/_truncated_span.html.haml
276
296
  - app/views/kaminari/google/_current_page.html.erb
277
297
  - app/views/kaminari/google/_current_page.html.haml
278
298
  - app/views/kaminari/google/_first_page_link.html.erb