Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Remove allow currency change preference, rename show currency selector to allow currency change, fix tests

KacperMekarski6e9564902c26
diff --git a/backend/app/controllers/spree/admin/general_settings_controller.rb b/backend/app/controllers/spree/admin/general_settings_controller.rb
index f1b6cf2e80..1e5ad4783c 100644
--- a/backend/app/controllers/spree/admin/general_settings_controller.rb
+++ b/backend/app/controllers/spree/admin/general_settings_controller.rb
@@ -27,7 +27,7 @@ module Spree
end
def render(*args)
- @preferences_currency |= [:allow_currency_change, :show_currency_selector]
+ @preferences_currency |= [:allow_currency_change]
super
end
diff --git a/backend/app/views/spree/admin/general_settings/_form.html.erb b/backend/app/views/spree/admin/general_settings/_form.html.erb
index 2d02e06f33..3a82e8bb5f 100644
--- a/backend/app/views/spree/admin/general_settings/_form.html.erb
+++ b/backend/app/views/spree/admin/general_settings/_form.html.erb
@@ -13,15 +13,5 @@
<p class="help-block"><%= Spree.t('allow_currency_change.long') %></p>
</div>
</div>
-
- <div class="form-group">
- <div class="checkbox">
- <label>
- <%= check_box('', :show_currency_selector, { checked: Spree::Config.show_currency_selector}) %>
- <%= Spree.t('show_currency_selector.short') %>
- </label>
- <p class="help-block"><%= Spree.t('show_currency_selector.long_html') %></p>
- </div>
- </div>
</div>
</div>
diff --git a/backend/spec/features/admin/general_settings/prices_settings_presence_spec.rb b/backend/spec/features/admin/general_settings/prices_settings_presence_spec.rb
index 24b0580b8f..afc548ac38 100644
--- a/backend/spec/features/admin/general_settings/prices_settings_presence_spec.rb
+++ b/backend/spec/features/admin/general_settings/prices_settings_presence_spec.rb
@@ -8,7 +8,6 @@ describe 'Currencies settings presence', type: :feature, js: true do
visit spree.edit_admin_general_settings_path
expect(page).to have_content 'Allow Currency Change'
- expect(page).to have_content 'Show Currency Selector'
end
end
end
diff --git a/backend/spec/features/admin/general_settings/prices_settings_updating_spec.rb b/backend/spec/features/admin/general_settings/prices_settings_updating_spec.rb
index da30eaef2f..64e9ca6b9e 100644
--- a/backend/spec/features/admin/general_settings/prices_settings_updating_spec.rb
+++ b/backend/spec/features/admin/general_settings/prices_settings_updating_spec.rb
@@ -8,7 +8,6 @@ describe 'Updating currencies settings', type: :feature, js: true do
before do
reset_spree_preferences do |config|
config.allow_currency_change = false
- config.show_currency_selector = false
end
end
@@ -17,17 +16,14 @@ describe 'Updating currencies settings', type: :feature, js: true do
# Test initial state
expect(page).to have_unchecked_field('allow_currency_change')
- expect(page).to have_unchecked_field('show_currency_selector')
# Interact with the form
check('allow_currency_change')
- check('show_currency_selector')
click_button 'Update'
# Test final state
expect(page).to have_content 'General Settings has been successfully updated!'
expect(page).to have_checked_field('allow_currency_change')
- expect(page).to have_checked_field('show_currency_selector')
end
end
@@ -35,7 +31,6 @@ describe 'Updating currencies settings', type: :feature, js: true do
before do
reset_spree_preferences do |config|
config.allow_currency_change = true
- config.show_currency_selector = true
end
end
@@ -43,15 +38,12 @@ describe 'Updating currencies settings', type: :feature, js: true do
visit spree.edit_admin_general_settings_path
expect(page).to have_checked_field('allow_currency_change')
- expect(page).to have_checked_field('show_currency_selector')
uncheck('allow_currency_change')
- uncheck('show_currency_selector')
click_button 'Update'
expect(page).to have_content 'General Settings has been successfully updated!'
expect(page).to have_unchecked_field('allow_currency_change')
- expect(page).to have_unchecked_field('show_currency_selector')
end
end
end
diff --git a/core/app/models/spree/app_configuration.rb b/core/app/models/spree/app_configuration.rb
index 48ef7a43b2..f116af911d 100644
--- a/core/app/models/spree/app_configuration.rb
+++ b/core/app/models/spree/app_configuration.rb
@@ -70,7 +70,6 @@ module Spree
# Multi currency configurations
preference :allow_currency_change, :boolean, default: false
- preference :show_currency_selector, :boolean, default: false
# searcher_class allows spree extension writers to provide their own Search class
def searcher_class
diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml
index 6a5d3645af..c91aec85b9 100644
--- a/core/config/locales/en.yml
+++ b/core/config/locales/en.yml
@@ -576,7 +576,7 @@ en:
all: All
allow_currency_change:
short: Allow Currency Change
- long: Allow users to change their currency via the currency picker.
+ long: Display the currency picker in the main nav bar and allow users to change their currency via it. In addition, multiple stores must be supported.
all_adjustments_closed: All adjustments successfully closed!
all_adjustments_opened: All adjustments successfully opened!
all_departments: All departments
@@ -1570,9 +1570,6 @@ en:
shopping_cart: Shopping Cart
show: Show
show_active: Show Active
- show_currency_selector:
- short: Show Currency Selector
- long_html: Display the currency picker in the main nav bar. This will only display if there are multiple supported currencies, and <strong>Allow currency change</strong> option is enabled.
show_deleted: Show Deleted
show_discontinued: Show Discontinued
show_only_complete_orders: Only show complete orders