izi_lightup 0.0.0.1 → 1.0.0
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/app/helpers/critical_helper.rb +3 -3
- data/lib/izi_lightup/smart_picture.rb +11 -3
- data/lib/izi_lightup/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0ddd7b35185578e102f284a179246105ec9acb0f3c77c44fd7dee54d72933e1
|
4
|
+
data.tar.gz: 62872691110bfda58f936641bb05c86ff7093416d81f23bc153fb6a9282555d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de7acb385a35f06e9ce332cb04d5d7564482758b48826a5a2926b19fa7499e3816976fcefddfcedc4bd671ce0c4a42c92bd491d90ba2c7012d022969bbef04ab
|
7
|
+
data.tar.gz: 4672a0cc352ffb84c2937c5b08a78b1e10870126238c3a338e5e485779bd97dc0224fd1b3db6fb0569bbed1157bb690138038e69f29422035f9207fc4cdc718e
|
@@ -31,13 +31,13 @@ module CriticalHelper
|
|
31
31
|
return inline_css(name) if Rails.env.production?
|
32
32
|
|
33
33
|
# inject measure js for development
|
34
|
-
inline_css(name) + inline_js('utils/measure.js')
|
34
|
+
inline_css(name) + inline_js('crit-utils/measure.js')
|
35
35
|
end
|
36
36
|
|
37
|
-
def smart_picture(object,
|
37
|
+
def smart_picture(object, *args, **xargs, &block)
|
38
38
|
return '' if object.blank?
|
39
39
|
|
40
|
-
IziLightup::SmartPicture.render(object,
|
40
|
+
IziLightup::SmartPicture.render(object, *args, **xargs, &block)
|
41
41
|
end
|
42
42
|
|
43
43
|
private
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
module IziLightup
|
4
4
|
module SmartPicture
|
5
|
-
include ActionView::Helpers::AssetTagHelper
|
6
|
-
|
7
5
|
class << self
|
6
|
+
include ActionView::Helpers::AssetTagHelper
|
7
|
+
|
8
8
|
def render(object, fields = %i[picture], versions = [], params = {})
|
9
9
|
return '' if object.blank?
|
10
10
|
|
@@ -19,7 +19,7 @@ module IziLightup
|
|
19
19
|
next unless version_name == :default || item.data.respond_to?(version_name)
|
20
20
|
|
21
21
|
version = version_name == :default ? item.data : item.data.public_send(version_name)
|
22
|
-
next
|
22
|
+
next unless version&.file&.exists? && version&.url&.present?
|
23
23
|
|
24
24
|
url = version.url
|
25
25
|
params.merge!(%i[width height].zip(version.dimensions).to_h)
|
@@ -32,6 +32,14 @@ module IziLightup
|
|
32
32
|
|
33
33
|
''
|
34
34
|
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def fetch_items(object, fields)
|
39
|
+
Array.wrap(fields).map do |name|
|
40
|
+
object.respond_to?(name) ? object.public_send(name) : nil
|
41
|
+
end.compact
|
42
|
+
end
|
35
43
|
end
|
36
44
|
end
|
37
45
|
end
|
data/lib/izi_lightup/version.rb
CHANGED