dolores-cfml 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/cfml.gemspec +4 -2
- data/lib/cfml/tag.rb +2 -2
- data/lib/cfml/tags/checkboxes.rb +0 -4
- data/lib/cfml/tags/radios.rb +0 -4
- data/spec/complex_spec.rb +3 -3
- data/spec/tags/checkboxes_spec.rb +3 -3
- data/spec/tags/group_spec.rb +5 -5
- data/spec/tags/radios_spec.rb +30 -0
- data/spec/tags/text_spec.rb +1 -1
- metadata +4 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/cfml.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{cfml}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Chris Van Pelt"]
|
9
|
-
s.date = %q{2009-08-
|
9
|
+
s.date = %q{2009-08-21}
|
10
10
|
s.description = %q{CFML let's you easily create form elements and custom interfaces for the CrowdFlower CroudSourcing platform}
|
11
11
|
s.email = %q{vanpelt@doloreslabs.com}
|
12
12
|
s.extra_rdoc_files = [
|
@@ -49,6 +49,7 @@ Gem::Specification.new do |s|
|
|
49
49
|
"spec/tags/checkboxes_spec.rb",
|
50
50
|
"spec/tags/group_spec.rb",
|
51
51
|
"spec/tags/hidden_spec.rb",
|
52
|
+
"spec/tags/radios_spec.rb",
|
52
53
|
"spec/tags/select_spec.rb",
|
53
54
|
"spec/tags/text_spec.rb",
|
54
55
|
"spec/tags/textarea_spec.rb",
|
@@ -70,6 +71,7 @@ Gem::Specification.new do |s|
|
|
70
71
|
"spec/tags/checkboxes_spec.rb",
|
71
72
|
"spec/tags/group_spec.rb",
|
72
73
|
"spec/tags/hidden_spec.rb",
|
74
|
+
"spec/tags/radios_spec.rb",
|
73
75
|
"spec/tags/select_spec.rb",
|
74
76
|
"spec/tags/text_spec.rb",
|
75
77
|
"spec/tags/textarea_spec.rb",
|
data/lib/cfml/tag.rb
CHANGED
@@ -51,7 +51,7 @@ module CFML
|
|
51
51
|
def label(label, tag = "label")
|
52
52
|
label ||= @attrs["name"].to_s.capitalize
|
53
53
|
required = " <span class=\"required\">(required)</span>" if validations.include?("required")
|
54
|
-
"<#{tag}>#{label}#{required}</#{tag}>" if label.to_s != ""
|
54
|
+
"<#{tag}>#{label}#{required}</#{tag.split(" ")[0]}>" if label.to_s != ""
|
55
55
|
end
|
56
56
|
|
57
57
|
def legend(label)
|
@@ -93,7 +93,7 @@ module CFML
|
|
93
93
|
(@opts[:data] || {}).merge({
|
94
94
|
"name" => prefix(name),
|
95
95
|
"label" => label(@attrs["label"]),
|
96
|
-
"legend" =>
|
96
|
+
"legend" => label(@attrs["label"], "h2 class=\"legend\""),
|
97
97
|
"classes" => classes,
|
98
98
|
"value" => value
|
99
99
|
})
|
data/lib/cfml/tags/checkboxes.rb
CHANGED
data/lib/cfml/tags/radios.rb
CHANGED
data/spec/complex_spec.rb
CHANGED
@@ -33,8 +33,8 @@ describe "CFML Complex" do
|
|
33
33
|
</div>
|
34
34
|
<div class="group only-if:awesome">
|
35
35
|
|
36
|
-
<
|
37
|
-
<legend>Cool checkboxes</
|
36
|
+
<div class="checkboxes">
|
37
|
+
<h2 class="legend">Cool checkboxes</h2>
|
38
38
|
|
39
39
|
<label>
|
40
40
|
<input name="u12345[rad][]" class="rad" type="checkbox" value="Wanna do it?">
|
@@ -44,7 +44,7 @@ describe "CFML Complex" do
|
|
44
44
|
<input name="u12345[rad][]" class="rad" type="checkbox" value="Sure?">
|
45
45
|
Sure?</label>
|
46
46
|
<p class=\"instructions\">This <i>is</i> cool</p>
|
47
|
-
</
|
47
|
+
</div>
|
48
48
|
<input type="hidden" name="u12345[secret]" value="cool" class="secret" />
|
49
49
|
</div>
|
50
50
|
</div>
|
@@ -12,8 +12,8 @@ describe "CFML Checkboxes" do
|
|
12
12
|
@p = Parser.new(cfml, :prefix => "u12345")
|
13
13
|
@p.to_html.should sorta_match(<<-HTML)
|
14
14
|
<div class="cfml u12345">
|
15
|
-
<
|
16
|
-
<legend>Cool checkboxes</
|
15
|
+
<div class="checkboxes">
|
16
|
+
<h2 class="legend">Cool checkboxes</h2>
|
17
17
|
<label>
|
18
18
|
<input type="checkbox" value="Wanna do it?" name="u12345[cool_checkboxes][]" class="cool_checkboxes"/> Wanna do it?
|
19
19
|
</label>
|
@@ -23,7 +23,7 @@ describe "CFML Checkboxes" do
|
|
23
23
|
<label>
|
24
24
|
<input type="checkbox" value="nope" checked="checked" name="u12345[cool_checkboxes][]" class="cool_checkboxes"/> Sure?
|
25
25
|
</label>
|
26
|
-
</
|
26
|
+
</div>
|
27
27
|
</div>
|
28
28
|
HTML
|
29
29
|
end
|
data/spec/tags/group_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
3
3
|
describe "CFML Select" do
|
4
4
|
it "should render group" do
|
5
5
|
cfml = <<-HTML
|
6
|
-
<cf:group only-if="awesome">
|
6
|
+
<cf:group only-if="awesome[1]">
|
7
7
|
<cf:checkboxes label="Cool checkboxes" name="rad">
|
8
8
|
<cf:checkbox label="Wanna do it?"/>
|
9
9
|
<cf:checkbox label="Sure?"/>
|
@@ -14,16 +14,16 @@ describe "CFML Select" do
|
|
14
14
|
@p = Parser.new(cfml, :prefix => "u12345")
|
15
15
|
@p.to_html.should sorta_match(<<-HTML)
|
16
16
|
<div class="cfml u12345">
|
17
|
-
<div class="group only-if:awesome">
|
18
|
-
<
|
19
|
-
<legend>Cool checkboxes</
|
17
|
+
<div class="group only-if:awesome[1]">
|
18
|
+
<div class="checkboxes">
|
19
|
+
<h2 class="legend">Cool checkboxes</h2>
|
20
20
|
<label>
|
21
21
|
<input name="u12345[rad][]" class="rad" type="checkbox" value="Wanna do it?" /> Wanna do it?
|
22
22
|
</label>
|
23
23
|
<label>
|
24
24
|
<input name="u12345[rad][]" class="rad" type="checkbox" value="Sure?" /> Sure?
|
25
25
|
</label>
|
26
|
-
</
|
26
|
+
</div>
|
27
27
|
<div class="text">
|
28
28
|
<label>Something</label>
|
29
29
|
<input name="u12345[something]" class="something" type="text" value="" />
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe "CFML Radios" do
|
4
|
+
it "should render basic radios" do
|
5
|
+
cfml = <<-HTML
|
6
|
+
<cf:radios label="Cool radios">
|
7
|
+
<cf:radio label="Wanna do it?"/>
|
8
|
+
<cf:radio label="Sure?"/>
|
9
|
+
<cf:radio label="Not really..." value="nope" checked="true"/>
|
10
|
+
</cf:radios>
|
11
|
+
HTML
|
12
|
+
@p = Parser.new(cfml, :prefix => "u12345")
|
13
|
+
@p.to_html.should sorta_match(<<-HTML)
|
14
|
+
<div class="cfml u12345">
|
15
|
+
<div class="radios">
|
16
|
+
<h2 class="legend">Cool radios</h2>
|
17
|
+
<label>
|
18
|
+
<input type="radio" value="Wanna do it?" name="u12345[cool_radios]" class="cool_radios"/> Wanna do it?
|
19
|
+
</label>
|
20
|
+
<label>
|
21
|
+
<input type="radio" value="Sure?" name="u12345[cool_radios]" class="cool_radios"/> Sure?
|
22
|
+
</label>
|
23
|
+
<label>
|
24
|
+
<input type="radio" value="nope" checked="checked" name="u12345[cool_radios]" class="cool_radios"/> Sure?
|
25
|
+
</label>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
HTML
|
29
|
+
end
|
30
|
+
end
|
data/spec/tags/text_spec.rb
CHANGED
@@ -27,7 +27,7 @@ describe "CFML Text" do
|
|
27
27
|
<div class="cfml u12345">
|
28
28
|
<div class="text">
|
29
29
|
<label>Coolio</label>
|
30
|
-
<input type="text" class="coolio small" value="" name="u12345[coolio]"
|
30
|
+
<input type="text" class="coolio small" value="" name="u12345[coolio]" />
|
31
31
|
<p class="instructions">Just be <b>cool</b> bro!</p>
|
32
32
|
</div>
|
33
33
|
</div>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dolores-cfml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Van Pelt
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-21 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- spec/tags/checkboxes_spec.rb
|
88
88
|
- spec/tags/group_spec.rb
|
89
89
|
- spec/tags/hidden_spec.rb
|
90
|
+
- spec/tags/radios_spec.rb
|
90
91
|
- spec/tags/select_spec.rb
|
91
92
|
- spec/tags/text_spec.rb
|
92
93
|
- spec/tags/textarea_spec.rb
|
@@ -129,6 +130,7 @@ test_files:
|
|
129
130
|
- spec/tags/checkboxes_spec.rb
|
130
131
|
- spec/tags/group_spec.rb
|
131
132
|
- spec/tags/hidden_spec.rb
|
133
|
+
- spec/tags/radios_spec.rb
|
132
134
|
- spec/tags/select_spec.rb
|
133
135
|
- spec/tags/text_spec.rb
|
134
136
|
- spec/tags/textarea_spec.rb
|