Sha256: 6361b3062361cdb45264396ae1d1988cadde9880f7ac6d51d05a9a46d8a6cfad

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

module ShopPackages
  module Tags
    class Helpers
      class << self
        include ActionView::Helpers::NumberHelper
          
        def current_packages(tag)
          result = nil
          
          if tag.locals.shop_product.present?
            result = tag.locals.shop_product.packages
          
          elsif tag.attr['key'] and tag.attr['value']
            result = ShopPackage.all(:conditions => { tag.attr['key'].downcase.to_sym => tag.attr['value']})
          
          else
            result = ShopPackage.all
          
          end
          
          result
        end
        
        def current_package(tag)
          result = nil
          
          if tag.locals.shop_package.present?
            result = tag.locals.shop_package
          
          elsif tag.attr['key'] and tag.attr['value']
            result = ShopPackage.first(:conditions => { tag.attr['key'].downcase.to_sym => tag.attr['value']})
            
          end
          
          result
        end
        
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
radiant-shop_packages-extension-0.0.6 lib/shop_packages/tags/helpers.rb
radiant-shop_packages-extension-0.0.5 lib/shop_packages/tags/helpers.rb
radiant-shop_packages-extension-0.0.4 lib/shop_packages/tags/helpers.rb
radiant-shop_packages-extension-0.0.3 lib/shop_packages/tags/helpers.rb
radiant-shop_packages-extension-0.0.2 lib/shop_packages/tags/helpers.rb
radiant-shop_packages-extension-0.0.1 lib/shop_packages/tags/helpers.rb