utopia 0.9.24 → 0.9.25
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/utopia/extensions.rb +1 -1
- data/lib/utopia/link.rb +13 -2
- data/lib/utopia/middleware/content.rb +7 -1
- data/lib/utopia/version.rb +1 -1
- metadata +3 -3
data/lib/utopia/extensions.rb
CHANGED
data/lib/utopia/link.rb
CHANGED
@@ -239,15 +239,26 @@ module Utopia
|
|
239
239
|
end
|
240
240
|
|
241
241
|
if options[:sort]
|
242
|
+
sort_key = options[:sort]
|
243
|
+
sort_default = options[:sort_default] || 0
|
244
|
+
|
242
245
|
links = links.sort do |a, b|
|
243
246
|
result = nil
|
247
|
+
|
248
|
+
lhs = a[sort_key] || sort_default
|
249
|
+
rhs = b[sort_key] || sort_default
|
250
|
+
|
244
251
|
begin
|
245
|
-
result ||=
|
252
|
+
result ||= lhs <=> rhs
|
246
253
|
rescue
|
247
254
|
# LOG.debug("Invalid comparison between #{a.path} and #{b.path} using key #{options[:sort]}!")
|
248
255
|
end
|
249
256
|
|
250
|
-
result
|
257
|
+
if result == 0 || result == nil
|
258
|
+
a.title <=> b.title
|
259
|
+
else
|
260
|
+
result
|
261
|
+
end
|
251
262
|
end
|
252
263
|
end
|
253
264
|
|
@@ -115,7 +115,13 @@ module Utopia
|
|
115
115
|
directory_path = File.join(@root, path.dirname.components, name)
|
116
116
|
|
117
117
|
if File.directory? directory_path
|
118
|
-
|
118
|
+
if extensions
|
119
|
+
index_path = [name, "index.#{extensions}"]
|
120
|
+
else
|
121
|
+
index_path = [name, "index"]
|
122
|
+
end
|
123
|
+
|
124
|
+
return [307, {"Location" => path.dirname.join(index_path).to_s}, []]
|
119
125
|
end
|
120
126
|
|
121
127
|
# Otherwise look up the node
|
data/lib/utopia/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
8
|
+
- 25
|
9
|
+
version: 0.9.25
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Samuel Williams
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-18 00:00:00 +12:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|