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.

DeprecateBaseHelper#logo

Damian Legawiec9497ee04e5b1
diff --git a/core/app/helpers/spree/base_helper.rb b/core/app/helpers/spree/base_helper.rb
index 00b0e0c75c..79729fd451 100644
--- a/core/app/helpers/spree/base_helper.rb
+++ b/core/app/helpers/spree/base_helper.rb
@@ -45,6 +45,11 @@ module Spree
end
def logo(image_path = nil, options = {})
+ ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
+ `BaseHelper#logo` is deprecated and will be removed in Spree 5.0.
+ Please use `FrontendHelper#logo` instead
+ DEPRECATION
+
image_path ||= if current_store.logo.attached? && current_store.logo.variable?
main_app.url_for(current_store.logo.variant(resize: '244x104>'))
elsif current_store.logo.attached? && current_store.logo.image?
diff --git a/frontend/app/helpers/spree/frontend_helper.rb b/frontend/app/helpers/spree/frontend_helper.rb
index 38d7ab771d..8f08ee8a3a 100644
--- a/frontend/app/helpers/spree/frontend_helper.rb
+++ b/frontend/app/helpers/spree/frontend_helper.rb
@@ -8,6 +8,22 @@ module Spree
@body_class
end
+ def logo(image_path = nil, options = {})
+ image_path ||= if current_store.logo.attached? && current_store.logo.variable?
+ main_app.url_for(current_store.logo.variant(resize: '244x104>'))
+ elsif current_store.logo.attached? && current_store.logo.image?
+ main_app.url_for(current_store.logo)
+ else
+ Spree::Config[:logo]
+ end
+
+ path = spree.respond_to?(:root_path) ? spree.root_path : main_app.root_path
+
+ link_to path, 'aria-label': current_store.name, method: options[:method] do
+ image_tag image_path, alt: current_store.name, title: current_store.name
+ end
+ end
+
def spree_breadcrumbs(taxon, _separator = '', product = nil)
return '' if current_page?('/') || taxon.nil?