From 410d0ddb91a4ba757ea34a11586a0fc499ed3257 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 6 Oct 2023 11:51:38 +0200 Subject: [PATCH] Fix language and site creation 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. (cherry picked from commit 47b35ca2eb59a3a70f5042692a6a7359a5101988) --- app/controllers/alchemy/admin/languages_controller.rb | 4 ++-- app/controllers/alchemy/admin/sites_controller.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/alchemy/admin/languages_controller.rb b/app/controllers/alchemy/admin/languages_controller.rb index 5b43eb8c4c..94b3af02da 100644 --- a/app/controllers/alchemy/admin/languages_controller.rb +++ b/app/controllers/alchemy/admin/languages_controller.rb @@ -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 @@ -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 diff --git a/app/controllers/alchemy/admin/sites_controller.rb b/app/controllers/alchemy/admin/sites_controller.rb index be79b0dd29..6a340f397a 100644 --- a/app/controllers/alchemy/admin/sites_controller.rb +++ b/app/controllers/alchemy/admin/sites_controller.rb @@ -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