shimmer 0.0.15 → 0.0.18
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/lib/shimmer/utils/file_helper.rb +21 -3
- data/lib/shimmer/utils/remote_navigation.rb +7 -3
- data/lib/shimmer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de8e99f1e252a60ee4c57442fe9fe67ba7af78e626b55d7c1756eedf3a83e404
|
4
|
+
data.tar.gz: d28eeba9b1cdf8d9c1fc46151a334dc0993cacfbafe91223f14647e988a3ba23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e750c73c60fa769a97526a0eaeb13b0f497539d9ae5c5500c581e2b0aafa7dc922c61b6edf6c4514d8946e8526d5789b5e454ce5787f4850cb598bd9450c6f05
|
7
|
+
data.tar.gz: 62bcf6a9014420997d088bd41e9c491b4257456ec75f5881e252db5b7aea8b107c2d531ff2b10cba44e037d8eeb387a0edfbedcc09618da898dd3267bf84cad2
|
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
module Shimmer
|
4
4
|
module FileHelper
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
ActiveSupport.on_load(:action_view) do
|
9
|
+
include Shimmer::FileAdditions
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module FileAdditions
|
5
15
|
def image_tag(source, **options)
|
6
16
|
return nil if source.blank?
|
7
17
|
|
@@ -9,19 +19,27 @@ module Shimmer
|
|
9
19
|
attachment = source
|
10
20
|
width = options[:width]
|
11
21
|
height = options[:height]
|
12
|
-
source =
|
22
|
+
source = image_file_path(source, width: width, height: height)
|
13
23
|
options[:loading] = :lazy
|
14
|
-
options[:srcset] = "#{source} 1x, #{
|
24
|
+
options[:srcset] = "#{source} 1x, #{image_file_path(attachment, width: width.to_i * 2, height: height ? height.to_i * 2 : nil)} 2x" if options[:width].present?
|
15
25
|
end
|
16
26
|
super source, options
|
17
27
|
end
|
18
28
|
|
29
|
+
def image_file_path(source, width: nil, height: nil)
|
30
|
+
image_file_proxy(source, width: width, height: height)&.path
|
31
|
+
end
|
32
|
+
|
19
33
|
def image_file_url(source, width: nil, height: nil)
|
34
|
+
image_file_proxy(source, width: width, height: height)&.url
|
35
|
+
end
|
36
|
+
|
37
|
+
def image_file_proxy(source, width: nil, height: nil)
|
20
38
|
return if source.blank?
|
21
39
|
return source if source.is_a?(String)
|
22
40
|
|
23
41
|
blob = source.try(:blob) || source
|
24
|
-
Shimmer::FileProxy.new(blob_id: blob.id, width: width, height: height)
|
42
|
+
Shimmer::FileProxy.new(blob_id: blob.id, width: width, height: height)
|
25
43
|
end
|
26
44
|
end
|
27
45
|
end
|
@@ -22,8 +22,12 @@ module Shimmer
|
|
22
22
|
end
|
23
23
|
|
24
24
|
helper_method :close_modal_path
|
25
|
-
def close_modal_path(id
|
26
|
-
|
25
|
+
def close_modal_path(id = nil)
|
26
|
+
if id.present?
|
27
|
+
"javascript:ui.modal.close(#{{id: id}.to_json})"
|
28
|
+
else
|
29
|
+
"javascript:ui.modal.close()"
|
30
|
+
end
|
27
31
|
end
|
28
32
|
|
29
33
|
helper_method :popover_path
|
@@ -87,7 +91,7 @@ module Shimmer
|
|
87
91
|
|
88
92
|
def close_modal(id = nil)
|
89
93
|
if id.present?
|
90
|
-
run_javascript "ui.modal.close(
|
94
|
+
run_javascript "ui.modal.close(#{{id: id}.to_json})"
|
91
95
|
else
|
92
96
|
run_javascript "ui.modal.close()"
|
93
97
|
end
|
data/lib/shimmer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shimmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Ravens
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|