inplace_editing 0.3.14 → 0.4.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c28d9c9484d74d976925711f9ca3e1ca8c663f05
|
4
|
+
data.tar.gz: 230d79ba5a01fbca38ee564841753cd50aa74bc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54bde92c6fab90c6b52b52a7db5db6f5c56654fd614d7520f8a2495aef2025d811b3ffb398bb6c7b316dbc6846b9d4cf4058cf4e8904d198dbab8a330276939c
|
7
|
+
data.tar.gz: c45ba00d7e24484b2c0f3aa4ae75e2a6aa97857e00c88aca90459ac1c6f174578b8f734898a08fc45d13a7963f5552b8f17cd8f00d71e0eaa2788ee6cd3547b8
|
@@ -97,6 +97,19 @@ module InplaceEditingHelper
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
+
def empty_content_tag(*args)
|
101
|
+
if block_given?
|
102
|
+
tag = Tag.new(args[0], args[1] || {})
|
103
|
+
old_buf = @output_buffer
|
104
|
+
@output_buffer = ActionView::OutputBuffer.new
|
105
|
+
content = tag.render(@output_buffer.presence)
|
106
|
+
@output_buffer = old_buf
|
107
|
+
content
|
108
|
+
else
|
109
|
+
super
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
100
113
|
class Tag
|
101
114
|
include ActionView::Helpers::CaptureHelper
|
102
115
|
attr_accessor :id
|
@@ -3,7 +3,7 @@
|
|
3
3
|
= f.input property.to_s + "_cache", as: :hidden
|
4
4
|
.editor-container
|
5
5
|
.image-container style="#{image_src.blank? ? 'display:none' : ''}"
|
6
|
-
=
|
6
|
+
= empty_content_tag :img do |el|
|
7
7
|
- attrs.each {|key_name, value| el[key_name.to_sym] = value }
|
8
8
|
- el[:class] = el[:class].present? ? (el[:class] + ' preview editable-preview') : 'preview editable-preview'
|
9
9
|
- el[:src] = image_src
|