bootstrap_it 0.1.1 → 0.1.2

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -1
  3. data/bootstrap_it.gemspec +9 -8
  4. data/lib/bootstrap_it/config.rb +1 -1
  5. data/lib/bootstrap_it/engine.rb +1 -1
  6. data/lib/bootstrap_it/version.rb +1 -1
  7. data/lib/bootstrap_it/view_helpers.rb +4 -1
  8. data/lib/bootstrap_it/view_helpers/breadcrumb.rb +3 -2
  9. data/lib/bootstrap_it/view_helpers/button.rb +47 -39
  10. data/lib/bootstrap_it/view_helpers/button_group.rb +23 -4
  11. data/lib/bootstrap_it/view_helpers/dropdown_menu.rb +6 -5
  12. data/lib/bootstrap_it/view_helpers/form.rb +40 -41
  13. data/lib/bootstrap_it/view_helpers/grid.rb +9 -5
  14. data/lib/bootstrap_it/view_helpers/icon.rb +4 -2
  15. data/lib/bootstrap_it/view_helpers/list.rb +5 -5
  16. data/lib/bootstrap_it/view_helpers/misc.rb +37 -36
  17. data/lib/bootstrap_it/view_helpers/mixin.rb +16 -24
  18. data/lib/bootstrap_it/view_helpers/nav.rb +23 -21
  19. data/lib/bootstrap_it/view_helpers/pagination.rb +8 -6
  20. data/lib/bootstrap_it/view_helpers/table.rb +6 -10
  21. data/lib/bootstrap_it/view_helpers/text.rb +10 -8
  22. data/spec/spec_helper.rb +5 -2
  23. data/spec/support/example_groups/view_helpers_example_group.rb +4 -5
  24. data/spec/view_helpers/breadcrumb_spec.rb +8 -4
  25. data/spec/view_helpers/button_group_spec.rb +4 -4
  26. data/spec/view_helpers/button_spec.rb +25 -23
  27. data/spec/view_helpers/button_toolbar_spec.rb +3 -3
  28. data/spec/view_helpers/dropdown_menu_spec.rb +9 -9
  29. data/spec/view_helpers/form_spec.rb +4 -4
  30. data/spec/view_helpers/grid_spec.rb +5 -5
  31. data/spec/view_helpers/icon_spec.rb +2 -2
  32. data/spec/view_helpers/list_spec.rb +9 -9
  33. data/spec/view_helpers/misc_spec.rb +11 -11
  34. data/spec/view_helpers/mixin_spec.rb +49 -38
  35. data/spec/view_helpers/nav_spec.rb +14 -10
  36. data/spec/view_helpers/pagination_spec.rb +6 -6
  37. data/spec/view_helpers/table_spec.rb +9 -10
  38. data/spec/view_helpers/text_spec.rb +3 -3
  39. data/spec/views/examples_spec.rb +49 -36
  40. metadata +31 -32
  41. data/lib/bootstrap_it/view_helpers/button_toolbar.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc1f7b0639470e6de1802ae9fdcebf97317633ac
4
- data.tar.gz: 4d45a97704df12ddcc0ae0ddce3cd5404d654817
3
+ metadata.gz: e5774b34f81adf31f3b4b049ecd85fe339f03a02
4
+ data.tar.gz: 96cf31d8278893dee53b19a990886a53b2a94b8b
5
5
  SHA512:
6
- metadata.gz: 9dbca1c886bf4d4445b971c0881d02fe4cc90e60f4b052c6ebc83693f24cf97083010ba31608ded023e6c4cda78ff56a6169016315b6424aa744980e797407e6
7
- data.tar.gz: d6b22751fbc013aea7f9d70d5cdf262ac402bdac47dbce189fd7d7e2218f05d7a41d569a7aed89a059dad2cec8008542cfa000216b88af91f04535f865d1eff4
6
+ metadata.gz: 4dc4b603556ec14825b124c335dcbeb9059cc0326ccf4409aca87ef97ff1d366570d8f87329014a440d73d18dff9ae46cde71543951c033689063feebcdd5d97
7
+ data.tar.gz: d5b303cc16719485b8d65cf742f3df733e33b7fd484b09807a3d0702b15666b9892da8f559c06cf26372a8faf2056203d72868510169fd4b1936737c6a0cd483
data/README.md CHANGED
@@ -57,7 +57,7 @@ Full Rails-style configuration is not implemented yet. So, to change config opti
57
57
 
58
58
  ## Bootstrap assets
59
59
 
60
- Now, you have two choises: at first, CDN source of CSS and JavaScript. And second is minified versions of assets, downloaded from official sites. Third options - compile from LESS source will be available soon. So, you can configure bootstrap_it in `application.rb` linke this:
60
+ Now, you have two choises: at first, CDN source of CSS and JavaScript. And second is minified versions of assets, downloaded from official sites. Third options - compile from LESS source will be available soon. So, you can configure bootstrap_it in `application.rb` like this:
61
61
 
62
62
  ```ruby
63
63
  BootstrapIt.config.assets_source = :cdn # or :precompiled for minified version
@@ -553,6 +553,11 @@ This and all other stuff are in development.
553
553
 
554
554
  # Changes
555
555
 
556
+ `0.1.2`
557
+ * switched to wrap_it 0.2.0
558
+ * code refactoring
559
+ * testing improvements
560
+
556
561
  `0.1.1`
557
562
  * fixed: bootstrap version uninitialized constant
558
563
 
@@ -19,15 +19,16 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ['lib']
21
21
 
22
- spec.add_dependency 'rails', '~> 4.0.0'
23
- spec.add_dependency 'wrap_it'
22
+ spec.add_runtime_dependency 'rails', '~> 4.0'
23
+ spec.add_runtime_dependency 'wrap_it', '~> 0.2'
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1.3'
26
- spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rake', '~> 10.1'
27
27
  spec.add_development_dependency 'redcarpet', '~> 1.17'
28
- spec.add_development_dependency 'yard', '~> 0.7.5'
29
- spec.add_development_dependency 'rspec'
30
- spec.add_development_dependency 'rspec-rails'
31
- spec.add_development_dependency 'combustion'
32
- spec.add_development_dependency 'capybara'
28
+ spec.add_development_dependency 'yard', '~> 0.7'
29
+ spec.add_development_dependency 'rspec', '~> 2.14'
30
+ spec.add_development_dependency 'rspec-rails', '~> 2.14'
31
+ spec.add_development_dependency 'combustion', '~> 0.5'
32
+ # spec.add_development_dependency 'capybara'
33
+ spec.add_development_dependency 'rspec-html-matchers', '~> 0.4'
33
34
  end
@@ -3,7 +3,7 @@ module BootstrapIt
3
3
  #
4
4
  # Configuration
5
5
  #
6
- # @author [alexiss]
6
+ # @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
7
7
  #
8
8
  module Config
9
9
  ASSETS_SOURCES = %i[cdn precompiled]
@@ -9,8 +9,8 @@ module BootstrapIt
9
9
 
10
10
  initializer 'bootstrap_it.configure_view_controller' do |app|
11
11
  ActiveSupport.on_load(:action_view) do
12
- include WrapIt.helpers
13
12
  include BootstrapIt::LayoutHelpers
13
+ include BootstrapIt::ViewHelpers
14
14
  end
15
15
 
16
16
  # ActiveSupport.on_load :action_controller do
@@ -1,6 +1,6 @@
1
1
  #
2
2
  module BootstrapIt
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  BOOTSTRAP_LATEST = '3.0.3'
5
5
  FONTAWESOME_LATEST = '4.0.3'
6
6
  end
@@ -36,6 +36,10 @@ module BootstrapIt
36
36
  bootstrap_it_stylesheets << bootstrap_it_javascripts
37
37
  end
38
38
  end
39
+
40
+ module ViewHelpers; end
41
+
42
+ WrapIt.register_module ViewHelpers
39
43
  end
40
44
 
41
45
  require 'bootstrap_it/view_helpers/mixin'
@@ -47,7 +51,6 @@ require 'bootstrap_it/view_helpers/list'
47
51
  require 'bootstrap_it/view_helpers/dropdown_menu'
48
52
  require 'bootstrap_it/view_helpers/button'
49
53
  require 'bootstrap_it/view_helpers/button_group'
50
- require 'bootstrap_it/view_helpers/button_toolbar'
51
54
  require 'bootstrap_it/view_helpers/form'
52
55
  require 'bootstrap_it/view_helpers/nav'
53
56
  require 'bootstrap_it/view_helpers/breadcrumb'
@@ -2,9 +2,10 @@ module BootstrapIt
2
2
  #
3
3
  module ViewHelpers
4
4
  #
5
+ # @see http://getbootstrap.com/components/#breadcrumbs Bootstrap docs
5
6
  # Breadcrumb
6
7
  #
7
- # @author [alexiss]
8
+ # @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
8
9
  #
9
10
  class Breadcrumb < WrapIt::Container
10
11
  default_tag 'ol'
@@ -14,6 +15,6 @@ module BootstrapIt
14
15
  child :item, 'BootstrapIt::ViewHelpers::ListItem'
15
16
  end
16
17
 
17
- WrapIt.register :breadcrumb, 'BootstrapIt::ViewHelpers::Breadcrumb'
18
+ register :breadcrumb, 'BootstrapIt::ViewHelpers::Breadcrumb'
18
19
  end
19
20
  end
@@ -4,13 +4,15 @@ module BootstrapIt
4
4
  #
5
5
  # Button
6
6
  #
7
- # @author [alexiss]
7
+ # @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
8
8
  #
9
+ # @see http://getbootstrap.com/css/#buttons Bootstrap docs
10
+ # @see http://getbootstrap.com/javascript/#buttons Bootstrap docs
9
11
  class Button < WrapIt::Container
12
+ include WrapIt::TextContainer
10
13
  include Activable
11
14
  include Disableable
12
15
  include Sizable
13
- include WrapIt::TextContainer
14
16
 
15
17
  html_class 'btn'
16
18
  html_class_prefix 'btn-'
@@ -24,11 +26,14 @@ module BootstrapIt
24
26
  default: :default, html_class: true
25
27
 
26
28
  child :icon, 'BootstrapIt::ViewHelpers::Icon'
29
+ extract_from_options icon: :icon
30
+ section :space_separator, :input
31
+ place :children, after: :begin
32
+ place :space_separator, after: :children
33
+ place :input, before: :content
27
34
 
28
- before_render do
29
- unless @icon.nil?
30
- @content = capture { @icon.render } + html_safe(' ') + @content
31
- end
35
+ after_capture do
36
+ children.size > 0 && self[:space_separator] = html_safe(' ')
32
37
 
33
38
  if @helper_name == :radio || @helper_name == :checkbox
34
39
  @tag = 'label'
@@ -37,35 +42,29 @@ module BootstrapIt
37
42
  next if k == :class || k == :type
38
43
  input_options[k] = @options.delete(k)
39
44
  end
40
- input_options.key?(:checked) && input_options[:checked] != false &&
45
+ if input_options.key?(:checked) && input_options[:checked] != false
41
46
  input_options[:checked] = 'checked'
42
- @content = content_tag('input', '', input_options) + @content
43
- input_options[:id].blank? ||
47
+ end
48
+ self[:input] = content_tag('input', '', input_options)
49
+ unless input_options[:id].blank?
44
50
  @options[:label_for] = input_options[:id]
51
+ end
45
52
  end
46
- true
47
- end
48
-
49
- after_capture do
50
- @icon.nil? && !@content.empty? && @content += html_safe(' ')
51
53
  end
52
54
 
53
55
  after_initialize do
54
- @tag = 'button' unless @tag == 'a' || @tag == 'input'
56
+ @tag == 'a' || @tag == 'input' || @tag = 'button'
55
57
  if @tag == 'a'
56
58
  @options[:role] = 'button'
57
59
  else
58
- @options[:type] = 'button' unless @options.include?(:type)
60
+ @options.include?(:type) || @options[:type] = 'button'
59
61
  @options[:type] = @options[:type].to_s.downcase
60
62
  end
61
63
 
62
- @options.key?(:icon) &&
63
- @icon = Icon.new(@template, @options.delete(:icon))
64
-
65
64
  @options.keys.each do |key|
66
- next unless /_text$/ =~ key
65
+ /_text$/ =~ key || next
67
66
  value = @options.delete(key)
68
- next unless value.is_a?(String)
67
+ value.is_a?(String) || next
69
68
  set_html_data(key.to_s.gsub(/_/, '-'), value)
70
69
  end
71
70
  end
@@ -74,43 +73,52 @@ module BootstrapIt
74
73
  #
75
74
  # DropdownButton
76
75
  #
77
- # @author [alexiss]
76
+ # @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
78
77
  #
78
+ # @see http://getbootstrap.com/components/#btn-dropdowns Bootstrap docs
79
79
  class DropdownButton < Button
80
80
  include DropdownMenuWrapper
81
81
 
82
82
  switch :splitted
83
83
  switch :dropup
84
+ section :caret, :splitted
85
+ place :caret, after: :content
86
+ place :splitted, after: :caret
87
+ place :space_separator, before: :caret
88
+ place :children, before: :end
84
89
 
85
90
  after_capture do
86
- unless @dropdown_items.empty?
87
- unless splitted?
88
- @content += content_tag('span', '', class: 'caret')
89
- add_html_class('dropdown-toggle')
90
- set_html_data(:toggle, 'dropdown')
91
- end
92
- end
93
- end
94
-
95
- after_render do
96
- unless @dropdown_items.empty?
91
+ if !@dropdown_menu.nil?
92
+ caret = content_tag('span', empty_html, class: 'caret')
97
93
  if splitted?
98
94
  toggle = WrapIt::Base.new(@template, @options.merge(tag: 'button'))
99
95
  toggle.add_html_class('dropdown-toggle')
100
96
  toggle.set_html_data(:toggle, 'dropdown')
101
- @content += capture do
102
- toggle.render(content_tag('span', '', class: 'caret'))
103
- end
97
+ self[:splitted] = capture { toggle.render(caret) }
98
+ self[:space_separator] = empty_html
99
+ else
100
+ self[:caret] = caret
101
+ self[:space_separator] = html_safe(' ')
102
+ add_html_class('dropdown-toggle')
103
+ set_html_data(:toggle, 'dropdown')
104
104
  end
105
+ #puts "--- #{self.class.placement}"
106
+ #puts "--> #{instance_variable_get(:@sections)}"
107
+ self[:content] = render_sections(except: [:children, :splitted])
108
+ @after_render = render_sections(:children, :splitted)
109
+ #puts "RENDERED: #{self[:content]} #{@}"
105
110
  wrapper_class = ['btn-group']
106
111
  wrapper_class << 'dropup' if dropup?
107
112
  wrap(class: wrapper_class)
108
113
  end
109
114
  end
115
+
116
+ after_render do
117
+ @after_render.nil? || @rendered << @after_render
118
+ end
110
119
  end
111
120
 
112
- WrapIt.register :button, :radio, :checkbox,
113
- 'BootstrapIt::ViewHelpers::Button'
114
- WrapIt.register :dropdown_button, 'BootstrapIt::ViewHelpers::DropdownButton'
121
+ register :button, :radio, :checkbox, 'BootstrapIt::ViewHelpers::Button'
122
+ register :dropdown_button, 'BootstrapIt::ViewHelpers::DropdownButton'
115
123
  end
116
124
  end
@@ -4,8 +4,9 @@ module BootstrapIt
4
4
  #
5
5
  # ButtonGroup
6
6
  #
7
- # @author [alexiss]
7
+ # @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
8
8
  #
9
+ # @see http://getbootstrap.com/components/#btn-groups Bootstrap docs
9
10
  class ButtonGroup < WrapIt::Container
10
11
  include Sizable
11
12
  include Justifable
@@ -18,15 +19,33 @@ module BootstrapIt
18
19
  child :button, 'BootstrapIt::ViewHelpers::Button'
19
20
  child :dropdown, 'BootstrapIt::ViewHelpers::DropdownButton'
20
21
 
21
- child :radio, 'BootstrapIt::ViewHelpers::Button' do |button|
22
+ child :radio, 'BootstrapIt::ViewHelpers::Button' do |_|
22
23
  set_html_data(:toggle, 'buttons')
23
24
  end
24
25
 
25
- child :checkbox, 'BootstrapIt::ViewHelpers::Button' do |button|
26
+ child :checkbox, 'BootstrapIt::ViewHelpers::Button' do |_|
26
27
  set_html_data(:toggle, 'buttons')
27
28
  end
28
29
  end
29
30
 
30
- WrapIt.register :button_group, 'BootstrapIt::ViewHelpers::ButtonGroup'
31
+ #
32
+ # Button Toolbar
33
+ #
34
+ # @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
35
+ #
36
+ # @see http://getbootstrap.com/components/#btn-groups-toolbar Bootstrap
37
+ # docs
38
+ class ButtonToolbar < WrapIt::Container
39
+ html_class 'btn-toolbar'
40
+
41
+ child :button_group, 'BootstrapIt::ViewHelpers::ButtonGroup'
42
+ alias_method :group, :button_group
43
+
44
+ after_initialize { @options[:role] = 'toolbar' }
45
+ end
46
+
47
+ register :button_group, 'BootstrapIt::ViewHelpers::ButtonGroup'
48
+ register :button_toolbar, 'BootstrapIt::ViewHelpers::ButtonToolbar'
49
+ register :toolbar, 'BootstrapIt::ViewHelpers::ButtonToolbar'
31
50
  end
32
51
  end
@@ -4,18 +4,19 @@ module BootstrapIt
4
4
  #
5
5
  # Dropdown Menu
6
6
  #
7
- # @author [alexiss]
7
+ # @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
8
8
  #
9
+ # @see http://getbootstrap.com/components/#dropdowns Bootstrap docs
9
10
  class DropdownMenu < WrapIt::Container
10
11
  default_tag 'ul'
11
12
  html_class 'dropdown-menu'
12
13
 
13
14
  child :divider, ListItem,
14
- [tag: 'li', class: 'divider', role: 'presentation']
15
+ tag: 'li', class: 'divider', role: 'presentation'
15
16
  child :header, ListItem,
16
- [tag: 'li', class: 'dropdown-header', role: 'presentation']
17
+ tag: 'li', class: 'dropdown-header', role: 'presentation'
17
18
  child :link_item, ListLinkItem,
18
- [li_role: 'presentation', role: 'menuitem', tabindex: '-1']
19
+ li_role: 'presentation', role: 'menuitem', tabindex: '-1'
19
20
 
20
21
  after_initialize do
21
22
  @options['role'] = 'menu'
@@ -25,6 +26,6 @@ module BootstrapIt
25
26
  end
26
27
  end
27
28
 
28
- WrapIt.register :dropdown_menu, 'BootstrapIt::ViewHelpers::DropdownMenu'
29
+ register :dropdown_menu, 'BootstrapIt::ViewHelpers::DropdownMenu'
29
30
  end
30
31
  end
@@ -4,8 +4,9 @@ module BootstrapIt
4
4
  #
5
5
  # Input
6
6
  #
7
- # @author [alexiss]
7
+ # @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
8
8
  #
9
+ # @see http://getbootstrap.com/css/#forms Bootstrap docs
9
10
  class Input < WrapIt::Base
10
11
  include WrapIt::TextContainer
11
12
  TYPES = %w(text password datetime datetime-local date month time
@@ -20,16 +21,15 @@ module BootstrapIt
20
21
  @saved_args = @arguments.clone
21
22
  end
22
23
 
23
- before_render do
24
- @options.key?(:value) || @options[:value] = @content
25
- @content = empty_html
24
+ after_capture do
25
+ @options.key?(:value) || @options[:value] = render_sections
26
26
  end
27
27
  end
28
28
 
29
29
  #
30
30
  # FormLabel
31
31
  #
32
- # @author [alexiss]
32
+ # @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
33
33
  #
34
34
  class FormLabel < WrapIt::Base
35
35
  include WrapIt::TextContainer
@@ -42,60 +42,56 @@ module BootstrapIt
42
42
  #
43
43
  # FormGroup
44
44
  #
45
- # @author [alexiss]
45
+ # @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
46
46
  #
47
47
  class FormGroup < WrapIt::Container
48
48
  html_class 'form-group'
49
49
 
50
+ section :label, :input
51
+
52
+ child :label, 'BootstrapIt::ViewHelpers::FormLabel', section: :label
50
53
  child :input, 'BootstrapIt::ViewHelpers::Input' do |input|
51
54
  input_args = input.instance_variable_get(:@saved_args)
52
- @control_size = input_args.extract!(
55
+ control_size = input_args.extract!(
53
56
  Symbol, and: [SizableColumn::COLUMN_SIZE_REGEXP]
54
57
  )
55
- @control_place = input_args.extract!(
58
+ control_place = input_args.extract!(
56
59
  Symbol, and: [PlacableColumn::COLUMN_PLACE_REGEXP]
57
60
  )
58
- @control_size.empty? && @control_size = @form.control_size
59
-
60
- label_args = input.options.delete(:label)
61
- unless label_args.nil?
62
- label_args.is_a?(Array) || label_args = [label_args]
63
- @label = FormLabel.new(@template, *label_args)
64
- if @form.kind == :horizontal && !@label.column_size_defined?
65
- @label.column_size = @form.label_size
66
- end
67
- unless input.options[:id].nil?
68
- @label.options[:label_for] = input.options[:id]
69
- end
70
- end
71
- end
61
+ control_size.empty? && control_size = parent.control_size
72
62
 
73
- after_initialize do
74
- @form = @options.delete :form
75
- # @form.is_a? Form || fail(
76
- # ArgumentError,
77
- # 'Required option `form` for `form_group` is not specified'
78
- # )
79
- end
80
-
81
- after_capture do
82
- if @form.kind == :horizontal
83
- input_wrapper = Base.new(@template)
63
+ if parent.kind == :horizontal
64
+ input_wrapper = WrapIt::Base.new(@template)
84
65
  input_wrapper.extend SizableColumn
85
66
  input_wrapper.extend PlacableColumn
86
- input_wrapper.column_size = @control_size
87
- input_wrapper.column_place = @control_place
88
- @content = capture { input_wrapper.render(@content) }
67
+ input_wrapper.column_size = control_size
68
+ input_wrapper.column_place = control_place
69
+ input.wrap(input_wrapper)
70
+ end
71
+
72
+ args = input.options.delete(:label)
73
+ unless args.nil?
74
+ args.is_a?(Array) || args = [args]
75
+ options = args.extract_options!
76
+ unless input.options[:id].nil?
77
+ options[:label_for] = input.options[:id]
78
+ end
79
+ args << options
80
+ label(*args)
81
+ l = children.last
82
+ if parent.kind == :horizontal && !l.column_size_defined?
83
+ l.column_size = @form.label_size
84
+ end
89
85
  end
90
- @label.nil? || @content = capture { @label.render } + @content
91
86
  end
92
87
  end
93
88
 
94
89
  #
95
90
  # Form
96
91
  #
97
- # @author [alexiss]
92
+ # @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
98
93
  #
94
+ # @see http://getbootstrap.com/css/#forms Bootstrap docs
99
95
  class Form < WrapIt::Container
100
96
  DEFAULT_LABEL_SIZE = %i(xs2 sm2 md2 lg2)
101
97
  DEFAULT_CONTROL_SIZE = %i(xs10 sm10 md10 lg10)
@@ -107,9 +103,11 @@ module BootstrapIt
107
103
  attr_reader :label_size
108
104
  attr_reader :control_size
109
105
 
106
+ child :group, 'BootstrapIt::ViewHelpers::FormGroup',
107
+ deffered_render: true
108
+
110
109
  def input(*args, &block)
111
- group = BootstrapIt::ViewHelpers::FormGroup.new(@template, form: self)
112
- group.input(*args, &block)
110
+ group { |g| g.input(*args, &block) }
113
111
  end
114
112
 
115
113
  after_initialize do
@@ -119,9 +117,10 @@ module BootstrapIt
119
117
  @label_size = options.delete(:label_size) || DEFAULT_LABEL_SIZE
120
118
  @control_size = options.delete(:control_size) || DEFAULT_CONTROL_SIZE
121
119
  end
120
+ self.deffered_render = true
122
121
  end
123
122
  end
124
123
 
125
- WrapIt.register :form, 'BootstrapIt::ViewHelpers::Form'
124
+ register :form, 'BootstrapIt::ViewHelpers::Form'
126
125
  end
127
126
  end