sinatra_more 0.3.28 → 0.3.29
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -0
- data/VERSION +1 -1
- data/lib/sinatra_more/markup_plugin/form_builder/abstract_form_builder.rb +1 -1
- data/lib/sinatra_more/markup_plugin/form_helpers.rb +2 -2
- data/sinatra_more.gemspec +1 -1
- data/test/fixtures/markup_app/app.rb +4 -0
- data/test/markup_plugin/test_form_builder.rb +12 -1
- data/test/markup_plugin/test_form_helpers.rb +6 -0
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -731,6 +731,7 @@ See the wiki article for additional information: <http://wiki.github.com/nesquen
|
|
731
731
|
* Nathan Esquenazi - Project creator and code maintainer
|
732
732
|
* Arthur Chiu - Forming the idea and various code contributions
|
733
733
|
* Rob Holland - Added couchrest ORM component to generator
|
734
|
+
* Bill Turner - Added several form builder and helper fixes
|
734
735
|
|
735
736
|
== Known Issues
|
736
737
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.29
|
@@ -92,7 +92,7 @@ class AbstractFormBuilder
|
|
92
92
|
# Returns the object's models name
|
93
93
|
# => user_assignment
|
94
94
|
def object_name
|
95
|
-
object.is_a?(Symbol) ? object : object.class.to_s.underscore
|
95
|
+
object.is_a?(Symbol) ? object : object.class.to_s.underscore.gsub('/', '-')
|
96
96
|
end
|
97
97
|
|
98
98
|
# Returns true if the value matches the value in the field
|
@@ -82,8 +82,8 @@ module SinatraMore
|
|
82
82
|
# Constructs a text area input from the given options
|
83
83
|
# text_area_tag :username, :class => 'long', :value => "Demo?"
|
84
84
|
def text_area_tag(name, options={})
|
85
|
-
options.reverse_merge!(:name => name
|
86
|
-
content_tag(:textarea, options.delete(:value), options)
|
85
|
+
options.reverse_merge!(:name => name)
|
86
|
+
content_tag(:textarea, options.delete(:value).to_s, options)
|
87
87
|
end
|
88
88
|
|
89
89
|
# Constructs a password field input from the given options
|
data/sinatra_more.gemspec
CHANGED
@@ -33,6 +33,12 @@ class TestFormBuilder < Test::Unit::TestCase
|
|
33
33
|
assert_has_tag('form input', :type => 'text', :name => 'markup_user[username]') { actual_html }
|
34
34
|
assert_has_tag('form input[type=hidden]', :name => '_method', :count => 0) { actual_html } # no method action field
|
35
35
|
end
|
36
|
+
|
37
|
+
should "display correct form html for namespaced object" do
|
38
|
+
actual_html = form_for(Outer::UserAccount.new, '/register', :method => 'post') { |f| f.text_field :username }
|
39
|
+
assert_has_tag('form', :action => '/register', :method => 'post') { actual_html }
|
40
|
+
assert_has_tag('form input', :type => 'text', :name => 'outer-user_account[username]') { actual_html }
|
41
|
+
end
|
36
42
|
|
37
43
|
should "display correct form html with method :put" do
|
38
44
|
actual_html = form_for(@user, '/update', :method => 'put') { "Demo" }
|
@@ -301,10 +307,15 @@ class TestFormBuilder < Test::Unit::TestCase
|
|
301
307
|
assert_has_tag('textarea.large', :id => 'user_about', :name => 'user[about]') { actual_html }
|
302
308
|
end
|
303
309
|
|
304
|
-
should "display correct text_area html and content" do
|
310
|
+
should "display correct text_area html and custom content" do
|
305
311
|
actual_html = standard_builder.text_area(:about, :value => "Demo")
|
306
312
|
assert_has_tag('textarea', :id => 'user_about', :content => 'Demo') { actual_html }
|
307
313
|
end
|
314
|
+
|
315
|
+
should "display correct text_area html and default content" do
|
316
|
+
actual_html = standard_builder(MarkupUser.new).text_area(:about)
|
317
|
+
assert_has_tag('textarea', :id => 'markup_user_about', :content => '') { actual_html }
|
318
|
+
end
|
308
319
|
|
309
320
|
should "display correct text_area in haml" do
|
310
321
|
visit '/haml/form_for'
|
@@ -194,6 +194,12 @@ class TestFormHelpers < Test::Unit::TestCase
|
|
194
194
|
actual_html = text_area_tag(:about, :value => "a test")
|
195
195
|
assert_has_tag(:textarea, :content => "a test", :name => 'about') { actual_html }
|
196
196
|
end
|
197
|
+
|
198
|
+
should "display text area in ruby with no content with closing tag" do
|
199
|
+
actual_html = text_area_tag(:about)
|
200
|
+
assert_has_tag(:textarea, :content => "", :name => 'about') { actual_html }
|
201
|
+
assert_equal '<textarea name="about"></textarea>', actual_html
|
202
|
+
end
|
197
203
|
|
198
204
|
should "display text area in erb" do
|
199
205
|
visit '/erb/form_tag'
|