Sha256: 6ee06b8538ad979de78d47300887744516e969f79e98a70f345f740eb86020be

Contents?: true

Size: 775 Bytes

Versions: 5

Compression:

Stored size: 775 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_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_to_string template, locals: locals, **determine_layout(@preview.lookbook_layout)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lookbook-0.4.6 lib/lookbook/preview_controller.rb
lookbook-0.4.5 lib/lookbook/preview_controller.rb
lookbook-0.4.4 lib/lookbook/preview_controller.rb
lookbook-0.4.3 lib/lookbook/preview_controller.rb
lookbook-0.4.2 lib/lookbook/preview_controller.rb