artwork 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/artwork/model.rb +1 -1
- data/lib/artwork/version.rb +1 -1
- data/spec/artwork/model_spec.rb +0 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 706406a5c99a2c2c08fbf910749cc250725a88b7
|
4
|
+
data.tar.gz: 3b555e730a0aaad2708b0c75f1d78780fcacf3ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cc3e0a95a39eb4c175d4572603a7371d63d3e6ae7fce2a547683d88a4d7718d477a0335e618e01e37ac6567b3088d7250d90ef47964dd13ba9b46ff09864c80
|
7
|
+
data.tar.gz: 7070f597ab0d885c94e9249ad56e3867b2b97df0fb4c444b33f978684f9bc9ded1eb34acc53996a8dcac1554b61faf554f84cf224e0092ab26da0e91f0aff98b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## v0.7.2
|
2
|
+
|
3
|
+
- Use `Artwork.current_resolution` instead of `Artwork.actual_resolution` in
|
4
|
+
`artwork_thumb_for` when evaluating the alternative sizes. This is to allow
|
5
|
+
page and fragment caching where `Artwork.current_resolution` is in the cache
|
6
|
+
key.
|
7
|
+
|
1
8
|
## v0.7.1
|
2
9
|
|
3
10
|
- Hotfix for the new alternative sizes when additional non-numeric option keys
|
data/lib/artwork/model.rb
CHANGED
@@ -65,7 +65,7 @@ module Artwork
|
|
65
65
|
new_size_definition = alternative_sizes \
|
66
66
|
.select { |key, value| key.is_a? Numeric } \
|
67
67
|
.sort_by { |max_resolution, size| max_resolution } \
|
68
|
-
.find { |max_resolution, size| Artwork.
|
68
|
+
.find { |max_resolution, size| Artwork.current_resolution <= max_resolution }
|
69
69
|
|
70
70
|
new_size_definition.last if new_size_definition
|
71
71
|
end
|
data/lib/artwork/version.rb
CHANGED
data/spec/artwork/model_spec.rb
CHANGED
@@ -207,42 +207,36 @@ module Artwork
|
|
207
207
|
context 'with an alternative sizes definition' do
|
208
208
|
it 'ignores alternative sizes if current resolution is above all the max resolutions given' do
|
209
209
|
Artwork.current_resolution = 1000
|
210
|
-
Artwork.actual_resolution = 1000
|
211
210
|
|
212
211
|
expect_thumb ['320x', {700 => '100x@100'}], :'320x'
|
213
212
|
end
|
214
213
|
|
215
214
|
it 'picks the first alternative size if current resolution is smaller than all max resolutions' do
|
216
215
|
Artwork.current_resolution = 799
|
217
|
-
Artwork.actual_resolution = 799
|
218
216
|
|
219
217
|
expect_thumb ['320x', {1280 => '500x', 800 => '1000x'}], :'1280x'
|
220
218
|
end
|
221
219
|
|
222
220
|
it 'picks the first alternative size if current resolution is smaller than all max resolutions and supports custom base resolutions' do
|
223
221
|
Artwork.current_resolution = 799
|
224
|
-
Artwork.actual_resolution = 799
|
225
222
|
|
226
223
|
expect_thumb ['320x', {1280 => '50x@100', 800 => '100x@100'}], :'1280x'
|
227
224
|
end
|
228
225
|
|
229
226
|
it 'compares resolutions with <=' do
|
230
227
|
Artwork.current_resolution = 800
|
231
|
-
Artwork.actual_resolution = 800
|
232
228
|
|
233
229
|
expect_thumb ['320x', {1280 => '50x@100', 800 => '100x@100'}], :'1280x'
|
234
230
|
end
|
235
231
|
|
236
232
|
it 'picks the largest alternative size if current resolution is smaller only than the max resolution given' do
|
237
233
|
Artwork.current_resolution = 1200
|
238
|
-
Artwork.actual_resolution = 1200
|
239
234
|
|
240
235
|
expect_thumb ['320x', {1280 => '50x@100', 800 => '100x@100'}], :'640x'
|
241
236
|
end
|
242
237
|
|
243
238
|
it 'ignores non-numeric keys' do
|
244
239
|
Artwork.current_resolution = 1200
|
245
|
-
Artwork.actual_resolution = 1200
|
246
240
|
|
247
241
|
expect_thumb ['320x', {1280 => '50x@100', 800 => '100x@100', :foo => 'bar'}], :'640x'
|
248
242
|
end
|