binco 3.1.0 → 3.1.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: e9c1a96ef181073a6786d8f995981d5f58a2e563
4
- data.tar.gz: 3de0b1146ebead0c63fe5b52fcd86f68d94991ce
3
+ metadata.gz: '075685bd20689c841ea95d7ca92295548d42c1a1'
4
+ data.tar.gz: e6a4396cba4b034f7d6ecfb269d55a039189bb82
5
5
  SHA512:
6
- metadata.gz: 19e39c88f28954e570a03e2ba7b53cc532bcee55695177cf93610451003fe8a73522fca3c59a3a2f89a364d36069e84536c6d0ca6ad2fc4f3f951bba240458ae
7
- data.tar.gz: 507984f78827863ed5d8184cc1ea54ae86abdaf0e06477f76b71dc244cba42bd002c0f2218759d0971fedbe48e8b814681bacefb53880186b9f0402a79dcfc97
6
+ metadata.gz: 05beb6fa8a2fb67a70edaf2fcb165b9748c1d338086d9f9f245cdc095aef9a1bffac8026d98166baa194fdec9c2f0b06b7961dcf203393276f3dccaf4e712025
7
+ data.tar.gz: '09186de9b1b4a2d1e55981966c00df0e9aff3085bef49fe244be7470b9d22ff018dc3b0a0ef50e78463c648279fc8ae64a27314dce50789f32b0549b5a646c30'
@@ -10,16 +10,18 @@ module Binco
10
10
  FORM_ELEMENT_CLASS = 'form-control'
11
11
  CHECK_BOX_INPUT_CLASS = 'form-check-input'
12
12
 
13
- def initialize(object_name, object, template, options)
14
- ActionView::Base::field_error_proc = Proc.new do |html_tag, instance|
15
- if instance.respond_to?(:error_message) && instance.class.to_s != 'ActionView::Helpers::Tags::Label'
16
- error_messages = instance.error_message.collect{ |error| "<div class=\"invalid-feedback\">#{error}</div>" }.join
13
+ ERROR_PROC = Proc.new do |html_tag, instance|
14
+ if instance.respond_to?(:error_message) && instance.class.to_s != 'ActionView::Helpers::Tags::Label'
15
+ error_messages = instance.error_message.collect{ |error| "<div class=\"invalid-feedback\">#{error}</div>" }.join
17
16
 
18
- "<div class=\"field_with_errors\">#{html_tag} #{error_messages}</div>".html_safe
19
- else
20
- "<div class=\"field_with_errors\">#{html_tag}</div>".html_safe
21
- end
17
+ "<div class=\"field_with_errors\">#{html_tag} #{error_messages}</div>".html_safe
18
+ else
19
+ html_tag
22
20
  end
21
+ end
22
+
23
+ def initialize(object_name, object, template, options)
24
+ ActionView::Base::field_error_proc = ERROR_PROC
23
25
 
24
26
  super(object_name, object, template, options)
25
27
  end
@@ -5,6 +5,16 @@ module Binco
5
5
  form_for(record, options, &block)
6
6
  end
7
7
 
8
+ def bootstrap_form_with(model: nil, scope: nil, url: nil, format: nil, **options, &block)
9
+ options[:builder] = BootstrapFormBuilder
10
+
11
+ if block_given?
12
+ form_with(model: model, scope: scope, url: url, format: format, **options, &block)
13
+ else
14
+ form_with(model: model, scope: scope, url: url, format: format, **options)
15
+ end
16
+ end
17
+
8
18
  def bootstrap_form_tag(url_for_options = {}, options = {}, &block)
9
19
  options[:acts_like_form_tag] = true
10
20
  options[:url] = url_for_options
data/lib/binco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Binco
2
- VERSION = '3.1.0'
2
+ VERSION = '3.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binco
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Camacho
@@ -30,7 +30,7 @@ cert_chain:
30
30
  XdmvXYY6Fr9AHqSdbvphaVu+RqBpkBdGUQCcCZ73NjXSUwgJumx1p1A8e4NXrh1e
31
31
  pYh0/Q==
32
32
  -----END CERTIFICATE-----
33
- date: 2017-11-01 00:00:00.000000000 Z
33
+ date: 2017-12-28 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: railties