Merge pull request #13649 from deivid-rodriguez/fix-removal-flash-message-translations

Improve translations of some flash messages
This commit is contained in:
Filipe
2026-01-07 16:33:34 +00:00
committed by GitHub
9 changed files with 21 additions and 8 deletions

View File

@@ -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" }
@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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 }

View File

@@ -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" }

View File

@@ -4195,6 +4195,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"

View File

@@ -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