Module: Trestle::Turbo::FrameHelper
- Defined in:
- app/helpers/trestle/turbo/frame_helper.rb
Instance Method Summary collapse
-
#index_turbo_frame(**attributes, &block) ⇒ Object
[DEPRECATED].
-
#resource_turbo_frame(instance, **attributes, &block) ⇒ Object
Renders a <turbo-frame> container for an instance/resource view.
Instance Method Details
#index_turbo_frame(**attributes, &block) ⇒ Object
- DEPRECATED
-
The #content turbo-frame found in app/views/trestle/application/_layout.html.erb is now used as a common top-level hook for the ‘reloadable’ Stimulus controller.
33 34 35 36 37 |
# File 'app/helpers/trestle/turbo/frame_helper.rb', line 33 def index_turbo_frame(**attributes, &block) Trestle.deprecator.warn("The index_turbo_frame helper is deprecated and will be removed in future versions of Trestle.") yield nil end |
#resource_turbo_frame(instance, **attributes, &block) ⇒ Object
Renders a <turbo-frame> container for an instance/resource view. A resource turbo frame sets its DOM id from the given instance and has a default target of “_top” (except for modal requests).
attributes - Additional HTML attributes to add to the <turbo-frame> tag
Examples
<%= resource_turbo_frame(article) do %> ...
<%= resource_turbo_frame(article, id: dom_id(article, "comment")) %> ...
Returns a HTML-safe String.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/trestle/turbo/frame_helper.rb', line 17 def resource_turbo_frame(instance, **attributes, &block) defaults = { id: dom_id(instance), target: ("_top" unless modal_request?), data: { controller: ("deprecated--init" if modal_request? || request.post? || turbo_frame_request?) } } tag.turbo_frame(**defaults.merge(attributes), &block) end |