kaminari 0.9.3 → 0.9.4
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/VERSION +1 -1
- data/app/views/kaminari/_current_page.html.erb +7 -7
- data/app/views/kaminari/_current_page.html.haml +7 -7
- data/app/views/kaminari/_first_page_link.html.erb +9 -8
- data/app/views/kaminari/_first_page_link.html.haml +9 -8
- data/app/views/kaminari/_last_page_link.html.erb +9 -8
- data/app/views/kaminari/_last_page_link.html.haml +9 -8
- data/app/views/kaminari/_next_link.html.erb +8 -7
- data/app/views/kaminari/_next_link.html.haml +8 -7
- data/app/views/kaminari/_next_span.html.erb +6 -5
- data/app/views/kaminari/_next_span.html.haml +6 -5
- data/app/views/kaminari/_page_link.html.erb +9 -8
- data/app/views/kaminari/_page_link.html.haml +9 -8
- data/app/views/kaminari/_paginator.html.erb +6 -5
- data/app/views/kaminari/_paginator.html.haml +6 -5
- data/app/views/kaminari/_prev_link.html.erb +8 -7
- data/app/views/kaminari/_prev_link.html.haml +8 -7
- data/app/views/kaminari/_prev_span.html.erb +6 -5
- data/app/views/kaminari/_prev_span.html.haml +6 -5
- data/app/views/kaminari/_truncated_span.html.erb +6 -5
- data/app/views/kaminari/_truncated_span.html.haml +6 -5
- data/app/views/kaminari/github/_current_page.html.erb +0 -8
- data/app/views/kaminari/github/_current_page.html.haml +0 -7
- data/app/views/kaminari/github/_next_link.html.erb +1 -8
- data/app/views/kaminari/github/_next_link.html.haml +1 -7
- data/app/views/kaminari/github/_next_span.html.erb +0 -6
- data/app/views/kaminari/github/_next_span.html.haml +0 -5
- data/app/views/kaminari/github/_page_link.html.erb +0 -8
- data/app/views/kaminari/github/_page_link.html.haml +0 -7
- data/app/views/kaminari/github/_paginator.html.erb +0 -6
- data/app/views/kaminari/github/_paginator.html.haml +0 -5
- data/app/views/kaminari/github/_prev_link.html.erb +1 -8
- data/app/views/kaminari/github/_prev_link.html.haml +1 -7
- data/app/views/kaminari/github/_prev_span.html.erb +0 -6
- data/app/views/kaminari/github/_prev_span.html.haml +0 -5
- data/app/views/kaminari/github/_truncated_span.html.erb +0 -6
- data/app/views/kaminari/github/_truncated_span.html.haml +0 -5
- data/app/views/kaminari/google/_current_page.html.erb +0 -8
- data/app/views/kaminari/google/_current_page.html.haml +0 -7
- data/app/views/kaminari/google/_next_link.html.erb +1 -8
- data/app/views/kaminari/google/_next_link.html.haml +1 -7
- data/app/views/kaminari/google/_next_span.html.erb +0 -6
- data/app/views/kaminari/google/_next_span.html.haml +0 -5
- data/app/views/kaminari/google/_page_link.html.erb +1 -9
- data/app/views/kaminari/google/_page_link.html.haml +1 -8
- data/app/views/kaminari/google/_paginator.html.erb +0 -6
- data/app/views/kaminari/google/_paginator.html.haml +0 -5
- data/app/views/kaminari/google/_prev_link.html.erb +1 -8
- data/app/views/kaminari/google/_prev_link.html.haml +1 -7
- data/app/views/kaminari/google/_prev_span.html.erb +0 -6
- data/app/views/kaminari/google/_prev_span.html.haml +0 -5
- data/app/views/kaminari/google/_truncated_span.html.erb +0 -6
- data/app/views/kaminari/google/_truncated_span.html.haml +0 -5
- data/kaminari.gemspec +3 -1
- data/lib/kaminari/helpers.rb +17 -6
- data/lib/kaminari/tags.rb +67 -28
- data/spec/helpers/tags_spec.rb +26 -0
- metadata +5 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.4
|
@@ -1,9 +1,9 @@
|
|
1
|
-
<%#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
<%# The current page
|
2
|
+
- available local variables
|
3
|
+
page: the page number of 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
8
|
-%>
|
9
9
|
<span class="page current"><%= page %></span>
|
@@ -1,9 +1,9 @@
|
|
1
|
-
-#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
-# The current page
|
2
|
+
- available local variables
|
3
|
+
page: the page number of 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
8
|
%span.page.current
|
9
9
|
= page
|
@@ -1,11 +1,12 @@
|
|
1
|
-
<%#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
<%# Link with page number that appears at the leftmost
|
2
|
+
- available local variables
|
3
|
+
page: the page number of this page
|
4
|
+
url: url to this page
|
5
|
+
current_page: the page number of currently displayed page
|
6
|
+
num_pages: total number of pages
|
7
|
+
per_page: number of items to fetch per page
|
8
|
+
remote: data-remote
|
8
9
|
-%>
|
9
10
|
<span class="page first">
|
10
|
-
<%= link_to page,
|
11
|
+
<%= link_to page, url, :remote => remote %>
|
11
12
|
</span>
|
@@ -1,9 +1,10 @@
|
|
1
|
-
-#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
-# Link with page number that appears at the leftmost
|
2
|
+
- available local variables
|
3
|
+
page: the page number of this page
|
4
|
+
url: url to this page
|
5
|
+
current_page: the page number of currently displayed page
|
6
|
+
num_pages: total number of pages
|
7
|
+
per_page: number of items to fetch per page
|
8
|
+
remote: data-remote
|
8
9
|
%span.page.first
|
9
|
-
= link_to page,
|
10
|
+
= link_to page, url, :remote => remote
|
@@ -1,11 +1,12 @@
|
|
1
|
-
<%#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
<%# Link with page number that appears at the rightmost
|
2
|
+
- available local variables
|
3
|
+
page: the page number of this page
|
4
|
+
url: url to this page
|
5
|
+
current_page: the page number of currently displayed page
|
6
|
+
num_pages: total number of pages
|
7
|
+
per_page: number of items to fetch per page
|
8
|
+
remote: data-remote
|
8
9
|
-%>
|
9
10
|
<span class="page last">
|
10
|
-
<%= link_to page,
|
11
|
+
<%= link_to page, url, :remote => remote %>
|
11
12
|
</span>
|
@@ -1,9 +1,10 @@
|
|
1
|
-
-#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
-# Link with page number that appears at the rightmost
|
2
|
+
- available local variables
|
3
|
+
page: the page number of this page
|
4
|
+
url: url to this page
|
5
|
+
current_page: the page number of currently displayed page
|
6
|
+
num_pages: total number of pages
|
7
|
+
per_page: number of items to fetch per page
|
8
|
+
remote: data-remote
|
8
9
|
%span.page.last
|
9
|
-
= link_to page,
|
10
|
+
= link_to page, url, :remote => remote
|
@@ -1,10 +1,11 @@
|
|
1
|
-
<%#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
<%# "Next" with link
|
2
|
+
- available local variables
|
3
|
+
url: url to the next 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
|
7
8
|
-%>
|
8
9
|
<span class="next">
|
9
|
-
<%= link_to raw('Next »'),
|
10
|
+
<%= link_to raw('Next »'), url, :class => 'next', :rel => 'next', :remote => remote %>
|
10
11
|
</span>
|
@@ -1,8 +1,9 @@
|
|
1
|
-
-#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
-# "Next" with link
|
2
|
+
- available local variables
|
3
|
+
url: url to the next 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
|
7
8
|
%span.next
|
8
|
-
= link_to raw('Next »'),
|
9
|
+
= link_to raw('Next »'), url, :class => 'next', :rel => 'next', :remote => remote
|
@@ -1,7 +1,8 @@
|
|
1
|
-
<%#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<%# "Next" without link
|
2
|
+
- available local variables
|
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
|
6
7
|
-%>
|
7
8
|
<span class="next"></span>
|
@@ -1,6 +1,7 @@
|
|
1
|
-
-#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
-# "Next" without link
|
2
|
+
- available local variables
|
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
|
6
7
|
%span.next
|
@@ -1,11 +1,12 @@
|
|
1
|
-
<%#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
<%# Link showing page number
|
2
|
+
- available local variables
|
3
|
+
page: the page number of this page
|
4
|
+
url: url to this page
|
5
|
+
current_page: the page number of currently displayed page
|
6
|
+
num_pages: total number of pages
|
7
|
+
per_page: number of items to fetch per page
|
8
|
+
remote: data-remote
|
8
9
|
-%>
|
9
10
|
<span class="page">
|
10
|
-
<%= link_to page,
|
11
|
+
<%= link_to page, url, :remote => remote %>
|
11
12
|
</span>
|
@@ -1,9 +1,10 @@
|
|
1
|
-
-#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
-# Link showing page number
|
2
|
+
- available local variables
|
3
|
+
page: the page number of this page
|
4
|
+
url: url to this page
|
5
|
+
current_page: the page number of currently displayed page
|
6
|
+
num_pages: total number of pages
|
7
|
+
per_page: number of items to fetch per page
|
8
|
+
remote: data-remote
|
8
9
|
%span.page
|
9
|
-
= link_to page,
|
10
|
+
= link_to page, url, :remote => remote
|
@@ -1,8 +1,9 @@
|
|
1
|
-
<%#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<%# The container tag
|
2
|
+
- available local variables
|
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
|
6
7
|
-%>
|
7
8
|
<nav class='pagination'>
|
8
9
|
<%= content_for :kaminari_paginator_tags %>
|
@@ -1,7 +1,8 @@
|
|
1
|
-
-#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
-# The container tag
|
2
|
+
- available local variables
|
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
|
6
7
|
%nav.pagination
|
7
8
|
= content_for :kaminari_paginator_tags
|
@@ -1,10 +1,11 @@
|
|
1
|
-
<%#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
<%# "Previous" with link
|
2
|
+
- available local variables
|
3
|
+
url: url to the previous 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
|
7
8
|
-%>
|
8
9
|
<span class="prev">
|
9
|
-
<%= link_to raw('« Prev'),
|
10
|
+
<%= link_to raw('« Prev'), url, :class => 'prev', :rel => 'prev', :remote => remote %>
|
10
11
|
</span>
|
@@ -1,8 +1,9 @@
|
|
1
|
-
-#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
-# "Previous" with link
|
2
|
+
- available local variables
|
3
|
+
url: url to the previous 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
|
7
8
|
%span.prev
|
8
|
-
= link_to raw('« Prev'),
|
9
|
+
= link_to raw('« Prev'), url, :class => 'prev', :rel => 'prev', :remote => remote
|
@@ -1,7 +1,8 @@
|
|
1
|
-
<%#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<%# "Previous" without link
|
2
|
+
- available local variables
|
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
|
6
7
|
-%>
|
7
8
|
<span class="prev"></span>
|
@@ -1,6 +1,7 @@
|
|
1
|
-
-#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
-# "Previous" without link
|
2
|
+
- available local variables
|
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
|
6
7
|
%span.prev
|
@@ -1,7 +1,8 @@
|
|
1
|
-
<%#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<%# Non-link tag that stands for skipped pages...
|
2
|
+
- available local variables
|
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
|
6
7
|
-%>
|
7
8
|
<span class="page">...</span>
|
@@ -1,7 +1,8 @@
|
|
1
|
-
-#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
-# Non-link tag that stands for skipped pages...
|
2
|
+
- available local variables
|
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
|
6
7
|
%span.page
|
7
8
|
\...
|
@@ -1,9 +1 @@
|
|
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
1
|
<%# EMPTY! %>
|
@@ -1,8 +1 @@
|
|
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
1
|
-# EMPTY!
|
@@ -1,8 +1 @@
|
|
1
|
-
|
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 »'), next_url, :remote => remote -%>
|
1
|
+
<%= link_to raw('Older »'), url, :remote => remote -%>
|
@@ -1,7 +1 @@
|
|
1
|
-
|
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 »'), next_url, :remote => remote
|
1
|
+
~ link_to raw('Older »'), url, :remote => remote
|
@@ -1,9 +1 @@
|
|
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
1
|
<%# EMPTY! %>
|
@@ -1,8 +1 @@
|
|
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
1
|
-# EMPTY!
|
@@ -1,9 +1,3 @@
|
|
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
1
|
<style>
|
8
2
|
.pagination{padding:.3em;margin:.3em; font: 13.34px helvetica,arial,freesans,clean,sans-serif;}
|
9
3
|
.pagination a{padding:.1em .3em;margin:.2em;border:1px solid #aad;text-decoration:none;color:#369;}
|
@@ -1,8 +1,3 @@
|
|
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
1
|
:css
|
7
2
|
.pagination{padding:.3em;margin:.3em; font: 13.34px helvetica,arial,freesans,clean,sans-serif;}
|
8
3
|
.pagination a{padding:.1em .3em;margin:.2em;border:1px solid #aad;text-decoration:none;color:#369;}
|
@@ -1,8 +1 @@
|
|
1
|
-
|
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('« Newer'), prev_url, :remote => remote -%>
|
1
|
+
<%= link_to raw('« Newer'), url, :remote => remote -%>
|
@@ -1,7 +1 @@
|
|
1
|
-
|
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('« Newer'), prev_url, :remote => remote
|
1
|
+
~ link_to raw('« Newer'), url, :remote => remote
|
@@ -1,7 +1 @@
|
|
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
1
|
<%= content_tag :span, raw('« Newer'), :class => 'disabled' -%>
|
@@ -1,9 +1 @@
|
|
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
1
|
<td class="cur"><span class="csb" style="background-position:-53px 0;width:20px"></span><%= page %></td>
|
@@ -1,10 +1,3 @@
|
|
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
1
|
%td.cur
|
9
2
|
%span.csb{:style => 'background-position:-53px 0;width:20px'}
|
10
3
|
= page
|
@@ -1,8 +1 @@
|
|
1
|
-
|
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>
|
1
|
+
<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>'), url, :class => 'pn knavi', :id => 'pnnext', :style => 'text-align:left;text-decoration:none', :remote => remote %></td>
|
@@ -1,8 +1,2 @@
|
|
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
1
|
%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>'),
|
2
|
+
= 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>'), url, :class => 'pn knavi', :id => 'pnnext', :style => 'text-align:left;text-decoration:none', :remote => remote
|
@@ -1,7 +1 @@
|
|
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
1
|
<td class="b"><span class="csb" style="background-position:-96px 0;width:45px"></span></td>
|
@@ -1,9 +1 @@
|
|
1
|
-
|
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>
|
1
|
+
<td><%= link_to raw(%Q[<span class="csb ch" style="background-position:-74px 0;width:20px"></span>#{page}]), url, :class => 'fl', :remote => remote %></td>
|
@@ -1,9 +1,2 @@
|
|
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
1
|
%td
|
9
|
-
= link_to raw(%Q[<span class="csb ch" style="background-position:-74px 0;width:20px"></span>#{page}]),
|
2
|
+
= link_to raw(%Q[<span class="csb ch" style="background-position:-74px 0;width:20px"></span>#{page}]), url, :class => 'fl', :remote => remote
|
@@ -1,9 +1,3 @@
|
|
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
1
|
<style>
|
8
2
|
#nav a{display:block}
|
9
3
|
#nav td{padding:0;text-align:center}
|
@@ -1,8 +1 @@
|
|
1
|
-
|
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>
|
1
|
+
<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>'), url, :class => 'pn knavi', :id => 'pnprev', :style => 'text-decoration:none', :remote => remote %></td>
|
@@ -1,8 +1,2 @@
|
|
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
1
|
%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>'),
|
2
|
+
= 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>'), url, :class => 'pn knavi', :id => 'pnprev', :style => 'text-decoration:none', :remote => remote
|
@@ -1,7 +1 @@
|
|
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
1
|
<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.4"
|
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"]
|
@@ -92,6 +92,7 @@ Gem::Specification.new do |s|
|
|
92
92
|
"spec/acceptance/support/paths.rb",
|
93
93
|
"spec/acceptance/users_spec.rb",
|
94
94
|
"spec/helpers/helpers_spec.rb",
|
95
|
+
"spec/helpers/tags_spec.rb",
|
95
96
|
"spec/models/scopes_spec.rb",
|
96
97
|
"spec/spec_helper.rb",
|
97
98
|
"spec/support/20110128122508_create_users.rb",
|
@@ -110,6 +111,7 @@ Gem::Specification.new do |s|
|
|
110
111
|
"spec/acceptance/support/paths.rb",
|
111
112
|
"spec/acceptance/users_spec.rb",
|
112
113
|
"spec/helpers/helpers_spec.rb",
|
114
|
+
"spec/helpers/tags_spec.rb",
|
113
115
|
"spec/models/scopes_spec.rb",
|
114
116
|
"spec/spec_helper.rb",
|
115
117
|
"spec/support/20110128122508_create_users.rb",
|
data/lib/kaminari/helpers.rb
CHANGED
@@ -35,12 +35,9 @@ module Kaminari
|
|
35
35
|
tags << (num_pages > current_page ? NextLink.new(self) : NextSpan.new(self))
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
def resolver #:nodoc:
|
43
|
-
context.instance_variable_get('@view_paths').first
|
38
|
+
def partial_exists?(name) #:nodoc:
|
39
|
+
resolver = context.instance_variable_get('@view_paths').first
|
40
|
+
resolver.find_all(*args_for_lookup(name)).present?
|
44
41
|
end
|
45
42
|
|
46
43
|
def to_s #:nodoc:
|
@@ -52,6 +49,20 @@ module Kaminari
|
|
52
49
|
end
|
53
50
|
|
54
51
|
private
|
52
|
+
def context
|
53
|
+
@template.instance_variable_get('@lookup_context')
|
54
|
+
end
|
55
|
+
|
56
|
+
def args_for_lookup(name)
|
57
|
+
if (method = context.method :args_for_lookup).arity == 3
|
58
|
+
# 3.0
|
59
|
+
method.call name, 'kaminari', true
|
60
|
+
else
|
61
|
+
# 3.1
|
62
|
+
method.call name, 'kaminari', true, []
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
55
66
|
def method_missing(meth, *args, &blk)
|
56
67
|
@template.send meth, *args, &blk
|
57
68
|
end
|
data/lib/kaminari/tags.rb
CHANGED
@@ -17,10 +17,6 @@ module Kaminari
|
|
17
17
|
# template will be used.
|
18
18
|
# e.g.) Paginator -> $GEM_HOME/kaminari-x.x.x/app/views/kaminari/_paginator.html.erb
|
19
19
|
class Tag
|
20
|
-
def self.template_filename #:nodoc:
|
21
|
-
name.demodulize.underscore
|
22
|
-
end
|
23
|
-
|
24
20
|
def initialize(renderer, options = {}) #:nodoc:
|
25
21
|
@renderer, @options = renderer, renderer.options.merge(options)
|
26
22
|
end
|
@@ -36,80 +32,123 @@ module Kaminari
|
|
36
32
|
# 2. a template for its parent class from app/views
|
37
33
|
# 3. the default one inside the engine
|
38
34
|
def find_template(klass = self.class)
|
39
|
-
if @renderer.
|
35
|
+
if @renderer.partial_exists? klass.template_filename
|
40
36
|
"kaminari/#{klass.template_filename}"
|
41
|
-
elsif (parent = klass.ancestors[1]) ==
|
37
|
+
elsif (parent = klass.ancestors[1]) == Renderable
|
42
38
|
"kaminari/#{self.class.template_filename}"
|
43
39
|
else
|
44
40
|
find_template parent
|
45
41
|
end
|
46
42
|
end
|
47
43
|
|
48
|
-
def
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
44
|
+
def page_url_for(page)
|
45
|
+
@renderer.url_for @renderer.params.merge(:page => (page <= 1 ? nil : page))
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
module Renderable #:nodoc:
|
50
|
+
def self.included(base) #:nodoc:
|
51
|
+
base.extend ClassMethods
|
52
|
+
end
|
53
|
+
module ClassMethods #:nodoc:
|
54
|
+
def template_filename #:nodoc:
|
55
|
+
name.demodulize.underscore
|
56
|
+
end
|
57
|
+
def included(base) #:nodoc:
|
58
|
+
base.extend Renderable::ClassMethods
|
55
59
|
end
|
56
60
|
end
|
61
|
+
end
|
57
62
|
|
58
|
-
|
59
|
-
|
63
|
+
# Tag that contains a link
|
64
|
+
module Link
|
65
|
+
include Renderable
|
66
|
+
def url
|
67
|
+
raise 'Override url with the actual url value to be a Link.'
|
68
|
+
end
|
69
|
+
def to_s(locals = {}) #:nodoc:
|
70
|
+
super locals.merge(:url => url)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Tag that doesn't contain a link
|
75
|
+
module NonLink
|
76
|
+
include Renderable
|
77
|
+
end
|
78
|
+
|
79
|
+
# Tag for a page
|
80
|
+
module Page
|
81
|
+
def page
|
82
|
+
raise 'Override page with the actual page value to be a Page.'
|
83
|
+
end
|
84
|
+
def to_s(locals = {}) #:nodoc:
|
85
|
+
super locals.merge(:page => page)
|
60
86
|
end
|
61
87
|
end
|
62
88
|
|
63
89
|
# "Previous" without link
|
64
90
|
class PrevSpan < Tag
|
91
|
+
include NonLink
|
65
92
|
end
|
66
93
|
|
67
94
|
# "Previous" with link
|
68
95
|
class PrevLink < Tag
|
69
|
-
|
70
|
-
|
96
|
+
include Link
|
97
|
+
def url #:nodoc:
|
98
|
+
page_url_for @options[:current_page] - 1
|
71
99
|
end
|
72
100
|
end
|
73
101
|
|
74
102
|
# "Next" without link
|
75
103
|
class NextSpan < Tag
|
104
|
+
include NonLink
|
76
105
|
end
|
77
106
|
|
78
107
|
# "Next" with link
|
79
108
|
class NextLink < Tag
|
80
|
-
|
81
|
-
|
109
|
+
include Link
|
110
|
+
def url #:nodoc:
|
111
|
+
page_url_for @options[:current_page] + 1
|
82
112
|
end
|
83
113
|
end
|
84
114
|
|
85
|
-
#
|
115
|
+
# Link showing page number
|
86
116
|
class PageLink < Tag
|
87
|
-
|
88
|
-
|
117
|
+
include Page
|
118
|
+
include Link
|
119
|
+
def page #:nodoc:
|
120
|
+
@options[:page]
|
121
|
+
end
|
122
|
+
def url #:nodoc:
|
123
|
+
page_url_for page
|
89
124
|
end
|
90
125
|
end
|
91
126
|
|
92
|
-
#
|
127
|
+
# Non-link tag showing the current page number
|
93
128
|
class CurrentPage < Tag
|
94
|
-
|
95
|
-
|
129
|
+
include Page
|
130
|
+
include NonLink
|
131
|
+
def page #:nodoc:
|
132
|
+
@options[:page]
|
96
133
|
end
|
97
134
|
end
|
98
135
|
|
99
|
-
#
|
136
|
+
# Link with page number that appears at the leftmost
|
100
137
|
class FirstPageLink < PageLink
|
101
138
|
end
|
102
139
|
|
103
|
-
#
|
140
|
+
# Link with page number that appears at the rightmost
|
104
141
|
class LastPageLink < PageLink
|
105
142
|
end
|
106
143
|
|
107
|
-
#
|
144
|
+
# Non-link tag that stands for skipped pages...
|
108
145
|
class TruncatedSpan < Tag
|
146
|
+
include NonLink
|
109
147
|
end
|
110
148
|
|
111
149
|
# The container tag
|
112
150
|
class Paginator < Tag
|
151
|
+
include Renderable
|
113
152
|
end
|
114
153
|
end
|
115
154
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path('../spec_helper', File.dirname(__FILE__))
|
2
|
+
include Kaminari::Helpers
|
3
|
+
|
4
|
+
describe 'Kaminari::Helpers' do
|
5
|
+
let :renderer do
|
6
|
+
stub(r = Object.new) do
|
7
|
+
render.with_any_args
|
8
|
+
options { {} }
|
9
|
+
params { {} }
|
10
|
+
partial_exists?.with_any_args {|a| puts a; false }
|
11
|
+
url_for {|h| "/foo?page=#{h[:page]}"}
|
12
|
+
end
|
13
|
+
r
|
14
|
+
end
|
15
|
+
describe 'PageLink' do
|
16
|
+
subject { PageLink.new renderer, :page => 3 }
|
17
|
+
its('class.template_filename') { should == 'page_link' }
|
18
|
+
describe 'template lookup rule' do
|
19
|
+
before do
|
20
|
+
pending "spies doesn't work on RSpec 2 ATM: https://github.com/btakita/rr/issues#issue/45"
|
21
|
+
subject.to_s
|
22
|
+
end
|
23
|
+
specify { renderer.should have_received.partial_exists? PageLink }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
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: 51
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 4
|
10
|
+
version: 0.9.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Akira Matsuda
|
@@ -318,6 +318,7 @@ files:
|
|
318
318
|
- spec/acceptance/support/paths.rb
|
319
319
|
- spec/acceptance/users_spec.rb
|
320
320
|
- spec/helpers/helpers_spec.rb
|
321
|
+
- spec/helpers/tags_spec.rb
|
321
322
|
- spec/models/scopes_spec.rb
|
322
323
|
- spec/spec_helper.rb
|
323
324
|
- spec/support/20110128122508_create_users.rb
|
@@ -364,6 +365,7 @@ test_files:
|
|
364
365
|
- spec/acceptance/support/paths.rb
|
365
366
|
- spec/acceptance/users_spec.rb
|
366
367
|
- spec/helpers/helpers_spec.rb
|
368
|
+
- spec/helpers/tags_spec.rb
|
367
369
|
- spec/models/scopes_spec.rb
|
368
370
|
- spec/spec_helper.rb
|
369
371
|
- spec/support/20110128122508_create_users.rb
|