Skip to content

Commit

Permalink
Fix language and site creation
Browse files Browse the repository at this point in the history
With the switch from Turbolinks to Turbo the redirect after submitting
the remote form inside the dialog stopped working. The resulting page
was rendered inside the dialog instead.

Using our own do_redirect_to method that gracefully handles JS
remote forms we can fix this.
  • Loading branch information
tvdeyen committed Oct 6, 2023
1 parent 4d2e3db commit 47b35ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/controllers/alchemy/admin/languages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def create
@language = Alchemy::Language.new(resource_params)
if @language.save
flash[:notice] = Alchemy.t("Language successfully created")
redirect_to alchemy.admin_pages_path(language_id: @language)
do_redirect_to alchemy.admin_pages_path(language_id: @language)
else
render :new
end
Expand All @@ -48,7 +48,7 @@ def load_current_site
@current_site = Alchemy::Site.current
if @current_site.nil?
flash[:warning] = Alchemy.t("Please create a site first.")
redirect_to admin_sites_path
do_redirect_to admin_sites_path
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/alchemy/admin/sites_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def create
@site = Alchemy::Site.new(resource_params)
if @site.save
flash[:notice] = Alchemy.t("Please create a default language for this site.")
redirect_to alchemy.admin_languages_path(site_id: @site)
do_redirect_to alchemy.admin_languages_path(site_id: @site)
else
render :new
end
Expand Down

0 comments on commit 47b35ca

Please sign in to comment.