forme 0.9.0 → 0.9.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 037794e39f62d0052a5dd6a6832c41326d31b851
4
- data.tar.gz: 1f3aa7418616002d1e2443ccea5313a874925851
3
+ metadata.gz: b45369402c9a718a22afc64018b0063082647065
4
+ data.tar.gz: 1a91e0227fd23138ef2f71842c81648d73fd6400
5
5
  SHA512:
6
- metadata.gz: 55d5ebeb5602c3eaed73448d2973bfc12b97a3ffb5d39c4caee227c83cbca0142252c96d8c99c90a178071a9ca3302b99f62316180d2a2f36d2358ac8afeb7d9
7
- data.tar.gz: 9bb5afa6c4192585b71bad482d7de6c138efc11b4e00310c9376f147884c1e6f2e399475504329502ca0281374f89ee20b3874e54649cb6dd3953dc197fdad94
6
+ metadata.gz: 02650bc7eee1eed4d3b562a52204b936dabf70d1f726ad1660a2ead235ad74708503b035b4301c983bc946516485bb207bb769becd09290b95016004e11d4ffe
7
+ data.tar.gz: 03d3c5db265495a2795bddfe9e656ac1e6b84b83e211951cffaf28607a6ca3970812bc7f107beb4a1e44f219657508c83878fe5b340874ea2a93f56dab94655f
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.9.1 (2013-12-18)
2
+
3
+ * Use a tri-valued select box by default for boolean inputs with :required=>false option (jeremyevans)
4
+
1
5
  === 0.9.0 (2013-12-13)
2
6
 
3
7
  * Support :input_defaults Form option for setting defaults for inputs by type (jeremyevans)
data/README.rdoc CHANGED
@@ -7,6 +7,10 @@ Forme is a HTML forms library for ruby with the following goals:
7
7
  3. Support forms both with and without related objects
8
8
  4. Allow compiling down to different types of output
9
9
 
10
+ = Installation
11
+
12
+ sudo gem install forme
13
+
10
14
  = Demo Site
11
15
 
12
16
  A demo site is available at http://forme-demo.jeremyevans.net
data/lib/forme/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Forme
2
2
  # Version constant, use <tt>Forme.version</tt> instead.
3
- VERSION = '0.9.0'.freeze
3
+ VERSION = '0.9.1'.freeze
4
4
 
5
5
  # Returns the version as a frozen string (e.g. '0.1.0')
6
6
  def self.version
@@ -380,7 +380,7 @@ module Sequel # :nodoc:
380
380
  # as :as=>:radio, or :as=>:checkbox to specify a particular style.
381
381
  def input_boolean(sch)
382
382
  unless opts.has_key?(:as)
383
- opts[:as] = sch[:allow_null] ? :select : :checkbox
383
+ opts[:as] = (sch[:allow_null] || opts[:required] == false) ? :select : :checkbox
384
384
  end
385
385
 
386
386
  case opts[:as]
@@ -90,6 +90,11 @@ describe "Forme Sequel::Model forms" do
90
90
  @b.input(:gold, :true_value=>"Foo", :false_value=>"Bar").to_s.should == '<label>Gold: <select id="album_gold" name="album[gold]"><option value=""></option><option value="Foo">True</option><option value="Bar">False</option></select></label>'
91
91
  end
92
92
 
93
+ specify "should use a select box for dual-valued boolean fields where :required => false" do
94
+ @b.input(:platinum, :required=>false).to_s.should == '<label>Platinum: <select id="album_platinum" name="album[platinum]"><option value=""></option><option value="t">True</option><option selected="selected" value="f">False</option></select></label>'
95
+ @c.input(:platinum, :required=>false).to_s.should == '<label>Platinum: <select id="album_platinum" name="album[platinum]"><option value=""></option><option selected="selected" value="t">True</option><option value="f">False</option></select></label>'
96
+ end
97
+
93
98
  specify "should use a checkbox for dual-valued boolean fields" do
94
99
  @b.input(:platinum).to_s.should == '<input id="album_platinum_hidden" name="album[platinum]" type="hidden" value="f"/><label><input id="album_platinum" name="album[platinum]" type="checkbox" value="t"/> Platinum</label>'
95
100
  @c.input(:platinum).to_s.should == '<input id="album_platinum_hidden" name="album[platinum]" type="hidden" value="f"/><label><input checked="checked" id="album_platinum" name="album[platinum]" type="checkbox" value="t"/> Platinum</label>'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-13 00:00:00.000000000 Z
11
+ date: 2013-12-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  Forme is a forms library with the following goals:
@@ -41,7 +41,8 @@ files:
41
41
  - lib/forme/version.rb
42
42
  - lib/sequel/plugins/forme.rb
43
43
  homepage: http://gihub.com/jeremyevans/forme
44
- licenses: []
44
+ licenses:
45
+ - MIT
45
46
  metadata: {}
46
47
  post_install_message:
47
48
  rdoc_options:
@@ -66,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
67
  version: '0'
67
68
  requirements: []
68
69
  rubyforge_project:
69
- rubygems_version: 2.0.3
70
+ rubygems_version: 2.0.14
70
71
  signing_key:
71
72
  specification_version: 4
72
73
  summary: HTML forms library