Module: Plutonium::Helpers::TurboHelper
- Defined in:
- lib/plutonium/helpers/turbo_helper.rb
Instance Method Summary collapse
- #current_turbo_frame ⇒ Object
-
#in_frame? ⇒ Boolean
True when the request is rendered inside any turbo frame.
-
#in_modal? ⇒ Boolean
True when the request is rendered inside either modal frame (primary or secondary).
-
#in_secondary_modal? ⇒ Boolean
True when the request is rendered inside the secondary (stacked) modal frame specifically.
- #remote_modal_frame_tag ⇒ Object
Instance Method Details
#current_turbo_frame ⇒ Object
4 5 6 |
# File 'lib/plutonium/helpers/turbo_helper.rb', line 4 def current_turbo_frame request.headers["Turbo-Frame"] end |
#in_frame? ⇒ Boolean
True when the request is rendered inside any turbo frame.
9 |
# File 'lib/plutonium/helpers/turbo_helper.rb', line 9 def in_frame? = current_turbo_frame.present? |
#in_modal? ⇒ Boolean
True when the request is rendered inside either modal frame (primary or secondary).
13 |
# File 'lib/plutonium/helpers/turbo_helper.rb', line 13 def in_modal? = Plutonium::MODAL_FRAMES.include?(current_turbo_frame) |
#in_secondary_modal? ⇒ Boolean
True when the request is rendered inside the secondary (stacked) modal frame specifically.
17 |
# File 'lib/plutonium/helpers/turbo_helper.rb', line 17 def in_secondary_modal? = current_turbo_frame == Plutonium::REMOTE_MODAL_SECONDARY_FRAME |
#remote_modal_frame_tag ⇒ Object
19 20 21 |
# File 'lib/plutonium/helpers/turbo_helper.rb', line 19 def remote_modal_frame_tag(&) turbo_frame_tag(Plutonium::REMOTE_MODAL_FRAME, &) end |