dolores-cfml 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +5 -2
- data/VERSION +1 -1
- data/cfml.gemspec +95 -0
- data/lib/cfml.rb +1 -0
- data/lib/cfml/liquid_filters.rb +1 -10
- data/lib/cfml/tags/checkbox.rb +6 -6
- data/lib/cfml/tags/radio.rb +8 -3
- data/spec/complex_spec.rb +5 -5
- data/spec/tags/checkbox_spec.rb +12 -12
- data/spec/tags/checkboxes_spec.rb +2 -2
- data/spec/tags/group_spec.rb +2 -2
- data/spec/tags/radio_spec.rb +4 -3
- data/spec/tags/radios_spec.rb +2 -2
- metadata +36 -6
data/Rakefile
CHANGED
|
@@ -5,11 +5,14 @@ begin
|
|
|
5
5
|
require 'jeweler'
|
|
6
6
|
Jeweler::Tasks.new do |gem|
|
|
7
7
|
gem.name = "cfml"
|
|
8
|
-
gem.summary = "CFML is Crowd Flower
|
|
9
|
-
gem.description = "CFML let's you easily create form elements and custom interfaces for the CrowdFlower
|
|
8
|
+
gem.summary = "CFML is Crowd Flower Markup Language"
|
|
9
|
+
gem.description = "CFML let's you easily create form elements and custom interfaces for the CrowdFlower CroudSourcing platform"
|
|
10
10
|
gem.email = "vanpelt@doloreslabs.com"
|
|
11
11
|
gem.homepage = "http://github.com/dolores/cfml"
|
|
12
12
|
gem.authors = ["Chris Van Pelt"]
|
|
13
|
+
gem.add_dependency 'liquid', '>= 2.0.0'
|
|
14
|
+
gem.add_dependency 'nokogiri', '>= 1.3.3'
|
|
15
|
+
gem.add_dependency 'httparty', '>= 1.1.3'
|
|
13
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
|
14
17
|
end
|
|
15
18
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.1
|
data/cfml.gemspec
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |s|
|
|
4
|
+
s.name = %q{cfml}
|
|
5
|
+
s.version = "0.1.1"
|
|
6
|
+
|
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
|
+
s.authors = ["Chris Van Pelt"]
|
|
9
|
+
s.date = %q{2009-08-16}
|
|
10
|
+
s.description = %q{CFML let's you easily create form elements and custom interfaces for the CrowdFlower CroudSourcing platform}
|
|
11
|
+
s.email = %q{vanpelt@doloreslabs.com}
|
|
12
|
+
s.extra_rdoc_files = [
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"README.rdoc"
|
|
15
|
+
]
|
|
16
|
+
s.files = [
|
|
17
|
+
".document",
|
|
18
|
+
".gitignore",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"README.rdoc",
|
|
21
|
+
"Rakefile",
|
|
22
|
+
"VERSION",
|
|
23
|
+
"cfml.gemspec",
|
|
24
|
+
"lib/cfml.rb",
|
|
25
|
+
"lib/cfml/liquid_filters.rb",
|
|
26
|
+
"lib/cfml/parser.rb",
|
|
27
|
+
"lib/cfml/tag.rb",
|
|
28
|
+
"lib/cfml/tags/checkbox.rb",
|
|
29
|
+
"lib/cfml/tags/checkboxes.rb",
|
|
30
|
+
"lib/cfml/tags/group.rb",
|
|
31
|
+
"lib/cfml/tags/hidden.rb",
|
|
32
|
+
"lib/cfml/tags/radio.rb",
|
|
33
|
+
"lib/cfml/tags/radios.rb",
|
|
34
|
+
"lib/cfml/tags/ratings.rb",
|
|
35
|
+
"lib/cfml/tags/select.rb",
|
|
36
|
+
"lib/cfml/tags/text.rb",
|
|
37
|
+
"lib/cfml/tags/textarea.rb",
|
|
38
|
+
"lib/cfml/tags/unknown.rb",
|
|
39
|
+
"spec/complex_spec.rb",
|
|
40
|
+
"spec/fixtures/complex.cfml",
|
|
41
|
+
"spec/gold_spec.rb",
|
|
42
|
+
"spec/sorta_match.rb",
|
|
43
|
+
"spec/spec_helper.rb",
|
|
44
|
+
"spec/tags/checkbox_spec.rb",
|
|
45
|
+
"spec/tags/checkboxes_spec.rb",
|
|
46
|
+
"spec/tags/group_spec.rb",
|
|
47
|
+
"spec/tags/hidden_spec.rb",
|
|
48
|
+
"spec/tags/radio_spec.rb",
|
|
49
|
+
"spec/tags/radios_spec.rb",
|
|
50
|
+
"spec/tags/select_spec.rb",
|
|
51
|
+
"spec/tags/text_spec.rb",
|
|
52
|
+
"spec/tags/textarea_spec.rb",
|
|
53
|
+
"spec/tags/unknown_spec.rb"
|
|
54
|
+
]
|
|
55
|
+
s.homepage = %q{http://github.com/dolores/cfml}
|
|
56
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
|
57
|
+
s.require_paths = ["lib"]
|
|
58
|
+
s.rubygems_version = %q{1.3.4}
|
|
59
|
+
s.summary = %q{CFML is Crowd Flower Markup Language}
|
|
60
|
+
s.test_files = [
|
|
61
|
+
"spec/complex_spec.rb",
|
|
62
|
+
"spec/gold_spec.rb",
|
|
63
|
+
"spec/sorta_match.rb",
|
|
64
|
+
"spec/spec_helper.rb",
|
|
65
|
+
"spec/tags/checkbox_spec.rb",
|
|
66
|
+
"spec/tags/checkboxes_spec.rb",
|
|
67
|
+
"spec/tags/group_spec.rb",
|
|
68
|
+
"spec/tags/hidden_spec.rb",
|
|
69
|
+
"spec/tags/radio_spec.rb",
|
|
70
|
+
"spec/tags/radios_spec.rb",
|
|
71
|
+
"spec/tags/select_spec.rb",
|
|
72
|
+
"spec/tags/text_spec.rb",
|
|
73
|
+
"spec/tags/textarea_spec.rb",
|
|
74
|
+
"spec/tags/unknown_spec.rb"
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
if s.respond_to? :specification_version then
|
|
78
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
79
|
+
s.specification_version = 3
|
|
80
|
+
|
|
81
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
82
|
+
s.add_runtime_dependency(%q<liquid>, [">= 2.0.0"])
|
|
83
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 1.3.3"])
|
|
84
|
+
s.add_runtime_dependency(%q<httparty>, [">= 1.1.3"])
|
|
85
|
+
else
|
|
86
|
+
s.add_dependency(%q<liquid>, [">= 2.0.0"])
|
|
87
|
+
s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
|
|
88
|
+
s.add_dependency(%q<httparty>, [">= 1.1.3"])
|
|
89
|
+
end
|
|
90
|
+
else
|
|
91
|
+
s.add_dependency(%q<liquid>, [">= 2.0.0"])
|
|
92
|
+
s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
|
|
93
|
+
s.add_dependency(%q<httparty>, [">= 1.1.3"])
|
|
94
|
+
end
|
|
95
|
+
end
|
data/lib/cfml.rb
CHANGED
data/lib/cfml/liquid_filters.rb
CHANGED
data/lib/cfml/tags/checkbox.rb
CHANGED
|
@@ -3,13 +3,9 @@ module CFML
|
|
|
3
3
|
class Checkbox < Tag
|
|
4
4
|
Template = <<-HTML.freeze
|
|
5
5
|
{{default}}
|
|
6
|
-
<input name="{{name}}" type="checkbox" value="{{value}}" class="{{classes}}"/>
|
|
6
|
+
<label><input name="{{name}}" type="checkbox" value="{{value}}" class="{{classes}}"/> {{label}}</label>
|
|
7
7
|
HTML
|
|
8
8
|
|
|
9
|
-
def wrapper(parsed)
|
|
10
|
-
super("#{parsed} #{@attrs["label"]}", "label")
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
def prefix(name)
|
|
14
10
|
super(name) + (grouped? ? "[]" : "")
|
|
15
11
|
end
|
|
@@ -18,13 +14,17 @@ module CFML
|
|
|
18
14
|
@cfml.parent && @cfml.parent.name == "checkboxes"
|
|
19
15
|
end
|
|
20
16
|
|
|
17
|
+
def wrapper(parsed)
|
|
18
|
+
grouped? ? parsed : super
|
|
19
|
+
end
|
|
20
|
+
|
|
21
21
|
def data
|
|
22
22
|
default = ""
|
|
23
23
|
if @attrs["default"]
|
|
24
24
|
default = Parser.new("<cf:hidden name=\"#{name}\" value=\"#{@attrs["default"]}\"/>", @opts.merge(:no_wrap => true)).to_html
|
|
25
25
|
end
|
|
26
26
|
value = @attrs["value"] || (grouped? ? @attrs["label"] : "true")
|
|
27
|
-
super.merge({"value" => value.to_s, "default" => default})
|
|
27
|
+
super.merge({"value" => value.to_s, "default" => default, "label" => @attrs["label"].to_s})
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
end
|
data/lib/cfml/tags/radio.rb
CHANGED
|
@@ -2,16 +2,21 @@ module CFML
|
|
|
2
2
|
module Tags
|
|
3
3
|
class Radio < Tag
|
|
4
4
|
Template = <<-HTML.freeze
|
|
5
|
-
<input name="{{name}}" type="radio" value="{{value}}" class="{{classes}}"/>
|
|
5
|
+
<label><input name="{{name}}" type="radio" value="{{value}}" class="{{classes}}"/> {{label}}</label>
|
|
6
6
|
HTML
|
|
7
7
|
|
|
8
|
+
#Radios should always be grouped, but for consistency with checkboxes, we check
|
|
9
|
+
def grouped?
|
|
10
|
+
@cfml.parent && @cfml.parent.name == "radios"
|
|
11
|
+
end
|
|
12
|
+
|
|
8
13
|
def wrapper(parsed)
|
|
9
|
-
|
|
14
|
+
grouped? ? parsed : super
|
|
10
15
|
end
|
|
11
16
|
|
|
12
17
|
def data
|
|
13
18
|
value = @attrs["value"] || @attrs["label"]
|
|
14
|
-
super.merge({"value" => value.to_s})
|
|
19
|
+
super.merge({"value" => value.to_s, "label" => @attrs["label"].to_s})
|
|
15
20
|
end
|
|
16
21
|
end
|
|
17
22
|
end
|
data/spec/complex_spec.rb
CHANGED
|
@@ -27,20 +27,20 @@ describe "CFML Complex" do
|
|
|
27
27
|
<input name="u12345[email]" class="email validates-required validates-email" type="text" value="">
|
|
28
28
|
</div>
|
|
29
29
|
<div class="rad">
|
|
30
|
-
<
|
|
31
|
-
<input name="u12345[you_sure]" class="you_sure" type="checkbox" value="yes"> You sure
|
|
32
|
-
</
|
|
30
|
+
<div class="checkbox">
|
|
31
|
+
<label><input name="u12345[you_sure]" class="you_sure" type="checkbox" value="yes"> You sure?</label>
|
|
32
|
+
</div>
|
|
33
33
|
</div>
|
|
34
34
|
<div class="group only-if:awesome">
|
|
35
35
|
|
|
36
36
|
<fieldset class="checkboxes">
|
|
37
37
|
<legend>Cool checkboxes</legend>
|
|
38
38
|
|
|
39
|
-
<label
|
|
39
|
+
<label>
|
|
40
40
|
<input name="u12345[rad][]" class="rad" type="checkbox" value="Wanna do it?">
|
|
41
41
|
Wanna do it?</label>
|
|
42
42
|
|
|
43
|
-
<label
|
|
43
|
+
<label>
|
|
44
44
|
<input name="u12345[rad][]" class="rad" type="checkbox" value="Sure?">
|
|
45
45
|
Sure?</label>
|
|
46
46
|
|
data/spec/tags/checkbox_spec.rb
CHANGED
|
@@ -8,9 +8,9 @@ describe "CFML Radio" do
|
|
|
8
8
|
@p = Parser.new(cfml, :prefix => "u12345")
|
|
9
9
|
@p.to_html.should sorta_match(<<-HTML)
|
|
10
10
|
<div class="cfml u12345">
|
|
11
|
-
<
|
|
12
|
-
<input type="checkbox" value="true" name="u12345[check]" class="check"/> Check
|
|
13
|
-
</
|
|
11
|
+
<div class="checkbox">
|
|
12
|
+
<label><input type="checkbox" value="true" name="u12345[check]" class="check"/> Check</label>
|
|
13
|
+
</div>
|
|
14
14
|
</div>
|
|
15
15
|
HTML
|
|
16
16
|
end
|
|
@@ -22,9 +22,9 @@ describe "CFML Radio" do
|
|
|
22
22
|
@p = Parser.new(cfml, :prefix => "u12345")
|
|
23
23
|
@p.to_html.should sorta_match(<<-HTML)
|
|
24
24
|
<div class="cfml u12345">
|
|
25
|
-
<
|
|
26
|
-
<input type="checkbox" value="yes" name="u12345[check]" class="check"/> Check
|
|
27
|
-
</
|
|
25
|
+
<div class="checkbox">
|
|
26
|
+
<label><input type="checkbox" value="yes" name="u12345[check]" class="check"/> Check</label>
|
|
27
|
+
</div>
|
|
28
28
|
</div>
|
|
29
29
|
HTML
|
|
30
30
|
end
|
|
@@ -36,10 +36,10 @@ describe "CFML Radio" do
|
|
|
36
36
|
@p = Parser.new(cfml, :prefix => "u12345")
|
|
37
37
|
@p.to_html.should sorta_match(<<-HTML)
|
|
38
38
|
<div class="cfml u12345">
|
|
39
|
-
<
|
|
39
|
+
<div class="checkbox">
|
|
40
40
|
<input type="hidden" value="false" name="u12345[check]" class="check"/>
|
|
41
|
-
<input type="checkbox" value="true" name="u12345[check]" class="check"/> Check
|
|
42
|
-
</
|
|
41
|
+
<label><input type="checkbox" value="true" name="u12345[check]" class="check"/> Check</label>
|
|
42
|
+
</div>
|
|
43
43
|
</div>
|
|
44
44
|
HTML
|
|
45
45
|
end
|
|
@@ -71,9 +71,9 @@ describe "CFML Radio" do
|
|
|
71
71
|
@p.to_html.should sorta_match(<<-HTML)
|
|
72
72
|
<div class="cfml u12345">
|
|
73
73
|
<div class="rando">
|
|
74
|
-
<
|
|
75
|
-
<input type="checkbox" value="true" name="u12345[rad]" class="rad"/> Rad
|
|
76
|
-
</
|
|
74
|
+
<div class="checkbox">
|
|
75
|
+
<label><input type="checkbox" value="true" name="u12345[rad]" class="rad"/> Rad</label>
|
|
76
|
+
</div>
|
|
77
77
|
</div>
|
|
78
78
|
</div>
|
|
79
79
|
HTML
|
|
@@ -13,10 +13,10 @@ describe "CFML Checkboxes" do
|
|
|
13
13
|
<div class="cfml u12345">
|
|
14
14
|
<fieldset class="checkboxes">
|
|
15
15
|
<legend>Cool checkboxes</legend>
|
|
16
|
-
<label
|
|
16
|
+
<label>
|
|
17
17
|
<input type="checkbox" value="Wanna do it?" name="u12345[cool_checkboxes][]" class="cool_checkboxes"/> Wanna do it?
|
|
18
18
|
</label>
|
|
19
|
-
<label
|
|
19
|
+
<label>
|
|
20
20
|
<input type="checkbox" value="Sure?" name="u12345[cool_checkboxes][]" class="cool_checkboxes"/> Sure?
|
|
21
21
|
</label>
|
|
22
22
|
</fieldset>
|
data/spec/tags/group_spec.rb
CHANGED
|
@@ -17,10 +17,10 @@ describe "CFML Select" do
|
|
|
17
17
|
<div class="group only-if:awesome">
|
|
18
18
|
<fieldset class="checkboxes">
|
|
19
19
|
<legend>Cool checkboxes</legend>
|
|
20
|
-
<label
|
|
20
|
+
<label>
|
|
21
21
|
<input name="u12345[rad][]" class="rad" type="checkbox" value="Wanna do it?" /> Wanna do it?
|
|
22
22
|
</label>
|
|
23
|
-
<label
|
|
23
|
+
<label>
|
|
24
24
|
<input name="u12345[rad][]" class="rad" type="checkbox" value="Sure?" /> Sure?
|
|
25
25
|
</label>
|
|
26
26
|
</fieldset>
|
data/spec/tags/radio_spec.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
2
2
|
|
|
3
3
|
describe "CFML Radio" do
|
|
4
|
+
#Doesn't make sense on its own but tested here anyway...
|
|
4
5
|
it "should render basic radio" do
|
|
5
6
|
cfml = <<-HTML
|
|
6
7
|
<cf:radio label="Rad"/>
|
|
@@ -8,9 +9,9 @@ describe "CFML Radio" do
|
|
|
8
9
|
@p = Parser.new(cfml, :prefix => "u12345")
|
|
9
10
|
@p.to_html.should sorta_match(<<-HTML)
|
|
10
11
|
<div class="cfml u12345">
|
|
11
|
-
<
|
|
12
|
-
<input type="radio" value="Rad" name="u12345[rad]" class="rad"/> Rad
|
|
13
|
-
</
|
|
12
|
+
<div class="radio">
|
|
13
|
+
<label><input type="radio" value="Rad" name="u12345[rad]" class="rad"/> Rad</label>
|
|
14
|
+
</div>
|
|
14
15
|
</div>
|
|
15
16
|
HTML
|
|
16
17
|
end
|
data/spec/tags/radios_spec.rb
CHANGED
|
@@ -13,10 +13,10 @@ describe "CFML Radios" do
|
|
|
13
13
|
<div class="cfml u12345">
|
|
14
14
|
<fieldset class="radios">
|
|
15
15
|
<legend>Cool radios</legend>
|
|
16
|
-
<label
|
|
16
|
+
<label>
|
|
17
17
|
<input type="radio" value="Wanna do it?" name="u12345[cool_radios]" class="cool_radios"/> Wanna do it?
|
|
18
18
|
</label>
|
|
19
|
-
<label
|
|
19
|
+
<label>
|
|
20
20
|
<input type="radio" value="Sure!" name="u12345[cool_radios]" class="cool_radios"/> Sure!
|
|
21
21
|
</label>
|
|
22
22
|
</fieldset>
|
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.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Van Pelt
|
|
@@ -9,11 +9,40 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-08-
|
|
12
|
+
date: 2009-08-16 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
|
-
dependencies:
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
dependencies:
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
16
|
+
name: liquid
|
|
17
|
+
type: :runtime
|
|
18
|
+
version_requirement:
|
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
20
|
+
requirements:
|
|
21
|
+
- - ">="
|
|
22
|
+
- !ruby/object:Gem::Version
|
|
23
|
+
version: 2.0.0
|
|
24
|
+
version:
|
|
25
|
+
- !ruby/object:Gem::Dependency
|
|
26
|
+
name: nokogiri
|
|
27
|
+
type: :runtime
|
|
28
|
+
version_requirement:
|
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 1.3.3
|
|
34
|
+
version:
|
|
35
|
+
- !ruby/object:Gem::Dependency
|
|
36
|
+
name: httparty
|
|
37
|
+
type: :runtime
|
|
38
|
+
version_requirement:
|
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: 1.1.3
|
|
44
|
+
version:
|
|
45
|
+
description: CFML let's you easily create form elements and custom interfaces for the CrowdFlower CroudSourcing platform
|
|
17
46
|
email: vanpelt@doloreslabs.com
|
|
18
47
|
executables: []
|
|
19
48
|
|
|
@@ -29,6 +58,7 @@ files:
|
|
|
29
58
|
- README.rdoc
|
|
30
59
|
- Rakefile
|
|
31
60
|
- VERSION
|
|
61
|
+
- cfml.gemspec
|
|
32
62
|
- lib/cfml.rb
|
|
33
63
|
- lib/cfml/liquid_filters.rb
|
|
34
64
|
- lib/cfml/parser.rb
|
|
@@ -85,7 +115,7 @@ rubyforge_project:
|
|
|
85
115
|
rubygems_version: 1.3.5
|
|
86
116
|
signing_key:
|
|
87
117
|
specification_version: 3
|
|
88
|
-
summary: CFML is Crowd Flower
|
|
118
|
+
summary: CFML is Crowd Flower Markup Language
|
|
89
119
|
test_files:
|
|
90
120
|
- spec/complex_spec.rb
|
|
91
121
|
- spec/gold_spec.rb
|