Module: Spree::MailHelper

Includes:
BaseHelper, ImagesHelper
Defined in:
app/helpers/spree/mail_helper.rb

Instance Method Summary collapse

Methods included from ImagesHelper

#spree_asset_aspect_ratio, #spree_image_tag, #spree_image_url, #spree_image_variant_options

Methods included from BaseHelper

#all_countries, #available_countries, #base_cache_key, #default_image_for_product, #default_image_for_product_or_variant, #display_compare_at_price, #display_price, #frontend_available?, #link_to_tracking, #maximum_quantity, #meta_data, #meta_data_tags, #method_missing, #object, #og_meta_data, #og_meta_data_tags, #payment_method_icon_tag, #pretty_date, #pretty_time, #seo_url, #spree_base_cache_key, #spree_base_cache_scope, #spree_class_name_as_path, #spree_dom_id, #spree_favicon_path, #spree_resource_path, #spree_storefront_resource_url

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Spree::BaseHelper

Instance Method Details

#logo_pathObject



19
20
21
22
23
24
25
# File 'app/helpers/spree/mail_helper.rb', line 19

def logo_path
  Spree::Deprecation.warn('logo_path is deprecated and will be removed in Spree 6.0. Please use Active Storage URL helpers instead.')

  return main_app.cdn_image_url(.variant(resize_to_limit: [244, 104])) if &.variable?

  return main_app.cdn_image_url() if &.image?
end

#name_for(order) ⇒ Object



11
12
13
# File 'app/helpers/spree/mail_helper.rb', line 11

def name_for(order)
  order.name || Spree.t('customer')
end

#store_logoObject



15
16
17
# File 'app/helpers/spree/mail_helper.rb', line 15

def 
   ||= current_store&. || current_store&.
end

#variant_image_url(variant) ⇒ Object



6
7
8
9
# File 'app/helpers/spree/mail_helper.rb', line 6

def variant_image_url(variant)
  image = variant.default_image
  image.present? && image.attached? ? spree_image_url(image, width: 100, height: 100, format: :png) : image_url('noimage/small.png')
end