hiccdown 1.1.3 → 1.1.4

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hiccdown/railtie.rb +23 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17118bff652e5175c96b146254a53195f6c67094e87a242c56be8d2cd6eee3bf
4
- data.tar.gz: 4bf8a9ce13203c56dd2ae932a3f574bfc6507601643a0241e02f6d883b4eac06
3
+ metadata.gz: 0d2ce8eb54383861862d6c6b759571950b08a497afc77207d6ce7fb5f9831b39
4
+ data.tar.gz: c999fbd2e61958b821da89054dedd0f1a3e82d97488c959cb6bf2e17e70ef955
5
5
  SHA512:
6
- metadata.gz: 64ecc32adb2249acaa85f94c6535e5128e0c384584a4117ccb6703c10c8a908ac3b8c27665007f93e4231773147c663f35b0a424d2c47434749e527d2927e4ac
7
- data.tar.gz: 81091e36fa8c1bb05e73229d7fc9072aa730371ecc19ca487480a024646ebba5b055dc2f45e46f59b61f3e82ed44e9e23b2d4ef7ac5f806ac6b340b45ad728d5
6
+ metadata.gz: 9b81329b2735468c9a5b874cb5af90b907638145e09c1d2544ff2703e5ab01a277c3c0959cb590d8129e9e0b0bc2a2a7c009d2c6630601b29720fc20b14318e8
7
+ data.tar.gz: 48ca0223951e71ff9cdbaf1c952bd9650be4bb324423b8e7d895aa901c0be68d81e8c7e308b55e01833ce9195aa084b5337d72f32c771e13df4ee6bfe99dd162
@@ -7,6 +7,25 @@ module Hiccdown
7
7
  end
8
8
  end
9
9
 
10
+ class Renderable
11
+ def initialize(helper_module, action_name)
12
+ @helper_module = helper_module
13
+ @action_name = action_name
14
+ end
15
+
16
+ # This is the view-bound view_context. Needed for `content_for` to work
17
+ # properly in helper, see https://stackoverflow.com/a/78783866/1371131
18
+ def render_in(view_context)
19
+ content = @helper_module.instance_method(@action_name).bind_call(view_context)
20
+
21
+ Hiccdown::to_html(content)
22
+ end
23
+
24
+ def format
25
+ :html
26
+ end
27
+ end
28
+
10
29
  module CustomViewRendering
11
30
  extend ActiveSupport::Concern
12
31
 
@@ -45,8 +64,10 @@ module Hiccdown
45
64
  helper_module = helper_name.constantize
46
65
 
47
66
  if helper_module.instance_methods(false).include?(action_name.to_sym)
48
- content = helper_module.instance_method(action_name).bind(view_context).call
49
- original_render({ html: Hiccdown::to_html(content).html_safe, layout: !request.format.turbo_stream? }.merge(options))
67
+ original_render(
68
+ Hiccdown::Renderable.new(helper_module, action_name),
69
+ { layout: !request.format.turbo_stream? }.merge(options)
70
+ )
50
71
  else
51
72
  original_render({ action: action_name }.merge(options))
52
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiccdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis Hackethal