class ViewComponentContrib::WrapperComponent
conditionals in templates.
Thus, wrapper could be used to conditionally render the outer html for components without
The whole wrapper is only rendered when the child component.render? returns true.
WrapperComponent allwows to wrap any component with a custom HTML code.
def call
(Alias couldn't be used here 'cause ViewComponent check for the method presence when
Simply return the contents of the block passed to #render_component.
def call content end
def component
so we can simply call `= wrapper.component` in the place where we're going
The name component is chosen for convienent usage in templates,
Returns rendered child component
def component raise DoubleRenderError, component_instance if @rendered @rendered = component_instance.render_in(view_context).html_safe end
def initialize(component)
def initialize(component) @component_instance = component end