Class: Lookbook::PreviewsController
Class Method Summary
collapse
Instance Method Summary
collapse
#preview_controller
#inspector_data, #lookup_entities, #path_segments, #set_display_options, #set_params, #set_title
#not_found
Class Method Details
.controller_path ⇒ Object
10
11
12
|
# File 'app/controllers/lookbook/previews_controller.rb', line 10
def self.controller_path
"lookbook/previews"
end
|
Instance Method Details
#index ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'app/controllers/lookbook/previews_controller.rb', line 14
def index
respond_to do |format|
format.json do
render(
json: Lookbook.previews.map do |preview|
{
name: preview.name,
scenarios: preview.scenarios.map { |scenario|
case scenario
when Lookbook::ScenarioEntity
scenario_json(scenario)
when Lookbook::ScenarioGroupEntity
{
name: scenario.name,
examples: scenario.scenarios.map { |s| scenario_json(s) }
}
end
}
}
end
)
end
end
end
|
#show ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
|
# File 'app/controllers/lookbook/previews_controller.rb', line 39
def show
raise_not_found("Preview not found") unless @target
@preview_html = preview_controller.process(
:render_in_layout_to_string,
"lookbook/previews/group",
inspector_data,
layout: @preview.layout,
append_html: (iframe_content_scripts if embedded?)
)
end
|