will_paginate 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of will_paginate might be problematic. Click here for more details.
- data/CHANGELOG +32 -2
- data/LICENSE +1 -1
- data/{README → README.rdoc} +42 -59
- data/Rakefile +41 -4
- data/examples/apple-circle.gif +0 -0
- data/examples/index.haml +69 -0
- data/examples/index.html +92 -0
- data/examples/pagination.css +90 -0
- data/examples/pagination.sass +91 -0
- data/init.rb +1 -0
- data/lib/will_paginate.rb +34 -11
- data/lib/will_paginate/array.rb +16 -0
- data/lib/will_paginate/collection.rb +37 -24
- data/lib/will_paginate/core_ext.rb +1 -49
- data/lib/will_paginate/finder.rb +29 -4
- data/lib/will_paginate/named_scope.rb +132 -0
- data/lib/will_paginate/named_scope_patch.rb +50 -0
- data/lib/will_paginate/version.rb +1 -1
- data/lib/will_paginate/view_helpers.rb +123 -21
- data/test/boot.rb +0 -2
- data/test/{array_pagination_test.rb → collection_test.rb} +37 -28
- data/test/console +2 -3
- data/test/database.yml +22 -0
- data/test/finder_test.rb +150 -56
- data/test/fixtures/developer.rb +2 -0
- data/test/fixtures/projects.yml +3 -4
- data/test/fixtures/reply.rb +2 -0
- data/test/fixtures/topic.rb +2 -0
- data/test/helper.rb +13 -1
- data/test/lib/activerecord_test_case.rb +14 -1
- data/test/lib/activerecord_test_connector.rb +19 -10
- data/test/lib/load_fixtures.rb +3 -5
- data/test/lib/view_test_process.rb +73 -0
- data/test/view_test.rb +314 -0
- metadata +32 -31
- data/Manifest.txt +0 -34
- data/config/release.rb +0 -82
- data/setup.rb +0 -1585
- data/test/pagination_test.rb +0 -257
data/CHANGELOG
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
-
== 2.
|
1
|
+
== 2.2.0, released 2008-04-07
|
2
2
|
|
3
|
-
|
3
|
+
=== API changes
|
4
|
+
* Rename WillPaginate::Collection#page_count to "total_pages" for consistency.
|
5
|
+
If you implemented this interface, change your implementation accordingly.
|
6
|
+
* Remove old, deprecated style of calling Array#paginate as "paginate(page,
|
7
|
+
per_page)". If you want to specify :page, :per_page or :total_entries, use a
|
8
|
+
parameter hash.
|
9
|
+
* Rename LinkRenderer#url_options to "url_for" and drastically optimize it
|
10
|
+
|
11
|
+
=== View changes
|
12
|
+
* Added "prev_page" and "next_page" CSS classes on previous/next page buttons
|
13
|
+
* Add examples of pagination links styling in "examples/index.html"
|
14
|
+
* Change gap in pagination links from "..." to
|
15
|
+
"<span class="gap">…</span>".
|
16
|
+
* Add "paginated_section", a block helper that renders pagination both above and
|
17
|
+
below content in the block
|
18
|
+
* Add rel="prev|next|start" to page links
|
19
|
+
|
20
|
+
=== Other
|
21
|
+
|
22
|
+
* Add ability to opt-in for Rails 2.1 feature "named_scope" by calling
|
23
|
+
WillPaginate.enable_named_scope (tested in Rails 1.2.6 and 2.0.2)
|
24
|
+
* Support complex page parameters like "developers[page]"
|
25
|
+
* Move Array#paginate definition to will_paginate/array.rb. You can now easily
|
26
|
+
use pagination on arrays outside of Rails:
|
27
|
+
|
28
|
+
gem 'will_paginate'
|
29
|
+
require 'will_paginate/array'
|
30
|
+
|
31
|
+
* Add "paginated_each" method for iterating through every record by loading only
|
32
|
+
one page of records at the time
|
33
|
+
* Rails 2: Rescue from WillPaginate::InvalidPage error with 404 Not Found by default
|
data/LICENSE
CHANGED
data/{README → README.rdoc}
RENAMED
@@ -9,13 +9,40 @@ you ever want to be able to do just this on a model:
|
|
9
9
|
... and then render the page links with a single view helper? Well, now you
|
10
10
|
can.
|
11
11
|
|
12
|
-
|
13
|
-
check it out.
|
12
|
+
Some resources to get you started:
|
14
13
|
|
15
|
-
Your mind reels with questions? Join our Google
|
16
|
-
group[http://groups.google.com/group/will_paginate].
|
14
|
+
* Your mind reels with questions? Join our Google
|
15
|
+
group[http://groups.google.com/group/will_paginate].
|
16
|
+
* The will_paginate project page: http://github.com/mislav/will_paginate
|
17
|
+
* How to report bugs: http://github.com/mislav/will_paginate/wikis/report-bugs
|
18
|
+
* Ryan Bates made an awesome screencast[http://railscasts.com/episodes/51],
|
19
|
+
check it out.
|
20
|
+
|
21
|
+
== Installation
|
22
|
+
|
23
|
+
Previously, the plugin was available on the following SVN location:
|
24
|
+
|
25
|
+
svn://errtheblog.com/svn/plugins/will_paginate
|
26
|
+
|
27
|
+
In February 2008, it moved to GitHub to be tracked with git version control.
|
28
|
+
The SVN repo continued to have updates for some time, but now it doesn't.
|
29
|
+
|
30
|
+
You should switch to using the gem:
|
31
|
+
|
32
|
+
gem install will_paginate
|
33
|
+
|
34
|
+
After that, you can remove the plugin from your application and add
|
35
|
+
a simple require to the end of config/environment.rb:
|
36
|
+
|
37
|
+
require 'will_paginate'
|
38
|
+
|
39
|
+
That's it, just remember to install the gem on all machines that
|
40
|
+
you are deploying to.
|
41
|
+
|
42
|
+
<i>There are extensive
|
43
|
+
installation[http://github.com/mislav/will_paginate/wikis/installation]
|
44
|
+
instructions on the wiki[http://github.com/mislav/will_paginate/wikis].</i>
|
17
45
|
|
18
|
-
You can find more documentation on the wiki[http://github.com/mislav/will_paginate/wikis].
|
19
46
|
|
20
47
|
== Example usage
|
21
48
|
|
@@ -74,73 +101,26 @@ More detailed documentation:
|
|
74
101
|
* WillPaginate::Finder::ClassMethods for pagination on your models;
|
75
102
|
* WillPaginate::ViewHelpers for your views.
|
76
103
|
|
77
|
-
== Oh noes, a bug!
|
78
|
-
|
79
|
-
Tell us what happened so we can fix it, quick! Issues are filed on the Lighthouse project:
|
80
|
-
http://err.lighthouseapp.com/projects/466-plugins/tickets?q=tagged:will_paginate
|
81
104
|
|
82
|
-
|
83
|
-
|
84
|
-
1. Run <tt>rake test</tt> in the <i>will_paginate</i> directory. (You will need SQLite3.)
|
85
|
-
Copy the output if there are failing tests.
|
86
|
-
2. Register on Lighthouse to create a new ticket.
|
87
|
-
3. Write a descriptive, short title. Provide as much info as you can in the body.
|
88
|
-
Assign the ticket to Mislav and tag it with meaningful tags, <tt>"will_paginate"</tt>
|
89
|
-
being among them.
|
90
|
-
4. Yay! You will be notified on updates automatically.
|
91
|
-
|
92
|
-
Here is an example of a great bug report and patch:
|
93
|
-
http://err.lighthouseapp.com/projects/466/tickets/172-total_entries-ignored-in-paginate_by_sql
|
94
|
-
|
95
|
-
== Authors, credits, contact
|
96
|
-
|
97
|
-
Want to discuss, request features, ask questions? Join the Google group:
|
98
|
-
http://groups.google.com/group/will_paginate
|
105
|
+
== Authors and credits
|
99
106
|
|
100
107
|
Authors:: Mislav Marohnić, PJ Hyett
|
101
108
|
Original announcement:: http://errtheblog.com/post/929
|
102
109
|
Original PHP source:: http://www.strangerstudios.com/sandbox/pagination/diggstyle.php
|
103
110
|
|
104
111
|
All these people helped making will_paginate what it is now with their code
|
105
|
-
contributions or simply awesome ideas:
|
112
|
+
contributions or just simply awesome ideas:
|
106
113
|
|
107
114
|
Chris Wanstrath, Dr. Nic Williams, K. Adam Christensen, Mike Garey, Bence
|
108
115
|
Golda, Matt Aimonetti, Charles Brian Quinn, Desi McAdam, James Coglan, Matijs
|
109
|
-
van Zuijlen, Maria, Brendan Ribera, Todd Willey, Bryan Helmkamp, Jan Berkel
|
116
|
+
van Zuijlen, Maria, Brendan Ribera, Todd Willey, Bryan Helmkamp, Jan Berkel,
|
117
|
+
Lourens Naudé, Rick Olson.
|
118
|
+
|
110
119
|
|
111
120
|
== Usable pagination in the UI
|
112
121
|
|
113
|
-
|
114
|
-
|
115
|
-
.pagination {
|
116
|
-
padding: 3px;
|
117
|
-
margin: 3px;
|
118
|
-
}
|
119
|
-
.pagination a {
|
120
|
-
padding: 2px 5px 2px 5px;
|
121
|
-
margin: 2px;
|
122
|
-
border: 1px solid #aaaadd;
|
123
|
-
text-decoration: none;
|
124
|
-
color: #000099;
|
125
|
-
}
|
126
|
-
.pagination a:hover, .pagination a:active {
|
127
|
-
border: 1px solid #000099;
|
128
|
-
color: #000;
|
129
|
-
}
|
130
|
-
.pagination span.current {
|
131
|
-
padding: 2px 5px 2px 5px;
|
132
|
-
margin: 2px;
|
133
|
-
border: 1px solid #000099;
|
134
|
-
font-weight: bold;
|
135
|
-
background-color: #000099;
|
136
|
-
color: #FFF;
|
137
|
-
}
|
138
|
-
.pagination span.disabled {
|
139
|
-
padding: 2px 5px 2px 5px;
|
140
|
-
margin: 2px;
|
141
|
-
border: 1px solid #eee;
|
142
|
-
color: #ddd;
|
143
|
-
}
|
122
|
+
There are some CSS styles to get you started in the "examples/" directory. They
|
123
|
+
are showcased in the <b>"examples/index.html"</b> file.
|
144
124
|
|
145
125
|
More reading about pagination as design pattern:
|
146
126
|
|
@@ -150,3 +130,6 @@ More reading about pagination as design pattern:
|
|
150
130
|
http://www.smashingmagazine.com/2007/11/16/pagination-gallery-examples-and-good-practices/
|
151
131
|
* Pagination on Yahoo Design Pattern Library:
|
152
132
|
http://developer.yahoo.com/ypatterns/parent.php?pattern=pagination
|
133
|
+
|
134
|
+
Want to discuss, request features, ask questions? Join the Google group:
|
135
|
+
http://groups.google.com/group/will_paginate
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
+
require 'rake'
|
1
2
|
require 'rake/testtask'
|
2
3
|
require 'rake/rdoctask'
|
3
|
-
require 'config/release'
|
4
4
|
|
5
5
|
desc 'Default: run unit tests.'
|
6
6
|
task :default => :test
|
@@ -9,6 +9,7 @@ desc 'Test the will_paginate plugin.'
|
|
9
9
|
Rake::TestTask.new(:test) do |t|
|
10
10
|
t.pattern = 'test/**/*_test.rb'
|
11
11
|
t.verbose = true
|
12
|
+
t.libs << 'test'
|
12
13
|
end
|
13
14
|
|
14
15
|
# I want to specify environment variables at call time
|
@@ -27,6 +28,7 @@ for configuration in %w( sqlite3 mysql postgres )
|
|
27
28
|
t.pattern = 'test/finder_test.rb'
|
28
29
|
t.verbose = true
|
29
30
|
t.env = { 'DB' => configuration }
|
31
|
+
t.libs << 'test'
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
@@ -51,10 +53,15 @@ end
|
|
51
53
|
|
52
54
|
desc 'Generate RDoc documentation for the will_paginate plugin.'
|
53
55
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
54
|
-
files = ['README', 'LICENSE', '
|
56
|
+
files = ['README.rdoc', 'LICENSE', 'CHANGELOG']
|
57
|
+
files << FileList.new('lib/**/*.rb').
|
58
|
+
exclude('lib/will_paginate/named_scope*').
|
59
|
+
exclude('lib/will_paginate/array.rb').
|
60
|
+
exclude('lib/will_paginate/version.rb')
|
61
|
+
|
55
62
|
rdoc.rdoc_files.add(files)
|
56
|
-
rdoc.main = "README" # page to start on
|
57
|
-
rdoc.title = "will_paginate"
|
63
|
+
rdoc.main = "README.rdoc" # page to start on
|
64
|
+
rdoc.title = "will_paginate documentation"
|
58
65
|
|
59
66
|
templates = %w[/Users/chris/ruby/projects/err/rock/template.rb /var/www/rock/template.rb]
|
60
67
|
rdoc.template = templates.find { |t| File.exists? t }
|
@@ -62,4 +69,34 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
62
69
|
rdoc.rdoc_dir = 'doc' # rdoc output folder
|
63
70
|
rdoc.options << '--inline-source'
|
64
71
|
rdoc.options << '--charset=UTF-8'
|
72
|
+
rdoc.options << '--webcvs=http://github.com/mislav/will_paginate/tree/master/'
|
73
|
+
end
|
74
|
+
|
75
|
+
task :manifest do
|
76
|
+
list = Dir['**/*']
|
77
|
+
|
78
|
+
File.read('.gitignore').each_line do |glob|
|
79
|
+
glob = glob.chomp.sub(/^\//, '')
|
80
|
+
list -= Dir[glob]
|
81
|
+
list -= Dir["#{glob}/**/*"] if File.directory?(glob) and !File.symlink?(glob)
|
82
|
+
puts "excluding #{glob}"
|
83
|
+
end
|
84
|
+
|
85
|
+
File.open('.manifest', 'w') do |file|
|
86
|
+
file.write list.sort.join("\n")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
task :examples do
|
91
|
+
%x(haml examples/index.haml examples/index.html)
|
92
|
+
%x(sass examples/pagination.sass examples/pagination.css)
|
93
|
+
end
|
94
|
+
|
95
|
+
task :rcov do
|
96
|
+
excludes = %w( lib/will_paginate/named_scope*
|
97
|
+
lib/will_paginate/core_ext.rb
|
98
|
+
lib/will_paginate.rb
|
99
|
+
rails* )
|
100
|
+
|
101
|
+
system %[rcov -Itest:lib test/*.rb -x #{excludes.join(',')}]
|
65
102
|
end
|
Binary file
|
data/examples/index.haml
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title Samples of pagination styling for will_paginate
|
5
|
+
%link{ :rel => 'stylesheet', :type => 'text/css', :href => 'pagination.css' }
|
6
|
+
%style{ :type => 'text/css' }
|
7
|
+
:sass
|
8
|
+
html
|
9
|
+
:margin 0
|
10
|
+
:padding 0
|
11
|
+
:background #999
|
12
|
+
:font normal 76% "Lucida Grande", Verdana, Helvetica, sans-serif
|
13
|
+
body
|
14
|
+
:margin 2em
|
15
|
+
:padding 2em
|
16
|
+
:border 2px solid gray
|
17
|
+
:background white
|
18
|
+
:color #222
|
19
|
+
h1
|
20
|
+
:font-size 2em
|
21
|
+
:font-weight normal
|
22
|
+
:margin 0 0 1em 0
|
23
|
+
h2
|
24
|
+
:font-size 1.4em
|
25
|
+
:margin 1em 0 .5em 0
|
26
|
+
pre
|
27
|
+
:font-size 13px
|
28
|
+
:font-family Monaco, "DejaVu Sans Mono", "Bitstream Vera Mono", "Courier New", monospace
|
29
|
+
|
30
|
+
- pagination = '<span class="disabled prev_page">« Previous</span> <span class="current">1</span> <a href="./?page=2" rel="next">2</a> <a href="./?page=3">3</a> <a href="./?page=4">4</a> <a href="./?page=5">5</a> <a href="./?page=6">6</a> <a href="./?page=7">7</a> <a href="./?page=8">8</a> <a href="./?page=9">9</a> <span class="gap">…</span> <a href="./?page=29">29</a> <a href="./?page=30">30</a> <a href="./?page=2" rel="next" class="next_page">Next »</a>'
|
31
|
+
- pagination_no_page_links = '<span class="disabled prev_page">« Previous</span> <a href="./?page=2" rel="next" class="next_page">Next »</a>'
|
32
|
+
|
33
|
+
%body
|
34
|
+
%h1 Samples of pagination styling for will_paginate
|
35
|
+
%p
|
36
|
+
Find these styles in <b>"examples/pagination.css"</b> of <i>will_paginate</i> library.
|
37
|
+
There is a Sass version of it for all you sassy people.
|
38
|
+
%p
|
39
|
+
Read about good rules for pagination:
|
40
|
+
%a{ :href => 'http://kurafire.net/log/archive/2007/06/22/pagination-101' } Pagination 101
|
41
|
+
%p
|
42
|
+
%em Warning:
|
43
|
+
page links below don't lead anywhere (so don't click on them).
|
44
|
+
|
45
|
+
%h2 Unstyled pagination <span style="font-weight:normal">(<i>ewww!</i>)</span>
|
46
|
+
%div= pagination
|
47
|
+
|
48
|
+
%h2 Digg.com
|
49
|
+
.digg_pagination= pagination
|
50
|
+
|
51
|
+
%h2 Digg-style, no page links
|
52
|
+
.digg_pagination= pagination_no_page_links
|
53
|
+
%p Code that renders this:
|
54
|
+
%pre= '<code>%s</code>' % %[<%= will_paginate @posts, :page_links => false %>].gsub('<', '<').gsub('>', '>')
|
55
|
+
|
56
|
+
%h2 Digg-style, extra content
|
57
|
+
.digg_pagination
|
58
|
+
.page_info Displaying entries <b>1 - 6</b> of <b>180</b> in total
|
59
|
+
= pagination
|
60
|
+
%p Code that renders this:
|
61
|
+
%pre= '<code>%s</code>' % %[<div class="digg_pagination">\n <div clas="page_info">\n <%= page_entries_info @posts %>\n </div>\n <%= will_paginate @posts, :container => false %>\n</div>].gsub('<', '<').gsub('>', '>')
|
62
|
+
|
63
|
+
%h2 Apple.com store
|
64
|
+
.apple_pagination= pagination
|
65
|
+
|
66
|
+
%h2 Flickr.com
|
67
|
+
.flickr_pagination
|
68
|
+
= pagination
|
69
|
+
.page_info (118 photos)
|
data/examples/index.html
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html>
|
3
|
+
</html>
|
4
|
+
<head>
|
5
|
+
<title>Samples of pagination styling for will_paginate</title>
|
6
|
+
<link href='pagination.css' rel='stylesheet' type='text/css' />
|
7
|
+
<style type='text/css'>
|
8
|
+
html {
|
9
|
+
margin: 0;
|
10
|
+
padding: 0;
|
11
|
+
background: #999;
|
12
|
+
font: normal 76% "Lucida Grande", Verdana, Helvetica, sans-serif; }
|
13
|
+
|
14
|
+
body {
|
15
|
+
margin: 2em;
|
16
|
+
padding: 2em;
|
17
|
+
border: 2px solid gray;
|
18
|
+
background: white;
|
19
|
+
color: #222; }
|
20
|
+
|
21
|
+
h1 {
|
22
|
+
font-size: 2em;
|
23
|
+
font-weight: normal;
|
24
|
+
margin: 0 0 1em 0; }
|
25
|
+
|
26
|
+
h2 {
|
27
|
+
font-size: 1.4em;
|
28
|
+
margin: 1em 0 .5em 0; }
|
29
|
+
|
30
|
+
pre {
|
31
|
+
font-size: 13px;
|
32
|
+
font-family: Monaco, "DejaVu Sans Mono", "Bitstream Vera Mono", "Courier New", monospace; }
|
33
|
+
</style>
|
34
|
+
</head>
|
35
|
+
<body>
|
36
|
+
<h1>Samples of pagination styling for will_paginate</h1>
|
37
|
+
<p>
|
38
|
+
Find these styles in <b>"examples/pagination.css"</b> of <i>will_paginate</i> library.
|
39
|
+
There is a Sass version of it for all you sassy people.
|
40
|
+
</p>
|
41
|
+
<p>
|
42
|
+
Read about good rules for pagination:
|
43
|
+
<a href='http://kurafire.net/log/archive/2007/06/22/pagination-101'>Pagination 101</a>
|
44
|
+
</p>
|
45
|
+
<p>
|
46
|
+
<em>Warning:</em>
|
47
|
+
page links below don't lead anywhere (so don't click on them).
|
48
|
+
</p>
|
49
|
+
<h2>
|
50
|
+
Unstyled pagination <span style="font-weight:normal">(<i>ewww!</i>)</span>
|
51
|
+
</h2>
|
52
|
+
<div>
|
53
|
+
<span class="disabled prev_page">« Previous</span> <span class="current">1</span> <a href="./?page=2" rel="next">2</a> <a href="./?page=3">3</a> <a href="./?page=4">4</a> <a href="./?page=5">5</a> <a href="./?page=6">6</a> <a href="./?page=7">7</a> <a href="./?page=8">8</a> <a href="./?page=9">9</a> <span class="gap">…</span> <a href="./?page=29">29</a> <a href="./?page=30">30</a> <a href="./?page=2" rel="next" class="next_page">Next »</a>
|
54
|
+
</div>
|
55
|
+
<h2>Digg.com</h2>
|
56
|
+
<div class='digg_pagination'>
|
57
|
+
<span class="disabled prev_page">« Previous</span> <span class="current">1</span> <a href="./?page=2" rel="next">2</a> <a href="./?page=3">3</a> <a href="./?page=4">4</a> <a href="./?page=5">5</a> <a href="./?page=6">6</a> <a href="./?page=7">7</a> <a href="./?page=8">8</a> <a href="./?page=9">9</a> <span class="gap">…</span> <a href="./?page=29">29</a> <a href="./?page=30">30</a> <a href="./?page=2" rel="next" class="next_page">Next »</a>
|
58
|
+
</div>
|
59
|
+
<h2>Digg-style, no page links</h2>
|
60
|
+
<div class='digg_pagination'>
|
61
|
+
<span class="disabled prev_page">« Previous</span> <a href="./?page=2" rel="next" class="next_page">Next »</a>
|
62
|
+
</div>
|
63
|
+
<p>Code that renders this:</p>
|
64
|
+
<pre>
|
65
|
+
<code><%= will_paginate @posts, :page_links => false %></code>
|
66
|
+
</pre>
|
67
|
+
<h2>Digg-style, extra content</h2>
|
68
|
+
<div class='digg_pagination'>
|
69
|
+
<div class='page_info'>
|
70
|
+
Displaying entries <b>1 - 6</b> of <b>180</b> in total
|
71
|
+
</div>
|
72
|
+
<span class="disabled prev_page">« Previous</span> <span class="current">1</span> <a href="./?page=2" rel="next">2</a> <a href="./?page=3">3</a> <a href="./?page=4">4</a> <a href="./?page=5">5</a> <a href="./?page=6">6</a> <a href="./?page=7">7</a> <a href="./?page=8">8</a> <a href="./?page=9">9</a> <span class="gap">…</span> <a href="./?page=29">29</a> <a href="./?page=30">30</a> <a href="./?page=2" rel="next" class="next_page">Next »</a>
|
73
|
+
</div>
|
74
|
+
<p>Code that renders this:</p>
|
75
|
+
<pre>
|
76
|
+
<code><div class="digg_pagination">
|
77
|
+
<div clas="page_info">
|
78
|
+
<%= page_entries_info @posts %>
|
79
|
+
</div>
|
80
|
+
<%= will_paginate @posts, :container => false %>
|
81
|
+
</div></code>
|
82
|
+
</pre>
|
83
|
+
<h2>Apple.com store</h2>
|
84
|
+
<div class='apple_pagination'>
|
85
|
+
<span class="disabled prev_page">« Previous</span> <span class="current">1</span> <a href="./?page=2" rel="next">2</a> <a href="./?page=3">3</a> <a href="./?page=4">4</a> <a href="./?page=5">5</a> <a href="./?page=6">6</a> <a href="./?page=7">7</a> <a href="./?page=8">8</a> <a href="./?page=9">9</a> <span class="gap">…</span> <a href="./?page=29">29</a> <a href="./?page=30">30</a> <a href="./?page=2" rel="next" class="next_page">Next »</a>
|
86
|
+
</div>
|
87
|
+
<h2>Flickr.com</h2>
|
88
|
+
<div class='flickr_pagination'>
|
89
|
+
<span class="disabled prev_page">« Previous</span> <span class="current">1</span> <a href="./?page=2" rel="next">2</a> <a href="./?page=3">3</a> <a href="./?page=4">4</a> <a href="./?page=5">5</a> <a href="./?page=6">6</a> <a href="./?page=7">7</a> <a href="./?page=8">8</a> <a href="./?page=9">9</a> <span class="gap">…</span> <a href="./?page=29">29</a> <a href="./?page=30">30</a> <a href="./?page=2" rel="next" class="next_page">Next »</a>
|
90
|
+
<div class='page_info'>(118 photos)</div>
|
91
|
+
</div>
|
92
|
+
</body>
|
@@ -0,0 +1,90 @@
|
|
1
|
+
.digg_pagination {
|
2
|
+
background: white;
|
3
|
+
/* self-clearing method: */ }
|
4
|
+
.digg_pagination a, .digg_pagination span {
|
5
|
+
padding: .2em .5em;
|
6
|
+
display: block;
|
7
|
+
float: left;
|
8
|
+
margin-right: 1px; }
|
9
|
+
.digg_pagination span.disabled {
|
10
|
+
color: #999;
|
11
|
+
border: 1px solid #DDD; }
|
12
|
+
.digg_pagination span.current {
|
13
|
+
font-weight: bold;
|
14
|
+
background: #2E6AB1;
|
15
|
+
color: white;
|
16
|
+
border: 1px solid #2E6AB1; }
|
17
|
+
.digg_pagination a {
|
18
|
+
text-decoration: none;
|
19
|
+
color: #105CB6;
|
20
|
+
border: 1px solid #9AAFE5; }
|
21
|
+
.digg_pagination a:hover, .digg_pagination a:focus {
|
22
|
+
color: #003;
|
23
|
+
border-color: #003; }
|
24
|
+
.digg_pagination .page_info {
|
25
|
+
background: #2E6AB1;
|
26
|
+
color: white;
|
27
|
+
padding: .4em .6em;
|
28
|
+
width: 22em;
|
29
|
+
margin-bottom: .3em;
|
30
|
+
text-align: center; }
|
31
|
+
.digg_pagination .page_info b {
|
32
|
+
color: #003;
|
33
|
+
background: #6aa6ed;
|
34
|
+
padding: .1em .25em; }
|
35
|
+
.digg_pagination:after {
|
36
|
+
content: ".";
|
37
|
+
display: block;
|
38
|
+
height: 0;
|
39
|
+
clear: both;
|
40
|
+
visibility: hidden; }
|
41
|
+
* html .digg_pagination {
|
42
|
+
height: 1%; }
|
43
|
+
*:first-child+html .digg_pagination {
|
44
|
+
overflow: hidden; }
|
45
|
+
|
46
|
+
.apple_pagination {
|
47
|
+
background: #F1F1F1;
|
48
|
+
border: 1px solid #E5E5E5;
|
49
|
+
text-align: center;
|
50
|
+
padding: 1em; }
|
51
|
+
.apple_pagination a, .apple_pagination span {
|
52
|
+
padding: .2em .3em; }
|
53
|
+
.apple_pagination span.disabled {
|
54
|
+
color: #AAA; }
|
55
|
+
.apple_pagination span.current {
|
56
|
+
font-weight: bold;
|
57
|
+
background: transparent url(apple-circle.gif) no-repeat 50% 50%; }
|
58
|
+
.apple_pagination a {
|
59
|
+
text-decoration: none;
|
60
|
+
color: black; }
|
61
|
+
.apple_pagination a:hover, .apple_pagination a:focus {
|
62
|
+
text-decoration: underline; }
|
63
|
+
|
64
|
+
.flickr_pagination {
|
65
|
+
text-align: center;
|
66
|
+
padding: .3em; }
|
67
|
+
.flickr_pagination a, .flickr_pagination span {
|
68
|
+
padding: .2em .5em; }
|
69
|
+
.flickr_pagination span.disabled {
|
70
|
+
color: #AAA; }
|
71
|
+
.flickr_pagination span.current {
|
72
|
+
font-weight: bold;
|
73
|
+
color: #FF0084; }
|
74
|
+
.flickr_pagination a {
|
75
|
+
border: 1px solid #DDDDDD;
|
76
|
+
color: #0063DC;
|
77
|
+
text-decoration: none; }
|
78
|
+
.flickr_pagination a:hover, .flickr_pagination a:focus {
|
79
|
+
border-color: #003366;
|
80
|
+
background: #0063DC;
|
81
|
+
color: white; }
|
82
|
+
.flickr_pagination .page_info {
|
83
|
+
color: #aaa;
|
84
|
+
padding-top: .8em; }
|
85
|
+
.flickr_pagination .prev_page, .flickr_pagination .next_page {
|
86
|
+
border-width: 2px; }
|
87
|
+
.flickr_pagination .prev_page {
|
88
|
+
margin-right: 1em; }
|
89
|
+
.flickr_pagination .next_page {
|
90
|
+
margin-left: 1em; }
|