From 17a3d23d68060c7daff0c36924593af984629aec Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 23 Apr 2021 14:00:18 +1000 Subject: [PATCH] Handle user clicking upload button early --- app/controllers/admin/terms_of_service_files_controller.rb | 3 +++ config/locales/en.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/app/controllers/admin/terms_of_service_files_controller.rb b/app/controllers/admin/terms_of_service_files_controller.rb index e3cc71a9db..38805526e9 100644 --- a/app/controllers/admin/terms_of_service_files_controller.rb +++ b/app/controllers/admin/terms_of_service_files_controller.rb @@ -15,6 +15,9 @@ module Admin def create TermsOfServiceFile.create!(file_params) redirect_to main_app.admin_terms_of_service_files_path + rescue ActionController::ParameterMissing + flash[:error] = t(".select_file") + redirect_to main_app.admin_terms_of_service_files_path end def destroy diff --git a/config/locales/en.yml b/config/locales/en.yml index ba909aabd1..a1934c45c0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -449,6 +449,8 @@ en: embedded_shopfronts_whitelist: "External Domains Whitelist" terms_of_service_files: + create: + select_file: "Please select a file first." show: title: "Terms of Service files" no_files: "No terms of services have been uploaded yet."