Sha256: e9b5bb6e821b84ab61e88cbf8109612c981b8e92fc19f1102a8d7e054a4b0d91

Contents?: true

Size: 1.31 KB

Versions: 10

Compression:

Stored size: 1.31 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)
      }
      tag 'shop:cart:address' do |tag|
        Forms::Tags::Helpers.require!(tag,'shop:cart:address','type')
        
        tag.locals.address = Shop::Tags::Helpers.current_address(tag)
        tag.locals.address_type = tag.attr['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:address:if_address' do |tag|
        tag.expand if tag.locals.address.name.present? rescue nil
      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:address:unless_address' do |tag|
        tag.expand unless tag.locals.address.name.present? rescue nil
      end
      
      [:id, :name, :email, :unit, :street, :city, :state, :country, :postcode].each do |method|
        tag "shop:cart:address:#{method}" do |tag|
          tag.locals.address.send(method) rescue nil
        end
      end
      
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
radiant-shop-extension-0.90.4 lib/shop/tags/address.rb
radiant-shop-extension-0.90.2 lib/shop/tags/address.rb
radiant-shop-extension-0.90.1 lib/shop/tags/address.rb
radiant-shop-extension-0.90.0 lib/shop/tags/address.rb
radiant-shop-extension-0.11.6 lib/shop/tags/address.rb
radiant-shop-extension-0.11.5 lib/shop/tags/address.rb
radiant-shop-extension-0.11.4 lib/shop/tags/address.rb
radiant-shop-extension-0.11.3 lib/shop/tags/address.rb
radiant-shop-extension-0.11.1 lib/shop/tags/address.rb
radiant-shop-extension-0.11.0 lib/shop/tags/address.rb