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

Version Path
radiant-shop-extension-0.94.5 lib/shop/tags/address.rb
radiant-shop-extension-0.94.4 lib/shop/tags/address.rb
radiant-shop-extension-0.94.3 lib/shop/tags/address.rb
radiant-shop-extension-0.94.2 lib/shop/tags/address.rb
radiant-shop-extension-0.94.1 lib/shop/tags/address.rb
radiant-shop-extension-0.94.0 lib/shop/tags/address.rb
radiant-shop-extension-0.93.3 lib/shop/tags/address.rb
radiant-shop-extension-0.93.2 lib/shop/tags/address.rb
radiant-shop-extension-0.93.1 lib/shop/tags/address.rb
radiant-shop-extension-0.93.0 lib/shop/tags/address.rb
radiant-shop-extension-0.92.11 lib/shop/tags/address.rb
radiant-shop-extension-0.92.10 lib/shop/tags/address.rb
radiant-shop-extension-0.92.9 lib/shop/tags/address.rb
radiant-shop-extension-0.92.8 lib/shop/tags/address.rb
radiant-shop-extension-0.92.7 lib/shop/tags/address.rb
radiant-shop-extension-0.92.6 lib/shop/tags/address.rb
radiant-shop-extension-0.92.3 lib/shop/tags/address.rb
radiant-shop-extension-0.92.2 lib/shop/tags/address.rb
radiant-shop-extension-0.92.1 lib/shop/tags/address.rb
radiant-shop-extension-0.92.0 lib/shop/tags/address.rb