Sha256: d852e8208c855e64a4c346255126036671c2bcd27cd7c152f08b9b032b603435
Contents?: true
Size: 1.34 KB
Versions: 9
Compression:
Stored size: 1.34 KB
Contents
require 'digest' module Spree module NavigationHelper def spree_navigation_data @spree_navigation_data ||= SpreeStorefrontConfig.dig(I18n.locale, :navigation) || SpreeStorefrontConfig.dig(current_store.code, :navigation) || SpreeStorefrontConfig.dig(:default, :navigation) || [] # safeguard for older Spree installs that don't have spree_navigation initializer # or spree.yml file present rescue [] end def spree_nav_cache_key(section = 'header') @spree_nav_cache_key = begin keys = base_cache_key + [current_store, spree_navigation_data_cache_key, Spree::Config[:logo], stores&.cache_key, section] Digest::MD5.hexdigest(keys.join('-')) end end def main_nav_image(image_path, title = '') image_url = asset_path(asset_exists?(image_path) ? image_path : 'noimage/plp.png') lazy_image( src: image_url, alt: title, width: 350, height: 234 ) end def should_render_internationalization_dropdown? (defined?(should_render_locale_dropdown?) && should_render_locale_dropdown?) || (defined?(should_render_currency_dropdown?) && should_render_currency_dropdown?) end private def spree_navigation_data_cache_key @spree_navigation_data_cache_key ||= Digest::MD5.hexdigest(spree_navigation_data.to_s) end end end
Version data entries
9 entries across 9 versions & 1 rubygems