Use helper to update flash in streams
This commit is contained in:
parent
db908d4ea4
commit
c57fe587c2
|
@ -8,4 +8,10 @@ module ApplicationHelper
|
|||
def current_user
|
||||
@current_user ||= User.find(session[:user_id]) if logged_in?
|
||||
end
|
||||
|
||||
def update_flash
|
||||
turbo_stream.replace "flash_wrapper" do
|
||||
render "shared/flash"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<% @title = "Log in" %>
|
||||
<%= turbo_stream.replace "flash_wrapper" do %>
|
||||
<%= render "shared/flash" %>
|
||||
<% end %>
|
||||
|
||||
<%= update_flash %>
|
||||
|
||||
<%= turbo_stream.replace "session_form" do %>
|
||||
<%= form_with url: sessions_path, method: :post, id: "session_form" do |f| %>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<% @title = "Edit account details" %>
|
||||
<%= turbo_stream.replace "flash_wrapper" do %>
|
||||
<%= render "shared/flash" %>
|
||||
<% end %>
|
||||
|
||||
<%= update_flash %>
|
||||
|
||||
<%= turbo_stream.replace "user_form" do %>
|
||||
<%= render partial: "form",
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<% @title = "Register" %>
|
||||
<%= turbo_stream.replace "flash_wrapper" do %>
|
||||
<%= render "shared/flash" %>
|
||||
<% end %>
|
||||
|
||||
<%= update_flash %>
|
||||
|
||||
<%= turbo_stream.replace "user_form" do %>
|
||||
<%= render partial: "form",
|
||||
|
|
Loading…
Reference in New Issue