Sha256: 37c957c951c15d657a7a69125dcf42a98662b284a1ce2a890e67c0bab30fe545
Contents?: true
Size: 1.38 KB
Versions: 24
Compression:
Stored size: 1.38 KB
Contents
module Shop module Tags module Address include Radiant::Taggable # Expand if the address has been assigned to the order desc %{ Expand if an address has been assigned to the order @type@ = (billing)|(shipping) } [:billing,:shipping].each do |of_type| tag "shop:cart:#{of_type}" do |tag| tag.locals.send(of_type, Shop::Tags::Helpers.current_address(tag,of_type)) tag.expand end # Expand if an address has been assigned to the order desc %{ Expand if an address has been assigned to the order } tag "shop:cart:#{of_type}:if_#{of_type}" do |tag| tag.expand if tag.locals.send(of_type).present? end # Expand if an address has not been assigned to the order desc %{ Expand if an address has not been assigned to the order } tag "shop:cart:#{of_type}:unless_#{of_type}" do |tag| tag.expand unless tag.locals.send(of_type).present? end [:id, :name, :phone, :email, :unit, :street_1, :street_2, :city, :state, :country, :postcode].each do |method| tag "shop:cart:#{of_type}:#{method}" do |tag| tag.locals.send(of_type).send(method) rescue nil # Rescue is so we can have null inputs if no address exists end end end end end end
Version data entries
24 entries across 24 versions & 1 rubygems