Merge pull request #13503 from AndreyUsyaev/usandy/fix-i18n-sells-options

Fix missed I18n translations for enterprises sells options
This commit is contained in:
Filipe
2025-08-28 18:50:07 +01:00
committed by GitHub
4 changed files with 17 additions and 1 deletions

View File

@@ -71,6 +71,11 @@ module Admin
"#{enterprise_attachment_removal_panel}_panel"
end
def enterprise_sells_options
scope = "admin.enterprises.admin_index.sells_options"
Enterprise::SELLS.map { |s| [I18n.t(s, scope:), s] }
end
private
def build_enterprise_side_menu_items(is_shop:, show_options: ) # rubocop:disable Metrics/MethodLength

View File

@@ -28,7 +28,7 @@
= enterprise_form.check_box :is_primary_producer
= t('.producer')
- if spree_current_user.admin?
%td= enterprise_form.select :sells, Enterprise::SELLS, {}, class: 'select2 fullwidth'
%td= enterprise_form.select :sells, enterprise_sells_options, {}, class: 'select2 fullwidth'
%td= enterprise_form.check_box :visible, {}, 'public', 'hidden'
- if spree_current_user.admin?
%td= enterprise_form.select :owner_id, enterprise.users.map{ |e| [ e.email, e.id ] }, {}, class: "select2 fullwidth"

View File

@@ -1518,6 +1518,11 @@ en:
visible: Visible?
owner: Owner
producer: Producer
sells_options:
unspecified: unspecified
none: none
own: own
any: any
change_type_form:
producer_profile: Producer Profile
connect_ofn: Connect through OFN

View File

@@ -50,4 +50,10 @@ RSpec.describe Admin::EnterprisesHelper do
expect(visible_items.pluck(:name)).to include "connected_apps"
end
end
describe '#enterprise_sells_options' do
it 'returns sells options with translations' do
expect(helper.enterprise_sells_options.map(&:first)).to eq %w[unspecified none own any]
end
end
end