Compare commits

...

7 Commits

Author SHA1 Message Date
Filipe
25063d2c4d Merge pull request #13649 from deivid-rodriguez/fix-removal-flash-message-translations
Improve translations of some flash messages
2026-01-07 16:33:34 +00:00
Maikel
bad04b70a9 Merge pull request #13832 from dacook/pr-template-headings
Increase PR headings to level 2
2026-01-07 17:19:36 +11:00
David Cook
5479572a08 Increase headings to level 2
h4 is rendered as bold text the same size as content.
2026-01-07 17:00:34 +11:00
David Rodríguez
bf0e5c0d44 Let "Tag Rule" and "Voucher" be translated in flash messages 2025-11-26 12:18:06 +01:00
David Rodríguez
6bd2f5af8d Use Spree.t directly for translating the successfully_removed flash message
Since none of the current keys have a `%{resource}` parameter.
2025-11-26 12:18:06 +01:00
David Rodríguez
7bf54088a6 Use Spree.t directly for translating the not_found message
Since none of the current keys interpolate a `%{resource}` parameter.
2025-11-26 12:18:06 +01:00
David Rodríguez
4792040240 Cover tax category removal with a spec 2025-11-26 12:18:05 +01:00
10 changed files with 26 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
#### What? Why?
## What? Why?
- Closes # <!-- Insert issue number here. -->
@@ -7,7 +7,7 @@
#### What should we test?
## What should we test?
<!-- List which features should be tested and how.
This can be similar to the Steps to Reproduce in the issue.
Also think of other parts of the app which could be affected
@@ -16,7 +16,7 @@
- Visit ... page.
-
#### Release notes
## Release notes
<!-- Please select one for your PR and delete the other. -->
@@ -33,12 +33,12 @@ Changelog Category (reviewers may add a label for the release notes):
The title of the pull request will be included in the release notes.
#### Dependencies
## Dependencies
<!-- Does this PR depend on another one?
Add the link or remove this section. -->
#### Documentation updates
## Documentation updates
<!-- Are there any wiki pages that need updating after merging this PR?
List them here or remove this section. -->

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