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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Modify Store dropdown
Damian Legawiecd2b6f8b1cca0
diff --git a/frontend/app/helpers/spree/frontend_helper.rb b/frontend/app/helpers/spree/frontend_helper.rbindex 42db2380ce..0a1fa48848 100644--- a/frontend/app/helpers/spree/frontend_helper.rb+++ b/frontend/app/helpers/spree/frontend_helper.rb@@ -7,26 +7,6 @@ module Spree@body_classend- def store_country_iso(store)- store ||= current_store- return unless store- return unless store.default_country-- store.default_country.iso.downcase- end-- def stores- @stores ||= Spree::Store.includes(:default_country).order(:id)- end-- def store_currency_symbol(store)- store ||= current_store- return unless store- return unless store.default_currency-- ::Money::Currency.find(store.default_currency).symbol- end-def spree_breadcrumbs(taxon, _separator = '', product = nil)return '' if current_page?('/') || taxon.nil?diff --git a/frontend/app/helpers/spree/store_helper.rb b/frontend/app/helpers/spree/store_helper.rbnew file mode 100644index 0000000000..89eac8e08a--- /dev/null+++ b/frontend/app/helpers/spree/store_helper.rb@@ -0,0 +1,31 @@+module Spree+ module StoreHelper+ def store_country_iso(store)+ store ||= current_store+ return unless store+ return unless store.default_country++ store.default_country.iso.downcase+ end++ def stores+ @stores ||= Spree::Store.includes(:default_country).order(:id)+ end++ def store_currency_symbol(store)+ store ||= current_store+ return unless store+ return unless store.default_currency++ ::Money::Currency.find(store.default_currency).symbol+ end++ def store_locale_name(store)+ store ||= current_store+ return unless store+ return store.name if store.default_locale.blank?++ Spree.t('i18n.this_file_language', locale: store.default_locale)+ end+ end+enddiff --git a/frontend/app/views/spree/shared/_change_store.html.erb b/frontend/app/views/spree/shared/_change_store.html.erbindex 77dcd31b3a..868a07ade8 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.name} (#{store_currency_symbol(store)})", store.formatted_url, class: 'dropdown-item text-uppercase' %>+ <%= link_to "#{store_locale_name(store)} (#{store_currency_symbol(store)})", store.formatted_url, class: 'dropdown-item text-uppercase' %></div><% end %></div>diff --git a/frontend/spec/helpers/store_helper_spec.rb b/frontend/spec/helpers/store_helper_spec.rbnew file mode 100644index 0000000000..71c3aa5b11--- /dev/null+++ b/frontend/spec/helpers/store_helper_spec.rb@@ -0,0 +1,21 @@+require 'spec_helper'++module Spree+ describe StoreHelper, type: :helper do+ describe '#stores' do++ end++ describe '#store_country_iso' do++ end++ describe '#store_currency_symbol' do++ end++ describe '#store_locale_name' do++ end+ end+end