dimples 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dimples/site.rb +10 -9
- data/lib/dimples/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3be3dfc36f4a8285d77823deff68e9585cb71baf
|
4
|
+
data.tar.gz: cb592149ddd792be5f46f1bf647cbcf8084c5cb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93ec231ac30080beeef7d13876fb573b361c8131e5378775e8472905c2bbc5ad56561eda9f4ec8d18ac66a6060033d3ffa8ea048bec84171eccbc87171bc797a
|
7
|
+
data.tar.gz: eb90279afa05032d464ff0e7a38ab400e1ee82befa8341a85f20f229f54755a7322c883c514b87b7c7778dad5658943dd15262dd42d3916e15b57bfc1e4f717a
|
data/lib/dimples/site.rb
CHANGED
@@ -205,31 +205,32 @@ module Dimples
|
|
205
205
|
page_count = (posts.length.to_f / per_page.to_i).ceil
|
206
206
|
|
207
207
|
for index in 1..page_count
|
208
|
-
range = posts.slice((index - 1) * per_page, per_page)
|
209
|
-
|
210
208
|
page = @page_class.new(self)
|
211
209
|
|
212
210
|
page.layout = layout
|
213
211
|
page.title = title || @templates[layout].title
|
214
212
|
|
215
|
-
page_paths = paths.clone
|
216
|
-
|
217
213
|
pagination = {
|
218
214
|
page: index,
|
219
215
|
pages: page_count,
|
220
216
|
post_count: posts.length,
|
221
|
-
path: pagination_url(index,
|
217
|
+
path: pagination_url(index, paths)
|
222
218
|
}
|
223
219
|
|
224
|
-
page_paths << "page#{index}" if index != 1
|
225
|
-
|
226
220
|
pagination[:previous_page] = pagination[:page] - 1 if (pagination[:page] - 1) > 0
|
227
221
|
pagination[:next_page] = pagination[:page] + 1 if (pagination[:page] + 1) <= pagination[:pages]
|
228
222
|
|
229
|
-
|
223
|
+
if pagination[:previous_page]
|
224
|
+
pagination[:previous_page_url] = pagination[:path]
|
225
|
+
pagination[:previous_page_url] += "page" + pagination[:previous_page].to_s if pagination[:previous_page] != 1
|
226
|
+
end
|
227
|
+
|
228
|
+
pagination[:next_page_url] = pagination[:path] + "page" + pagination[:next_page].to_s if pagination[:next_page]
|
229
|
+
|
230
|
+
output_path = File.join(paths, index != 1 ? "page#{index}" : '')
|
230
231
|
|
231
232
|
begin
|
232
|
-
page.write(
|
233
|
+
page.write(output_path, {posts: posts.slice((index - 1) * per_page, per_page), pagination: pagination})
|
233
234
|
rescue => e
|
234
235
|
raise "Failed to generate paginated page #{path} (#{e})"
|
235
236
|
end
|
data/lib/dimples/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dimples
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Bogan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tilt
|