effective_bootstrap 0.9.8 → 0.9.9

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
  SHA256:
3
- metadata.gz: d3f89e397f06193b9e69ed5e2ef79c992a8c73705548cbb28e33d379738553d7
4
- data.tar.gz: 97869e53c24d7d47c28a19d13bf95095f7e7bdf61122f24b44e2a85491f6380c
3
+ metadata.gz: 2db71ddfb367e9c0aba19eb1b05cd145a4cef6743bc63151ca7eb9c118c313c9
4
+ data.tar.gz: 823eea41c096624761741d233d39db5431824f2a37e43f2e0797c0bc91c8cf54
5
5
  SHA512:
6
- metadata.gz: b2c68c7fec202c9dce7bab99b1783a4ca4283565fb4f1f8f23bfc9efb88f884508d161422f1effecbdd6e39ec37aaf1ef4c2c2eaba53f92ab4ff6ea30bc285c0
7
- data.tar.gz: 7907170bbaa34401f4df5604db70f07047299450d3072181e85e8a0fedcd6b77cfbdcbef717f0fd50687984812c83e8a7885162ef7d7820170b830ed2f46e989
6
+ metadata.gz: 18716b0514719e0d48b7cfe84efb5169bca2be5fbbb79c585ac5d7e86d570e795cb1228a498cf6705c7b559bcd717f6f8868070cba757d720b7b3c93b295c5bd
7
+ data.tar.gz: d493815d79bfed154f0b982689ae3e4713c283f83f75ac5a21ef4be93184ccc3e2dd7bb42f221097d923ad66bebf87fe24b582151b679acd2bba25a84b7d5423
@@ -2,7 +2,7 @@ module EffectiveFormBuilderHelper
2
2
  def effective_form_with(**options, &block)
3
3
  # Compute the default ID
4
4
  subject = Array(options[:scope] || options[:model]).last
5
- class_name = subject.class.name.underscore
5
+ class_name = subject.class.name.parameterize.underscore
6
6
  unique_id = options.except(:model).hash.abs
7
7
 
8
8
  html_id = if subject.kind_of?(Symbol)
@@ -56,6 +56,17 @@ module EffectiveFormBuilderHelper
56
56
  # Assign default ID
57
57
  options[:id] ||= (options[:html].delete(:id) || html_id) unless options.key?(:id)
58
58
 
59
+ # Assign url if engine present
60
+ options[:url] ||= if options[:engine] && options[:model].present?
61
+ resource = Effective::Resource.new(options[:model])
62
+
63
+ if subject.respond_to?(:persisted?) && subject.persisted?
64
+ resource.action_path(:update, subject)
65
+ elsif subject.respond_to?(:new_record?) && subject.new_record?
66
+ resource.action_path(:create)
67
+ end
68
+ end
69
+
59
70
  without_error_proc do
60
71
  form_with(**options.merge(builder: Effective::FormBuilder), &block)
61
72
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.9.8'.freeze
2
+ VERSION = '0.9.9'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-09 00:00:00.000000000 Z
11
+ date: 2020-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -668,7 +668,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
668
668
  - !ruby/object:Gem::Version
669
669
  version: '0'
670
670
  requirements: []
671
- rubygems_version: 3.1.4
671
+ rubygems_version: 3.1.2
672
672
  signing_key:
673
673
  specification_version: 4
674
674
  summary: Everything you need to get set up with bootstrap 4.