Sha256: e7f9b42d8b7761fdf5c27a9cb6811b4362d7a7e03f6a06a9d59c7c807383cf15
Contents?: true
Size: 1.01 KB
Versions: 4
Compression:
Stored size: 1.01 KB
Contents
module Lookbook module PreviewController def render_example_to_string(preview, example_name) prepend_application_view_paths prepend_preview_examples_view_path @preview = preview @example_name = example_name @render_args = @preview.render_args(@example_name, params: params.permit!) template = @render_args[:template] locals = @render_args[:locals] opts = {} opts[:layout] = nil opts[:locals] = locals if locals.present? Utils.with_optional_action_view_annotations do render html: render_to_string(template, **opts) end end def render_in_layout_to_string(template, locals, opts = {}) append_view_path Lookbook::Engine.root.join("app/views") Utils.with_optional_action_view_annotations do html = render_to_string(template, locals: locals, **determine_layout(opts[:layout])) if opts[:append_html].present? html += opts[:append_html] end render html: html end end end end
Version data entries
4 entries across 4 versions & 1 rubygems