From 4792040240ad35895801bc319fef628993bbcf6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <2887858+deivid-rodriguez@users.noreply.github.com> Date: Wed, 26 Nov 2025 12:17:29 +0100 Subject: [PATCH 1/4] Cover tax category removal with a spec --- .../system/admin/configuration/tax_categories_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/system/admin/configuration/tax_categories_spec.rb b/spec/system/admin/configuration/tax_categories_spec.rb index ea5074d8bf..56605a5848 100644 --- a/spec/system/admin/configuration/tax_categories_spec.rb +++ b/spec/system/admin/configuration/tax_categories_spec.rb @@ -55,4 +55,15 @@ RSpec.describe "Tax Categories" do expect(page).to have_content("desc 99") end end + + context "admin deleting a tax category" do + it "should be able to delete an existing tax category" do + create(:tax_category, name: "To be removed") + click_link "Tax Categories" + accept_confirm('Are you sure?') do + within_row(1) { find(".icon-trash").click } + end + expect(page).not_to have_content("To be removed") + end + end end From 7bf54088a63f5ec5fb3f5511bb8972c7501dc811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <2887858+deivid-rodriguez@users.noreply.github.com> Date: Tue, 25 Nov 2025 11:40:13 +0100 Subject: [PATCH 2/4] Use `Spree.t` directly for translating the `not_found` message Since none of the current keys interpolate a `%{resource}` parameter. --- app/controllers/admin/resource_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/resource_controller.rb b/app/controllers/admin/resource_controller.rb index b15a576f40..e863de0f7d 100644 --- a/app/controllers/admin/resource_controller.rb +++ b/app/controllers/admin/resource_controller.rb @@ -76,7 +76,7 @@ module Admin protected def resource_not_found - flash[:error] = flash_message_for(model_class.new, :not_found) + flash[:error] = Spree.t(:not_found) redirect_to collection_url end From 6bd2f5af8d3666195851b0adfefc4bde77b13085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <2887858+deivid-rodriguez@users.noreply.github.com> Date: Tue, 25 Nov 2025 19:05:20 +0100 Subject: [PATCH 3/4] Use `Spree.t` directly for translating the `successfully_removed` flash message Since none of the current keys have a `%{resource}` parameter. --- app/controllers/admin/resource_controller.rb | 2 +- app/controllers/spree/admin/images_controller.rb | 2 +- app/controllers/spree/admin/product_properties_controller.rb | 2 +- app/controllers/spree/admin/shipping_methods_controller.rb | 2 +- app/controllers/spree/admin/tax_categories_controller.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin/resource_controller.rb b/app/controllers/admin/resource_controller.rb index e863de0f7d..31a7b657f2 100644 --- a/app/controllers/admin/resource_controller.rb +++ b/app/controllers/admin/resource_controller.rb @@ -61,7 +61,7 @@ module Admin def destroy if @object.destroy - flash[:success] = flash_message_for(@object, :successfully_removed) + flash[:success] = Spree.t(:successfully_removed) respond_with(@object) do |format| format.html { redirect_to collection_url } format.js { render partial: "spree/admin/shared/destroy" } diff --git a/app/controllers/spree/admin/images_controller.rb b/app/controllers/spree/admin/images_controller.rb index cb1ebe40ac..193b013562 100644 --- a/app/controllers/spree/admin/images_controller.rb +++ b/app/controllers/spree/admin/images_controller.rb @@ -68,7 +68,7 @@ module Spree destroy_before if @object.destroy - flash[:success] = flash_message_for(@object, :successfully_removed) + flash[:success] = Spree.t(:successfully_removed) end redirect_to location_after_save diff --git a/app/controllers/spree/admin/product_properties_controller.rb b/app/controllers/spree/admin/product_properties_controller.rb index aebdff556e..b92208c924 100644 --- a/app/controllers/spree/admin/product_properties_controller.rb +++ b/app/controllers/spree/admin/product_properties_controller.rb @@ -16,7 +16,7 @@ module Spree @url_filters = ::ProductFilters.new.extract(request.query_parameters) if @object.destroy - flash[:success] = flash_message_for(@object, :successfully_removed) + flash[:success] = Spree.t(:successfully_removed) end # if destroy fails it won't show any errors to the user redirect_to spree.admin_product_product_properties_url(params[:product_id], @url_filters) diff --git a/app/controllers/spree/admin/shipping_methods_controller.rb b/app/controllers/spree/admin/shipping_methods_controller.rb index 25433b213f..8b24f0cc09 100644 --- a/app/controllers/spree/admin/shipping_methods_controller.rb +++ b/app/controllers/spree/admin/shipping_methods_controller.rb @@ -36,7 +36,7 @@ module Spree end @object.touch :deleted_at - flash[:success] = flash_message_for(@object, :successfully_removed) + flash[:success] = Spree.t(:successfully_removed) respond_with(@object) do |format| format.html { redirect_to collection_url } diff --git a/app/controllers/spree/admin/tax_categories_controller.rb b/app/controllers/spree/admin/tax_categories_controller.rb index e9d6547f48..7d7e82c86a 100644 --- a/app/controllers/spree/admin/tax_categories_controller.rb +++ b/app/controllers/spree/admin/tax_categories_controller.rb @@ -5,7 +5,7 @@ module Spree class TaxCategoriesController < ::Admin::ResourceController def destroy if @object.destroy - flash[:success] = flash_message_for(@object, :successfully_removed) + flash[:success] = Spree.t(:successfully_removed) respond_with(@object) do |format| format.html { redirect_to collection_url } format.js { render partial: "spree/admin/shared/destroy" } From bf0e5c0d442079f306c39450e4a562d2da727ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <2887858+deivid-rodriguez@users.noreply.github.com> Date: Fri, 21 Nov 2025 19:07:21 +0100 Subject: [PATCH 4/4] Let "Tag Rule" and "Voucher" be translated in flash messages --- app/controllers/admin/tag_rules_controller.rb | 2 +- app/controllers/admin/vouchers_controller.rb | 2 +- config/locales/en.yml | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/tag_rules_controller.rb b/app/controllers/admin/tag_rules_controller.rb index 620de16ee3..79bd815405 100644 --- a/app/controllers/admin/tag_rules_controller.rb +++ b/app/controllers/admin/tag_rules_controller.rb @@ -30,7 +30,7 @@ module Admin status = :ok if @rule.destroy - flash[:success] = Spree.t(:successfully_removed, resource: "Tag Rule") + flash[:success] = Spree.t(:successfully_removed, resource: Spree.t(:tag_rule)) else flash.now[:error] = t(".destroy_error") status = :internal_server_error diff --git a/app/controllers/admin/vouchers_controller.rb b/app/controllers/admin/vouchers_controller.rb index 72bb759e10..272de55966 100644 --- a/app/controllers/admin/vouchers_controller.rb +++ b/app/controllers/admin/vouchers_controller.rb @@ -14,7 +14,7 @@ module Admin ) if @voucher.save - flash[:success] = I18n.t(:successfully_created, resource: "Voucher") + flash[:success] = I18n.t(:successfully_created, resource: Spree.t(:voucher)) redirect_to edit_admin_enterprise_path(@enterprise, anchor: :vouchers_panel) else render_error diff --git a/config/locales/en.yml b/config/locales/en.yml index 589257fbfb..60d91e17ea 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -4194,6 +4194,8 @@ en: logourl: "Logourl" are_you_sure_delete: "Are you sure you want to delete this record?" confirm_delete: "Confirm Deletion" + tag_rule: "Tag Rule" + voucher: "Voucher" configurations: "Configurations" general_settings: "General Settings"