Sha256: d96e1870e7244f460ada5b5459075800ca4dfd43fdab067a0a876f2ac4c93f1d

Contents?: true

Size: 787 Bytes

Versions: 19

Compression:

Stored size: 787 Bytes

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?
      render html: render_to_string(template, **opts)
    end

    def render_in_layout_to_string(template, locals, layout = nil)
      append_view_path Lookbook::Engine.root.join("app/views")
      render html: render_to_string(template, locals: locals, **determine_layout(layout))
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
lookbook-0.9.8 lib/lookbook/preview_controller.rb
lookbook-0.9.7 lib/lookbook/preview_controller.rb
lookbook-0.9.6 lib/lookbook/preview_controller.rb
lookbook-0.9.5 lib/lookbook/preview_controller.rb
lookbook-0.9.4 lib/lookbook/preview_controller.rb
lookbook-0.9.3 lib/lookbook/preview_controller.rb
lookbook-0.9.2 lib/lookbook/preview_controller.rb
lookbook-0.9.1 lib/lookbook/preview_controller.rb
lookbook-0.9.0 lib/lookbook/preview_controller.rb
lookbook-0.8.3 lib/lookbook/preview_controller.rb
lookbook-0.8.2 lib/lookbook/preview_controller.rb
lookbook-0.8.1 lib/lookbook/preview_controller.rb
lookbook-0.8.0 lib/lookbook/preview_controller.rb
lookbook-0.8.0.beta.0 lib/lookbook/preview_controller.rb
lookbook-0.7.4 lib/lookbook/preview_controller.rb
lookbook-0.7.3 lib/lookbook/preview_controller.rb
lookbook-0.7.2 lib/lookbook/preview_controller.rb
lookbook-0.7.2.beta.5 lib/lookbook/preview_controller.rb
lookbook-0.7.2.beta.4 lib/lookbook/preview_controller.rb