simple_form_bootstrap3 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c401b3b54b4828f8e3168c069a2e6823d2fc9924
4
- data.tar.gz: ab36733744b7a1a89347a52671a1cf4ec28c40cd
3
+ metadata.gz: e94c74e8091471aff07ab15c16d8772d63dc8f0a
4
+ data.tar.gz: 4d28a10d595ad3434948a92b6302846c7eee0e1d
5
5
  SHA512:
6
- metadata.gz: ccd6caee6760bc92a44c2f38bfdae48e9939b9a597bdec14d8a670b51bb96464f0a90c7c60406ae9d6c146ac8715e6688c6e5a6d74488d8f908e85f5da285c03
7
- data.tar.gz: 9f7ded251c5c6b1b0b5459b7332a2b4ef544d5f986d822f3f7fc8559c997a36c138a009cdd6f835a98c7b715b44d396a6f5ed7d5093d842777f1698b264e59d2
6
+ metadata.gz: 7422f2c580b4482411baeeabc4a7f8f9705c59e49b3d184b4253885be272e549110925c9c363c6899b8b4aec1d57c4e54afaa056c3294d3d4eba76c07dda8d98
7
+ data.tar.gz: fbc753c7a4f2d976382f462a5d5959acac995a3c3c8d8448ff847475e812a10479cba4ac79fb1ef1192b62c94d9c57f36de6a501299631344a53a19213fa92bc
@@ -1,17 +1,25 @@
1
1
  module SimpleForm
2
2
  class DefaultFormBuilder < SimpleForm::FormBuilder
3
+ CHECKBOX_WRAPPER = :checkbox
4
+ RADIO_WRAPPER = :radio
5
+
3
6
  map_type :datetime, to: SimpleForm::Inputs::DateTimePickerInput
4
7
  map_type :date, to: SimpleForm::Inputs::DatePickerInput
5
8
 
6
9
  def checkbox(attribute_name, options = {}, &block)
7
- options[:wrapper] ||= :checkbox
10
+ options[:wrapper] ||= self.class::CHECKBOX_WRAPPER
8
11
  options[:as] ||= :boolean
9
12
  input attribute_name, options, &block
10
13
  end
11
14
 
12
15
  def radio(attribute_name, options = {}, &block)
13
- options[:wrapper] ||= :radio
16
+ options[:wrapper] ||= self.class::RADIO_WRAPPER
14
17
  input attribute_name, options, &block
15
18
  end
19
+
20
+ def input(attribute_name, options = {}, &block)
21
+ options[:wrapper] ||= self.class::CHECKBOX_WRAPPER if options[:as] == :boolean
22
+ super
23
+ end
16
24
  end
17
25
  end
@@ -1,14 +1,7 @@
1
1
  module SimpleForm
2
2
  class HorizontalFormBuilder < SimpleForm::DefaultFormBuilder
3
- def checkbox(attribute_name, options = {}, &block)
4
- options[:wrapper] ||= :horizontal_checkbox
5
- super
6
- end
7
-
8
- def radio(attribute_name, options = {}, &block)
9
- options[:wrapper] ||= :horizontal_radio
10
- super
11
- end
3
+ CHECKBOX_WRAPPER = :horizontal_checkbox
4
+ RADIO_WRAPPER = :horizontal_radio
12
5
 
13
6
  def buttons(options = {}, &block)
14
7
  raise ::ArgumentError unless block_given?
@@ -1,13 +1,6 @@
1
1
  module SimpleForm
2
2
  class InlineFormBuilder < SimpleForm::PlaceholderFormBuilder
3
- def checkbox(attribute_name, options = {}, &block)
4
- options[:wrapper] ||= :inline_checkbox
5
- super
6
- end
7
-
8
- def radio(attribute_name, options = {}, &block)
9
- options[:wrapper] ||= :inline_radio
10
- super
11
- end
3
+ CHECKBOX_WRAPPER = :inline_checkbox
4
+ RADIO_WRAPPER = :inline_radio
12
5
  end
13
6
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleFormBootstrap3
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_bootstrap3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuriy Kolodovskyy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-10 00:00:00.000000000 Z
11
+ date: 2014-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap-sass