Module: Plutonium::Helpers::TurboHelper

Defined in:
lib/plutonium/helpers/turbo_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_turbo_frameObject



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.

Returns:

  • (Boolean)


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).

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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_tagObject



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