radiant-shop-extension 0.94.1 → 0.94.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/shop/tags/card.rb +6 -4
- data/radiant-shop-extension.gemspec +1 -1
- data/spec/lib/shop/tags/card_spec.rb +22 -14
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.94.
|
1
|
+
0.94.2
|
data/lib/shop/tags/card.rb
CHANGED
@@ -18,17 +18,19 @@ module Shop
|
|
18
18
|
# Outputs a list of credit card types
|
19
19
|
desc %{ Outputs a list of credit card types }
|
20
20
|
tag 'form:card:type' do |tag|
|
21
|
-
content = %{<
|
21
|
+
content = %{<div id="credit_card_type">\n}
|
22
22
|
cards = {}
|
23
23
|
cards.merge! CARD_TYPES
|
24
24
|
|
25
25
|
cards.reject! { |k,v| tag.attr['except'].split(',').include? k } if tag.attr['except'].present?
|
26
26
|
cards.reject! { |k,v| !tag.attr['only'].split(',').include? k }if tag.attr['only'].present?
|
27
27
|
|
28
|
-
cards.sort.each do |k, v|
|
29
|
-
content << %{<
|
28
|
+
cards.sort.reverse.each do |k, v|
|
29
|
+
content << %{<input name="credit_card[type]" id="credit_card_#{k}" type="radio" value="#{k}"/>\n}
|
30
|
+
content << %{<label for="credit_card_#{k}" class="#{k} credit_card" id="credit_card_#{k}_label">#{v}</label>\n}
|
30
31
|
end
|
31
|
-
|
32
|
+
|
33
|
+
content << %{</div>}
|
32
34
|
end
|
33
35
|
|
34
36
|
# Outputs a list of months for credit cards
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{radiant-shop-extension}
|
8
|
-
s.version = "0.94.
|
8
|
+
s.version = "0.94.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dirk Kelly", "John Barker", "Darcy Laycock"]
|
@@ -23,12 +23,16 @@ describe Shop::Tags::Card do
|
|
23
23
|
context 'all cards' do
|
24
24
|
it 'should output the card types' do
|
25
25
|
tag = %{<r:form:card:type />}
|
26
|
-
exp = %{<
|
27
|
-
<
|
28
|
-
<
|
29
|
-
<
|
30
|
-
<
|
31
|
-
|
26
|
+
exp = %{<div id="credit_card_type">
|
27
|
+
<input name="credit_card[type]" id="credit_card_visa" type="radio" value="visa"/>
|
28
|
+
<label for="credit_card_visa" class="visa credit_card" id="credit_card_visa_label">Visa</label>
|
29
|
+
<input name="credit_card[type]" id="credit_card_master" type="radio" value="master"/>
|
30
|
+
<label for="credit_card_master" class="master credit_card" id="credit_card_master_label">Master Card</label>
|
31
|
+
<input name="credit_card[type]" id="credit_card_diners" type="radio" value="diners"/>
|
32
|
+
<label for="credit_card_diners" class="diners credit_card" id="credit_card_diners_label">Diners Club</label>
|
33
|
+
<input name="credit_card[type]" id="credit_card_amex" type="radio" value="amex"/>
|
34
|
+
<label for="credit_card_amex" class="amex credit_card" id="credit_card_amex_label">American Express</label>
|
35
|
+
</div>}
|
32
36
|
|
33
37
|
@page.should render(tag).as(exp)
|
34
38
|
end
|
@@ -37,10 +41,12 @@ describe Shop::Tags::Card do
|
|
37
41
|
context 'except amex and diners' do
|
38
42
|
it 'should output all except amex and diners' do
|
39
43
|
tag = %{<r:form:card:type except="amex,diners" />}
|
40
|
-
exp = %{<
|
41
|
-
<
|
42
|
-
<
|
43
|
-
|
44
|
+
exp = %{<div id="credit_card_type">
|
45
|
+
<input name="credit_card[type]" id="credit_card_visa" type="radio" value="visa"/>
|
46
|
+
<label for="credit_card_visa" class="visa credit_card" id="credit_card_visa_label">Visa</label>
|
47
|
+
<input name="credit_card[type]" id="credit_card_master" type="radio" value="master"/>
|
48
|
+
<label for="credit_card_master" class="master credit_card" id="credit_card_master_label">Master Card</label>
|
49
|
+
</div>}
|
44
50
|
|
45
51
|
@page.should render(tag).as(exp)
|
46
52
|
end
|
@@ -49,10 +55,12 @@ describe Shop::Tags::Card do
|
|
49
55
|
context 'only amex and diners' do
|
50
56
|
it 'should output all except amex' do
|
51
57
|
tag = %{<r:form:card:type only="amex,diners" />}
|
52
|
-
exp = %{<
|
53
|
-
<
|
54
|
-
<
|
55
|
-
|
58
|
+
exp = %{<div id="credit_card_type">
|
59
|
+
<input name="credit_card[type]" id="credit_card_diners" type="radio" value="diners"/>
|
60
|
+
<label for="credit_card_diners" class="diners credit_card" id="credit_card_diners_label">Diners Club</label>
|
61
|
+
<input name="credit_card[type]" id="credit_card_amex" type="radio" value="amex"/>
|
62
|
+
<label for="credit_card_amex" class="amex credit_card" id="credit_card_amex_label">American Express</label>
|
63
|
+
</div>}
|
56
64
|
|
57
65
|
@page.should render(tag).as(exp)
|
58
66
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-shop-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 355
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 94
|
9
|
-
-
|
10
|
-
version: 0.94.
|
9
|
+
- 2
|
10
|
+
version: 0.94.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dirk Kelly
|