Module: ViewComponent::Live::Subscriber
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/view_component/live/subscriber.rb
Instance Method Summary collapse
-
#live ⇒ Object
Used as view helper to wrap view in div that will connect to auto-updating stimulus controller If we render the component in live update on cable we will not wrap it - we just need the component content.
- #live_render! ⇒ Object
- #live_render? ⇒ Boolean
Instance Method Details
#live ⇒ Object
Used as view helper to wrap view in div that will connect to auto-updating stimulus controller If we render the component in live update on cable we will not wrap it - we just need the component content.
23 24 25 26 27 |
# File 'app/models/view_component/live/subscriber.rb', line 23 def live yield and return if live_render? # <div data-controller="live" data-live-component="UserCardComponent" data-live-id="<%= id %>"> content_tag(:div, nil, data: {controller: :live, live_component: self.class.name, live_id: id}) { yield } end |
#live_render! ⇒ Object
6 7 8 |
# File 'app/models/view_component/live/subscriber.rb', line 6 def live_render! @live_render = true end |
#live_render? ⇒ Boolean
10 11 12 |
# File 'app/models/view_component/live/subscriber.rb', line 10 def live_render? @live_render end |