Module: Plutonium::Helpers::TurboStreamActionsHelper

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

Instance Method Summary collapse

Instance Method Details

#turbo_stream_close_frame(frame_id) ⇒ Object

Closes the <dialog> inside the targeted frame and empties the frame. Used to dismiss a stacked modal without affecting the rest of the page.



15
16
17
# File 'lib/plutonium/helpers/turbo_stream_actions_helper.rb', line 15

def turbo_stream_close_frame(frame_id)
  turbo_stream_action_tag :close_frame, target: frame_id
end

#turbo_stream_redirect(url) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/plutonium/helpers/turbo_stream_actions_helper.rb', line 4

def turbo_stream_redirect(url)
  if turbo_stream_redirect_same_page?(url)
    turbo_stream_action_tag :refresh
  else
    turbo_stream_action_tag :redirect, url:
  end
end

#turbo_stream_reload_frame(frame_id) ⇒ Object

Reloads the targeted frame from its current src. Used to refresh the primary modal after a secondary-modal action mutates data the primary depends on.



22
23
24
# File 'lib/plutonium/helpers/turbo_stream_actions_helper.rb', line 22

def turbo_stream_reload_frame(frame_id)
  turbo_stream_action_tag :reload_frame, target: frame_id
end