Class: Lookbook::PreviewsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/lookbook/previews_controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationController

#index

Class Method Details

.controller_pathObject



3
4
5
# File 'app/controllers/lookbook/previews_controller.rb', line 3

def self.controller_path
  "lookbook/previews"
end

Instance Method Details

#previewObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/lookbook/previews_controller.rb', line 10

def preview
  if @example
    set_params
    begin
      render html: render_examples(examples_data)
    rescue => exception
      render_in_layout "lookbook/error",
        layout: "lookbook/basic",
        error: prettify_error(exception),
        disable_header: true
    end
  else
    render_in_layout "not_found"
  end
end

#showObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/lookbook/previews_controller.rb', line 26

def show
  if @example
    begin
      set_params
      @examples = examples_data
      @drawer_panels = drawer_panels.filter { |name, panel| panel[:show] }
      @preview_panels = preview_panels.filter { |name, panel| panel[:show] }
    rescue => exception
      render_in_layout "lookbook/error", error: prettify_error(exception)
    end
  else
    render_in_layout "not_found"
  end
end