formtastic 2.0.0 → 2.0.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/CHANGELOG CHANGED
@@ -1,3 +1,15 @@
1
+ 2.0.1
2
+
3
+ * fixed that `:multiple => true` wasn't working when no association present
4
+
5
+ 2.0.0
6
+
7
+ * Fixed that all check boxes were incorrectly checked if an Array was passed in to :collection
8
+ * Improved README
9
+ * Added form generator template for Slim template engine
10
+ * Added support for Proc conditions in collection_from_association
11
+ * Refactored commit button. Split it into a couple of different methods to make it easier to override.
12
+
1
13
  2.0.0.rc5
2
14
 
3
15
  * Changed perform_browser_validations and use_required_attribute configuration defaults from true to false for a better out-of-the-box experience and upgrade path
@@ -184,7 +184,7 @@ module Formtastic
184
184
 
185
185
  def extra_input_html_options
186
186
  {
187
- :multiple => multiple_by_association?,
187
+ :multiple => multiple?,
188
188
  :name => "#{object_name}[#{association_primary_key}]#{'[]' if multiple?}"
189
189
  }
190
190
  end
@@ -194,7 +194,7 @@ module Formtastic
194
194
  end
195
195
 
196
196
  def multiple_by_options?
197
- options[:multiple]
197
+ options[:multiple] || (options[:input_html] && options[:input_html][:multiple])
198
198
  end
199
199
 
200
200
  def multiple?
@@ -1,3 +1,3 @@
1
1
  module Formtastic
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
@@ -452,15 +452,32 @@ describe 'select input' do
452
452
  end
453
453
 
454
454
  describe 'when no association exists' do
455
- before(:each) do
455
+
456
+ it 'should still generate a valid name attribute' do
456
457
  concat(semantic_form_for(:project, :url => 'http://test.host') do |builder|
457
458
  concat(builder.input(:author_name, :as => :select, :collection => ::Author.all))
458
459
  end)
459
- end
460
-
461
- it 'should still generate a valid name attribute' do
462
460
  output_buffer.should have_tag("form li select[@name='project[author_name]']")
463
461
  end
462
+
463
+ describe 'and :multiple is set to true through :input_html' do
464
+ it "should make the select a multi-select" do
465
+ concat(semantic_form_for(:project, :url => 'http://test.host') do |builder|
466
+ concat(builder.input(:author_name, :as => :select, :input_html => {:multiple => true} ))
467
+ end)
468
+ output_buffer.should have_tag("form li select[@multiple]")
469
+ end
470
+ end
471
+
472
+ describe 'and :multiple is set to true' do
473
+ it "should make the select a multi-select" do
474
+ concat(semantic_form_for(:project, :url => 'http://test.host') do |builder|
475
+ concat(builder.input(:author_name, :as => :select, :multiple => true, :collection => ["Fred", "Bob"]))
476
+ end)
477
+ output_buffer.should have_tag("form li select[@multiple]")
478
+ end
479
+ end
480
+
464
481
  end
465
482
 
466
483
  describe 'when a grouped collection collection is given' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formtastic
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 0
10
- version: 2.0.0
9
+ - 1
10
+ version: 2.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin French
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-23 00:00:00 +10:00
18
+ date: 2011-10-03 00:00:00 +11:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency