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: af9541eae6259c83199423f61b502e512aad0c8e
4
- data.tar.gz: 5ee324ad7bf17d0cd2cb34b0ed67570ba4ae835a
3
+ metadata.gz: c28d9c9484d74d976925711f9ca3e1ca8c663f05
4
+ data.tar.gz: 230d79ba5a01fbca38ee564841753cd50aa74bc2
5
5
  SHA512:
6
- metadata.gz: 493fb0b2b84ff8473068ca8eb64a32fa0d5e15986478a34e1c8d9d3392927e734f691c430399a0421e75e6cd967458ee523a67141e1a4fa1e6f6a5e45ea3dc32
7
- data.tar.gz: 98e51bd2894e742c9f0b70e6bf85e4c182345e3486a064f700599614f75c33d7c8dc4981059c36f5e04cfafc463166048450b45da558ac3bd5a40d1401376928
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
- = content_tag :img do |el|
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
@@ -1,3 +1,3 @@
1
- = content_tag :img do |el|
1
+ = empty_content_tag :img do |el|
2
2
  - attrs.each {|key_name, value| el[key_name.to_sym] = value }
3
3
  - el[:src] = image_src
@@ -1,3 +1,3 @@
1
1
  module InplaceEditing
2
- VERSION = "0.3.14"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inplace_editing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.14
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrique Rangel