twilson63-sinatra-formhelpers 0.2.1 → 0.3.0

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.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
- :minor: 2
4
- :patch: 1
3
+ :minor: 3
4
+ :patch: 0
@@ -62,6 +62,10 @@ module Sinatra
62
62
  tag :select, content, options
63
63
  end
64
64
 
65
+ def hidden(obj, field="", options={})
66
+ content = @params[obj] && @params[obj][field.to_s] == value ? "true" : ""
67
+ single_tag :input, options.merge(:type => "hidden", :id => "#{obj}_#{field}", :name => "#{obj}[#{field}]")
68
+ end
65
69
 
66
70
  # standard open and close tags
67
71
  # EX : tag :h1, "shizam", :title => "shizam"
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{sinatra-formhelpers}
5
- s.version = "0.2.1"
5
+ s.version = "0.3.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["twilson63"]
9
- s.date = %q{2009-06-16}
9
+ s.date = %q{2009-06-18}
10
10
  s.email = %q{tom@jackrussellsoftware.com}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
@@ -221,6 +221,20 @@ class FormHelpersTest < Test::Unit::TestCase
221
221
  end
222
222
  end
223
223
 
224
-
224
+ describe 'formhelpers hidden' do
225
+ setup do
226
+ mock_app {
227
+ helpers Sinatra::FormHelpers
228
+ get '/' do
229
+ haml '= hidden :person, :id, { :value => 1 }'
230
+ end
231
+ }
232
+ end
233
+
234
+ it 'renders a hidden tag with value' do
235
+ get '/'
236
+ assert_equal "<input name='person[id]' id='person_id' value='1' type='hidden' />\n", body
237
+ end
238
+ end
225
239
  end
226
240
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twilson63-sinatra-formhelpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - twilson63
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-16 00:00:00 -07:00
12
+ date: 2009-06-18 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency