Class: Plum::Cp::ThemePreviewsController

Inherits:
BaseController show all
Defined in:
app/controllers/plum/cp/theme_previews_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/plum/cp/theme_previews_controller.rb', line 4

def show
  theme = ThemeRegistry.new.find(params[:handle])
  return render file: Rails.public_path.join("404.html"), status: :not_found, layout: false unless theme

  context = LiquidContext.new(
    controller: self,
    site: current_site,
    theme_name: theme.handle,
    theme_settings: preview_theme_settings(theme)
  )

  html = LiquidRenderer.render_template("index", context.to_h)
  render html: html.html_safe, layout: false
end