effective_bootstrap 0.9.8 → 0.9.9
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 +4 -4
- data/app/helpers/effective_form_builder_helper.rb +12 -1
- data/lib/effective_bootstrap/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2db71ddfb367e9c0aba19eb1b05cd145a4cef6743bc63151ca7eb9c118c313c9
|
4
|
+
data.tar.gz: 823eea41c096624761741d233d39db5431824f2a37e43f2e0797c0bc91c8cf54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
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-
|
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.
|
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.
|