module Shop
module Tags
module Card
CARD_TYPES = {
'visa' => 'Visa',
'master' => 'Master Card',
'diners' => 'Diners Club',
'amex' => 'American Express'
}
include Radiant::Taggable
tag 'form:card' do |tag|
tag.expand
end
# Outputs a list of credit card types
desc %{ Outputs a list of credit card types }
tag 'form:card:type' do |tag|
content = %{
\n}
cards = {}
cards.merge! CARD_TYPES
cards.reject! { |k,v| tag.attr['except'].split(',').include? k } if tag.attr['except'].present?
cards.reject! { |k,v| !tag.attr['only'].split(',').include? k }if tag.attr['only'].present?
cards.sort.reverse.each do |k, v|
content << %{\n}
content << %{\n}
end
content << %{
}
end
# Outputs a list of months for credit cards
desc %{ Outputs a list of months for credit cards }
tag 'form:card:month' do |tag|
content = %{}
end
# Ouputs a list of years for credit cards
desc %{ Ouputs a list of years for credit cards }
tag 'form:card:year' do |tag|
content = %{}
end
end
end
end