diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index 0f04c0dfa..7cd01cc8f 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -83,7 +83,14 @@ class SubmissionsController < ApplicationController I18n.t('submission_has_been_archived') end - redirect_back(fallback_location: @submission.template_id ? template_path(@submission.template) : root_path, notice:) + if turbo_native_app? && request.format.turbo_stream? + flash.now[:notice] = notice + + render turbo_stream: [turbo_stream.remove(@submission), turbo_stream.append_all('body', partial: 'shared/flash')] + else + redirect_back(fallback_location: @submission.template_id ? template_path(@submission.template) : root_path, + notice:) + end end private diff --git a/app/views/templates/_submission.html.erb b/app/views/templates/_submission.html.erb index 6f3289f33..228e09053 100644 --- a/app/views/templates/_submission.html.erb +++ b/app/views/templates/_submission.html.erb @@ -1,5 +1,5 @@ <% status_badges = { 'awaiting' => 'badge-info', 'sent' => 'badge-info', 'completed' => 'badge-success', 'opened' => 'badge-warning', 'declined' => 'badge-error' } %> -