resource_renderer 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee135cf35ef6d693d18379556682510e667018db
|
4
|
+
data.tar.gz: cc6b259dfaed3c54d5992401193af65ce7f69eb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66d61e627911c564a465192a6842064972f7725a9227935bdbee4a2c401250f95fc680dd9fd5abd11ae4206ce63febeaaac7f30912210f5398b1cf5f2b165103
|
7
|
+
data.tar.gz: 87c9edaffd4b2170cb0d7dd8d914dd45d4baf20ac9ac49ba7b1f4d639212f6a54a7083db2b0049f5ef464d97121ccda30f089d5c13789248cdaf99e13d98f3fe
|
@@ -8,8 +8,11 @@ class StringRenderer < ResourceRenderer::AttributeRenderer::Base
|
|
8
8
|
class: html_class
|
9
9
|
}
|
10
10
|
|
11
|
+
value = value_for_attribute(attribute_name)
|
12
|
+
value = value.to_s unless value.is_a?(String)
|
13
|
+
|
11
14
|
helper.capture do
|
12
|
-
h.content_tag(:div, html_attributes) {
|
15
|
+
h.content_tag(:div, html_attributes) { value }
|
13
16
|
end
|
14
17
|
end
|
15
18
|
end
|
@@ -2,13 +2,16 @@ class ThumbnailRenderer < ResourceRenderer::AttributeRenderer::Base
|
|
2
2
|
def display(attribute_name, label, options = {}, &block)
|
3
3
|
options.reverse_merge!(style: :thumb, image_tag_options: { class: 'thumbnail' })
|
4
4
|
style = options.delete(:style)
|
5
|
+
link_to_url_proc = options.delete(:link_to_url) # .try(:call, resource)
|
6
|
+
link_to_url = helper.instance_exec(model, &link_to_url_proc) if link_to_url_proc.respond_to?(:call)
|
5
7
|
image_tag_options = options.delete(:image_tag_options)
|
6
8
|
|
7
9
|
attachment = value_for_attribute(attribute_name)
|
8
10
|
return unless attachment.respond_to?(:url)
|
9
11
|
source = attachment.url(style)
|
12
|
+
link_to_target = link_to_url || attachment.url
|
10
13
|
|
11
|
-
helper.link_to(
|
14
|
+
helper.link_to(link_to_target, { data: { gallery: 'gallery' } }) do
|
12
15
|
helper.image_tag(source, image_tag_options)
|
13
16
|
end
|
14
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resource_renderer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|