From 420086cfebd672dc3f80e7c7f2893e8937015e57 Mon Sep 17 00:00:00 2001 From: Tomasz Donarski Date: Mon, 9 Oct 2023 08:49:14 +0200 Subject: [PATCH] Refactor action_builder, so that it takes translation options as an argument --- app/models/spree/admin/actions/action_builder.rb | 8 +++----- .../spree/admin/actions/order_default_actions_builder.rb | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/models/spree/admin/actions/action_builder.rb b/app/models/spree/admin/actions/action_builder.rb index cd8e0f1eda..8a5f70f1bd 100644 --- a/app/models/spree/admin/actions/action_builder.rb +++ b/app/models/spree/admin/actions/action_builder.rb @@ -28,16 +28,14 @@ def build_config url: @url, classes: @classes, availability_check: @availability_check, - text: text, + text: text(@name), method: @method, id: @id } end - def text - return ::Spree.t(@name) unless @translation_options.present? - - ::Spree.t(@name, scope: @translation_options[:scope], default: ::Spree.t(@name)) + def text(text, options = {}) + ::Spree.t(text, options) end # def available?(current_ability, resource) diff --git a/app/models/spree/admin/actions/order_default_actions_builder.rb b/app/models/spree/admin/actions/order_default_actions_builder.rb index 6096bfee47..bf8dd728d7 100644 --- a/app/models/spree/admin/actions/order_default_actions_builder.rb +++ b/app/models/spree/admin/actions/order_default_actions_builder.rb @@ -30,7 +30,8 @@ def resend_config classes: 'btn-secondary', method: :post, translation_options: { - scope: 'admin.order.events' + scope: 'admin.order.events', + default: ::Spree.t(:resend) } } end