effective_bootstrap 1.17.5 → 1.18.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f108af647fe5377a1a8b0c71657edf747663a045dd5345008e6ec7ddda4f14e
|
4
|
+
data.tar.gz: ca2ea08eea2b92e8da0c8220b922b54c6a33e6d436293278430cd80847d3347c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eedfda5683d8abe00fafdbed95880b14edf62f923dd3821df4f7e376ae27f7bbb856665d8c16c167684f29cc79d2d393d3890390e942121274fdea4a6763c47b
|
7
|
+
data.tar.gz: da741870ca44ad5c0d16c643e742967cb85128d1c5674c0be7ee2c3592b0292a262f78f2e0641b29b9f61521e0afecf33ab4e65658a9cc09af18dd08a0710f91
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module EffectiveFormBuilderHelper
|
4
|
-
def effective_form_with(**options, &block)
|
4
|
+
def effective_form_with(model: nil, scope: nil, url: nil, format: nil, **options, &block)
|
5
5
|
# This allows us to call effective_form_with inside an effective_table_with and just get the fields
|
6
6
|
return @_effective_table_builder.capture(&block) if @_effective_table_builder
|
7
7
|
|
8
8
|
# Compute the default ID
|
9
|
-
subject = Array(
|
10
|
-
class_name = (
|
9
|
+
subject = Array(model || scope).last
|
10
|
+
class_name = (scope || subject.class.name.parameterize.underscore)
|
11
11
|
unique_id = options.except(:model).hash.abs
|
12
12
|
|
13
13
|
html_id = if subject.kind_of?(Symbol)
|
@@ -63,8 +63,8 @@ module EffectiveFormBuilderHelper
|
|
63
63
|
options[:id] ||= (options[:html].delete(:id) || html_id) unless options.key?(:id)
|
64
64
|
|
65
65
|
# Assign url if engine present
|
66
|
-
|
67
|
-
resource = Effective::Resource.new(
|
66
|
+
url ||= if options[:engine] && model.present?
|
67
|
+
resource = Effective::Resource.new(model)
|
68
68
|
|
69
69
|
if subject.respond_to?(:persisted?) && subject.persisted?
|
70
70
|
resource.action_path(:update, subject)
|
@@ -74,7 +74,7 @@ module EffectiveFormBuilderHelper
|
|
74
74
|
end
|
75
75
|
|
76
76
|
without_error_proc do
|
77
|
-
form_with(**options.merge(builder: Effective::FormBuilder), &block)
|
77
|
+
form_with(model: model, scope: scope, url: url, format: format, **options.merge(builder: Effective::FormBuilder), &block)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -245,29 +245,29 @@ module Effective
|
|
245
245
|
def required_options?(opts)
|
246
246
|
return true unless (opts.key?(:if) || opts.key?(:unless))
|
247
247
|
|
248
|
-
if opts[:if].respond_to?(:call)
|
249
|
-
|
250
|
-
end
|
248
|
+
# if opts[:if].respond_to?(:call)
|
249
|
+
# return object.instance_exec(object, &opts[:if])
|
250
|
+
# end
|
251
251
|
|
252
|
-
if opts[:if].kind_of?(Symbol)
|
253
|
-
|
254
|
-
end
|
252
|
+
# if opts[:if].kind_of?(Symbol)
|
253
|
+
# return object.send(opts[:if])
|
254
|
+
# end
|
255
255
|
|
256
|
-
if opts.key?(:if)
|
257
|
-
|
258
|
-
end
|
256
|
+
# if opts.key?(:if)
|
257
|
+
# return opts[:if]
|
258
|
+
# end
|
259
259
|
|
260
|
-
if opts[:unless].respond_to?(:call)
|
261
|
-
|
262
|
-
end
|
260
|
+
# if opts[:unless].respond_to?(:call)
|
261
|
+
# return !object.instance_exec(&opts[:unless])
|
262
|
+
# end
|
263
263
|
|
264
|
-
if opts[:unless].kind_of?(Symbol)
|
265
|
-
|
266
|
-
end
|
264
|
+
# if opts[:unless].kind_of?(Symbol)
|
265
|
+
# return !object.send(opts[:unless])
|
266
|
+
# end
|
267
267
|
|
268
|
-
if opts.key?(:unless)
|
269
|
-
|
270
|
-
end
|
268
|
+
# if opts.key?(:unless)
|
269
|
+
# return !opts[:unless]
|
270
|
+
# end
|
271
271
|
|
272
272
|
false
|
273
273
|
end
|
@@ -144,7 +144,7 @@ module Effective
|
|
144
144
|
fields = block.call(form)
|
145
145
|
|
146
146
|
remove += form.super_hidden_field(:_destroy) if remove? && can_remove && resource.persisted?
|
147
|
-
reorder += form.super_hidden_field(:position) if reorder? && !fields.include?('][position]')
|
147
|
+
reorder += form.super_hidden_field(:position) if reorder? && !fields.to_s.include?('][position]')
|
148
148
|
|
149
149
|
fields
|
150
150
|
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: 1.
|
4
|
+
version: 1.18.0
|
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:
|
11
|
+
date: 2024-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|