padrino-helpers 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/padrino-helpers/form_helpers.rb +3 -3
- data/lib/padrino-helpers/tag_helpers.rb +1 -1
- data/padrino-helpers.gemspec +6 -6
- data/test/test_form_builder.rb +6 -0
- metadata +61 -30
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.4
|
@@ -250,13 +250,14 @@ module Padrino
|
|
250
250
|
# options = [['caption', 'value'], ['Green', 'green1'], ['Blue', 'blue1'], ['Black', "black1"]]
|
251
251
|
# options = ['option', 'red', 'yellow' ]
|
252
252
|
# select_tag(:favorite_color, :options => ['red', 'yellow'], :selected => 'green1')
|
253
|
-
# select_tag(:country, :collection => @countries, :fields => [:name, :code])
|
253
|
+
# select_tag(:country, :collection => @countries, :fields => [:name, :code], :include_blank => 'None')
|
254
254
|
#
|
255
255
|
def select_tag(name, options={})
|
256
256
|
options.reverse_merge!(:name => name)
|
257
257
|
collection, fields = options.delete(:collection), options.delete(:fields)
|
258
258
|
options[:options] = options_from_collection(collection, fields) if collection
|
259
|
-
|
259
|
+
blank = options.delete(:include_blank)
|
260
|
+
options[:options].unshift(blank.is_a?(String) ? [blank, ''] : '') if blank
|
260
261
|
select_options_html = options_for_select(options.delete(:options), options.delete(:selected))
|
261
262
|
options.merge!(:name => "#{options[:name]}[]") if options[:multiple]
|
262
263
|
content_tag(:select, select_options_html, options)
|
@@ -338,7 +339,6 @@ module Padrino
|
|
338
339
|
# fields is an array containing the fields to display from each item in the collection
|
339
340
|
#
|
340
341
|
def options_from_collection(collection, fields)
|
341
|
-
return '' if collection.blank?
|
342
342
|
collection.collect { |item| [ item.send(fields.first), item.send(fields.last) ] }
|
343
343
|
end
|
344
344
|
|
@@ -42,7 +42,7 @@ module Padrino
|
|
42
42
|
content, open_tag = options.delete(:content), options.delete(:open)
|
43
43
|
content = content.join("\n") if content.respond_to?(:join)
|
44
44
|
identity_tag_attributes.each { |attr| options[attr] = attr.to_s if options[attr] }
|
45
|
-
html_attrs = options.collect { |a, v| v.
|
45
|
+
html_attrs = options.collect { |a, v| v.nil? ? nil : "#{a}=\"#{v}\"" }.compact.join(" ")
|
46
46
|
base_tag = (html_attrs.present? ? "<#{name} #{html_attrs}" : "<#{name}")
|
47
47
|
base_tag << (open_tag ? ">" : (content ? ">#{content}</#{name}>" : " />"))
|
48
48
|
end
|
data/padrino-helpers.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{padrino-helpers}
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-03}
|
13
13
|
s.description = %q{Tag helpers, asset helpers, form helpers, form builders and many more helpers for padrino}
|
14
14
|
s.email = %q{padrinorb@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -76,7 +76,7 @@ Gem::Specification.new do |s|
|
|
76
76
|
s.rdoc_options = ["--charset=UTF-8"]
|
77
77
|
s.require_paths = ["lib"]
|
78
78
|
s.rubyforge_project = %q{padrino-helpers}
|
79
|
-
s.rubygems_version = %q{1.3.
|
79
|
+
s.rubygems_version = %q{1.3.6}
|
80
80
|
s.summary = %q{Helpers for padrino}
|
81
81
|
|
82
82
|
if s.respond_to? :specification_version then
|
@@ -84,14 +84,14 @@ Gem::Specification.new do |s|
|
|
84
84
|
s.specification_version = 3
|
85
85
|
|
86
86
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
87
|
-
s.add_runtime_dependency(%q<padrino-core>, ["= 0.9.
|
87
|
+
s.add_runtime_dependency(%q<padrino-core>, ["= 0.9.4"])
|
88
88
|
s.add_development_dependency(%q<haml>, [">= 2.2.1"])
|
89
89
|
s.add_development_dependency(%q<shoulda>, [">= 2.10.3"])
|
90
90
|
s.add_development_dependency(%q<mocha>, [">= 0.9.7"])
|
91
91
|
s.add_development_dependency(%q<rack-test>, [">= 0.5.0"])
|
92
92
|
s.add_development_dependency(%q<webrat>, [">= 0.5.1"])
|
93
93
|
else
|
94
|
-
s.add_dependency(%q<padrino-core>, ["= 0.9.
|
94
|
+
s.add_dependency(%q<padrino-core>, ["= 0.9.4"])
|
95
95
|
s.add_dependency(%q<haml>, [">= 2.2.1"])
|
96
96
|
s.add_dependency(%q<shoulda>, [">= 2.10.3"])
|
97
97
|
s.add_dependency(%q<mocha>, [">= 0.9.7"])
|
@@ -99,7 +99,7 @@ Gem::Specification.new do |s|
|
|
99
99
|
s.add_dependency(%q<webrat>, [">= 0.5.1"])
|
100
100
|
end
|
101
101
|
else
|
102
|
-
s.add_dependency(%q<padrino-core>, ["= 0.9.
|
102
|
+
s.add_dependency(%q<padrino-core>, ["= 0.9.4"])
|
103
103
|
s.add_dependency(%q<haml>, [">= 2.2.1"])
|
104
104
|
s.add_dependency(%q<shoulda>, [">= 2.10.3"])
|
105
105
|
s.add_dependency(%q<mocha>, [">= 0.9.7"])
|
data/test/test_form_builder.rb
CHANGED
@@ -390,6 +390,12 @@ class TestFormBuilder < Test::Unit::TestCase
|
|
390
390
|
assert_has_tag('select', :id => 'user_state', :name => 'user[state]') { actual_html }
|
391
391
|
assert_has_tag('select option', :count => 4) { actual_html }
|
392
392
|
assert_has_tag('select option:first-child', :content => '') { actual_html }
|
393
|
+
assert_has_tag('select option:first-child', :value => '') { actual_html }
|
394
|
+
actual_html = standard_builder.select(:state, :options => ['California', 'Texas', 'Wyoming'], :include_blank => 'Select')
|
395
|
+
assert_has_tag('select', :id => 'user_state', :name => 'user[state]') { actual_html }
|
396
|
+
assert_has_tag('select option', :count => 4) { actual_html }
|
397
|
+
assert_has_tag('select option:first-child', :content => 'Select') { actual_html }
|
398
|
+
assert_has_tag('select option:first-child', :value => '') { actual_html }
|
393
399
|
end
|
394
400
|
|
395
401
|
should "display correct select html with collection passed in" do
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 9
|
8
|
+
- 4
|
9
|
+
version: 0.9.4
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Padrino Team
|
@@ -12,69 +17,93 @@ autorequire:
|
|
12
17
|
bindir: bin
|
13
18
|
cert_chain: []
|
14
19
|
|
15
|
-
date: 2010-03-
|
20
|
+
date: 2010-03-03 00:00:00 +01:00
|
16
21
|
default_executable:
|
17
22
|
dependencies:
|
18
23
|
- !ruby/object:Gem::Dependency
|
19
24
|
name: padrino-core
|
20
|
-
|
21
|
-
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
prerelease: false
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
27
|
requirements:
|
24
28
|
- - "="
|
25
29
|
- !ruby/object:Gem::Version
|
26
|
-
|
27
|
-
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 9
|
33
|
+
- 4
|
34
|
+
version: 0.9.4
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
28
37
|
- !ruby/object:Gem::Dependency
|
29
38
|
name: haml
|
30
|
-
|
31
|
-
|
32
|
-
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
33
41
|
requirements:
|
34
42
|
- - ">="
|
35
43
|
- !ruby/object:Gem::Version
|
44
|
+
segments:
|
45
|
+
- 2
|
46
|
+
- 2
|
47
|
+
- 1
|
36
48
|
version: 2.2.1
|
37
|
-
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
38
51
|
- !ruby/object:Gem::Dependency
|
39
52
|
name: shoulda
|
40
|
-
|
41
|
-
|
42
|
-
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
43
55
|
requirements:
|
44
56
|
- - ">="
|
45
57
|
- !ruby/object:Gem::Version
|
58
|
+
segments:
|
59
|
+
- 2
|
60
|
+
- 10
|
61
|
+
- 3
|
46
62
|
version: 2.10.3
|
47
|
-
|
63
|
+
type: :development
|
64
|
+
version_requirements: *id003
|
48
65
|
- !ruby/object:Gem::Dependency
|
49
66
|
name: mocha
|
50
|
-
|
51
|
-
|
52
|
-
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
69
|
requirements:
|
54
70
|
- - ">="
|
55
71
|
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
- 9
|
75
|
+
- 7
|
56
76
|
version: 0.9.7
|
57
|
-
|
77
|
+
type: :development
|
78
|
+
version_requirements: *id004
|
58
79
|
- !ruby/object:Gem::Dependency
|
59
80
|
name: rack-test
|
60
|
-
|
61
|
-
|
62
|
-
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
prerelease: false
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
83
|
requirements:
|
64
84
|
- - ">="
|
65
85
|
- !ruby/object:Gem::Version
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
- 5
|
89
|
+
- 0
|
66
90
|
version: 0.5.0
|
67
|
-
|
91
|
+
type: :development
|
92
|
+
version_requirements: *id005
|
68
93
|
- !ruby/object:Gem::Dependency
|
69
94
|
name: webrat
|
70
|
-
|
71
|
-
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
prerelease: false
|
96
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
73
97
|
requirements:
|
74
98
|
- - ">="
|
75
99
|
- !ruby/object:Gem::Version
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
- 5
|
103
|
+
- 1
|
76
104
|
version: 0.5.1
|
77
|
-
|
105
|
+
type: :development
|
106
|
+
version_requirements: *id006
|
78
107
|
description: Tag helpers, asset helpers, form helpers, form builders and many more helpers for padrino
|
79
108
|
email: padrinorb@gmail.com
|
80
109
|
executables: []
|
@@ -152,18 +181,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
181
|
requirements:
|
153
182
|
- - ">="
|
154
183
|
- !ruby/object:Gem::Version
|
184
|
+
segments:
|
185
|
+
- 0
|
155
186
|
version: "0"
|
156
|
-
version:
|
157
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
188
|
requirements:
|
159
189
|
- - ">="
|
160
190
|
- !ruby/object:Gem::Version
|
191
|
+
segments:
|
192
|
+
- 0
|
161
193
|
version: "0"
|
162
|
-
version:
|
163
194
|
requirements: []
|
164
195
|
|
165
196
|
rubyforge_project: padrino-helpers
|
166
|
-
rubygems_version: 1.3.
|
197
|
+
rubygems_version: 1.3.6
|
167
198
|
signing_key:
|
168
199
|
specification_version: 3
|
169
200
|
summary: Helpers for padrino
|