6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/rails_com/action_view/template_renderer.rb', line 6
def render(context, options)
return super if defined?(WebConsole) && context.is_a?(WebConsole::View)
request = context.request
if request && request.format.symbol
_formats = [request.format.symbol]
else
_formats = @lookup_context.formats[0..0].presence || [:html]
end
_formats += [:html] if _formats == [:turbo_stream]
@lookup_context.send :_set_detail, :formats, _formats
context_prefix = @lookup_context.prefixes[0]
action = (request&.params || {})['action']
if context_prefix && context_prefix.split('/')[-1].start_with?('_') && action
@lookup_context.prefixes[0] = [@lookup_context.prefixes[1], "_#{action}"].join('/')
elsif context_prefix && action
@lookup_context.prefixes.prepend [context_prefix, "_#{action}"].join('/')
end
context.instance_variable_set(:@_rendered_template, options[:template])
super
end
|