-
Notifications
You must be signed in to change notification settings - Fork 408
/
integration_examples_controller.rb
66 lines (50 loc) · 1.74 KB
/
integration_examples_controller.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# frozen_string_literal: true
class IntegrationExamplesController < ActionController::Base
layout false
def variants
request.variant = params[:variant].to_sym if params[:variant]
end
def controller_inline
render(ControllerInlineComponent.new(message: "bar"))
end
def controller_inline_with_block
render(ControllerInlineWithBlockComponent.new(message: "bar").tap do |c|
c.slot(name: "baz")
c.with_content("bam")
end)
end
def controller_inline_baseline
render("integration_examples/_controller_inline", locals: {message: "bar"})
end
def controller_to_string
# Ensures render_to_string_monkey_patch.rb correctly calls `super` when
# not rendering a component:
render_to_string("integration_examples/_controller_inline", locals: {message: "bar"})
render(plain: render_to_string(ControllerInlineComponent.new(message: "bar")))
end
def controller_inline_render_component
render_component(ControllerInlineComponent.new(message: "bar"))
end
def controller_to_string_render_component
render(plain: render_component_to_string(ControllerInlineComponent.new(message: "bar")))
end
def products
@products = [OpenStruct.new(name: "Radio clock"), OpenStruct.new(name: "Mints")]
end
def inline_products
products = [OpenStruct.new(name: "Radio clock"), OpenStruct.new(name: "Mints")]
render(ProductComponent.with_collection(products, notice: "Today only"))
end
def inherited_sidecar
render(InheritedSidecarComponent.new)
end
def inherited_from_uncompilable_component
render(InheritedFromUncompilableComponent.new)
end
def unsafe_component
render(UnsafeComponent.new)
end
def unsafe_postamble_component
render(UnsafePostambleComponent.new)
end
end