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.

Show store name instead of default country name in store selector

Damian Legawiec318cc3331732
diff --git a/frontend/app/views/spree/shared/_change_store.html.erb b/frontend/app/views/spree/shared/_change_store.html.erb
index a1bb3a7c97..de347993b2 100644
--- a/frontend/app/views/spree/shared/_change_store.html.erb
+++ b/frontend/app/views/spree/shared/_change_store.html.erb
@@ -16,7 +16,7 @@
<% stores.each do |store| %>
<div class="pl-3 d-flex justify-content-between align-items-center <%= 'active' if store.id == current_store.id %>">
<span class="flag-icon flag-icon-<%= store_country_iso(store) %>"></span>
- <%= link_to "#{store.default_country&.name} (#{store_currency_symbol(store)})", "//#{store.url}", class: 'dropdown-item text-uppercase' %>
+ <%= link_to "#{store.name} (#{store_currency_symbol(store)})", store.formatted_url, class: 'dropdown-item text-uppercase' %>
</div>
<% end %>
</div>
diff --git a/frontend/spec/features/main_nav_bar_spec.rb b/frontend/spec/features/main_nav_bar_spec.rb
index 3ace7422d6..0bea127338 100644
--- a/frontend/spec/features/main_nav_bar_spec.rb
+++ b/frontend/spec/features/main_nav_bar_spec.rb
@@ -33,12 +33,12 @@ describe 'Main navigation bar', type: :feature do
let(:stores_number) { 2 }
let(:first_store) { stores.first }
let(:first_store_currency_symbol) { ::Money::Currency.find(first_store.default_currency).symbol }
- let(:first_link_name) { "#{first_store.default_country&.name} (#{first_store_currency_symbol})" }
- let(:first_url) { "//#{first_store.url}" }
+ let(:first_link_name) { "#{first_store.name} (#{first_store_currency_symbol})" }
+ let(:first_url) { first_store.formatted_url }
let(:second_store) { stores.second }
let(:second_store_currency_symbol) { ::Money::Currency.find(second_store.default_currency).symbol }
- let(:second_link_name) { "#{second_store.default_country&.name} (#{first_store_currency_symbol})" }
- let(:second_url) { "//#{second_store.url}" }
+ let(:second_link_name) { "#{second_store.name} (#{first_store_currency_symbol})" }
+ let(:second_url) { second_store.formatted_url }
it 'shows currency selector button' do
within('.change-store') { expect(page).to have_button(id: 'stores-button') }