simple_form_bootstrap3 0.0.1 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fe204090932d4f58760c87769125addab47fe11
4
- data.tar.gz: a7f1fb11538b6f410289d046aec04ad388b3efce
3
+ metadata.gz: 87a485a19bd40dfd50f3b21c4fc02866e4bba818
4
+ data.tar.gz: a70184407bd36859c59a092b391b1600c210b8bf
5
5
  SHA512:
6
- metadata.gz: 989d694b2a96de43d4818863855f45e46368631bf43335da4cdb6f7383503c8e1feefc261a338c48b8e9c54458d70f81403092acd1f5d8c5528891bb3fcc9207
7
- data.tar.gz: 17e267e9368287e429028e9e914704ec187f555caa6fd316941c9667358950c30bcd84045cb35fd46be41e48bdd7e43e26c43448a8fc897cadadaf71e67a12bb
6
+ metadata.gz: f0919ea2d0817941e65a4f4fef448c88f881532b3cf591c21f597e417d7ce6b2f266bfcec156da5640b708874d9ca4e0bf7b6cd3e54c56596ed84f6ffac275fe
7
+ data.tar.gz: 110f711fc3b1c9cbd6df502baa5df98ec54819e9e3e555679df8074ea01c8ad26d99bf691ac2fcc43a69a643031f59882a67b8457e637d3ccd5f5e5f1dfbf0fd
@@ -3,6 +3,7 @@ module SimpleFormBootstrap3
3
3
  def horizontal_form_for(object, *args, &block)
4
4
  options = args.extract_options!
5
5
  options[:wrapper] ||= :horizontal
6
+ options[:builder] ||= SimpleForm::HorizontalFormBuilder
6
7
  options[:html] ||= {}
7
8
  options[:html][:role] = 'form'
8
9
  options[:html][:class] = [ options[:html][:class], 'form-horizontal' ].compact.join(' ')
@@ -13,6 +14,7 @@ module SimpleFormBootstrap3
13
14
  def default_form_for(object, *args, &block)
14
15
  options = args.extract_options!
15
16
  options[:wrapper] ||= :default
17
+ options[:builder] ||= SimpleForm::DefaultFormBuilder
16
18
  options[:html] ||= {}
17
19
  options[:html][:role] = 'form'
18
20
 
@@ -22,7 +24,7 @@ module SimpleFormBootstrap3
22
24
  def inline_form_for(object, *args, &block)
23
25
  options = args.extract_options!
24
26
  options[:wrapper] ||= :inline
25
- options[:builder] ||= SimpleForm::PlaceholderFormBuilder
27
+ options[:builder] ||= SimpleForm::InlineFormBuilder
26
28
  options[:html] ||= {}
27
29
  options[:html][:role] = 'form'
28
30
  options[:html][:class] = [ options[:html][:class], 'form-inline' ].compact.join(' ')
@@ -0,0 +1,13 @@
1
+ module SimpleForm
2
+ class DefaultFormBuilder < SimpleForm::FormBuilder
3
+ def checkbox(attribute_name, options = {}, &block)
4
+ options[:wrapper] ||= :checkbox
5
+ input attribute_name, options, &block
6
+ end
7
+
8
+ def radio(attribute_name, options = {}, &block)
9
+ options[:wrapper] ||= :radio
10
+ input attribute_name, options, &block
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,23 @@
1
+ module SimpleForm
2
+ class HorizontalFormBuilder < SimpleForm::FormBuilder
3
+ def checkbox(attribute_name, options = {}, &block)
4
+ options[:wrapper] ||= :horizontal_checkbox
5
+ input attribute_name, options, &block
6
+ end
7
+
8
+ def radio(attribute_name, options = {}, &block)
9
+ options[:wrapper] ||= :horizontal_radio
10
+ input attribute_name, options, &block
11
+ end
12
+
13
+ def buttons(options = {}, &block)
14
+ raise ::ArgumentError unless block_given?
15
+ options[:class] ||= 'col-sm-offset-2 col-sm-10'
16
+ @template.content_tag(:div, class: 'form-group') do
17
+ @template.content_tag(:div, class: options[:class]) do
18
+ yield
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ module SimpleForm
2
+ class InlineFormBuilder < SimpleForm::PlaceholderFormBuilder
3
+ def checkbox(attribute_name, options = {}, &block)
4
+ options[:wrapper] ||= :inline_checkbox
5
+ input attribute_name, options, &block
6
+ end
7
+
8
+ def radio(attribute_name, options = {}, &block)
9
+ options[:wrapper] ||= :inline_radio
10
+ input attribute_name, options, &block
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module SimpleFormBootstrap3
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_bootstrap3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuriy Kolodovskyy
@@ -50,6 +50,9 @@ files:
50
50
  - config/initializers/simple_form_default.rb
51
51
  - config/initializers/simple_form_horizontal.rb
52
52
  - config/initializers/simple_form_inline.rb
53
+ - lib/simple_form/default_form_builder.rb
54
+ - lib/simple_form/horizontal_form_builder.rb
55
+ - lib/simple_form/inline_form_builder.rb
53
56
  - lib/simple_form/placeholder_form_builder.rb
54
57
  - lib/simple_form_bootstrap3/engine.rb
55
58
  - lib/simple_form_bootstrap3/version.rb