Class: Lookbook::PreviewsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Lookbook::PreviewsController
- Defined in:
- app/controllers/lookbook/previews_controller.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from ApplicationController
Class Method Details
.controller_path ⇒ Object
7 8 9 |
# File 'app/controllers/lookbook/previews_controller.rb', line 7 def self.controller_path "lookbook/previews" end |
Instance Method Details
#preview ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/lookbook/previews_controller.rb', line 15 def preview if @target begin opts = {layout: @preview.layout} if params[:lookbook_embed] == "true" opts[:append_html] = "<script src=\"/lookbook-assets/js/embed.js?v=#{Lookbook.version}\"></script>".html_safe end preview_html = preview_controller.process(:render_in_layout_to_string, "lookbook/preview", inspector_data, **opts) render html: preview_html rescue => exception render_in_layout "lookbook/error", layout: "lookbook/standalone", error: prettify_error(exception) end else show_404 layout: "lookbook/standalone" end end |
#show ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/lookbook/previews_controller.rb', line 34 def show if @target begin @main_panels = main_panels @drawer_panels = drawer_panels rescue => exception render_in_layout "lookbook/error", layout: "lookbook/inspector", error: prettify_error(exception) end else show_404 end end |
#show_legacy ⇒ Object
47 48 49 50 |
# File 'app/controllers/lookbook/previews_controller.rb', line 47 def show_legacy Lookbook.logger.warn("Legacy URL path detected. These paths are deprecated and will be removed in a future version") redirect_to lookbook_inspect_path params[:path] end |