effective_bootstrap 1.17.5 → 1.17.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b2a7d47bccf1fd227f588ae7ea5d25375a00536fee1bccae10e9b8abdac8eb4
|
4
|
+
data.tar.gz: aa117408de621d35fb3ddb31740eef7c5693e13e7fed704a1d5f5235fd068482
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9049537bfb8755953bba4fc5f225a98fbbdd079bd06f16f4d96dd3258378d73cc74de896873846e5e1e7ca7e433c3f940a1c57b722622d29bba7f5eead5a2ada
|
7
|
+
data.tar.gz: 0d6d9e1db87a4a08f429f18954a5db491b8977dfe6c17de740b238de2fe81eedc3692037c27a796f52467d5b66889105504a1d912a6bda136d76e8f1a2f1b37a
|
@@ -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.17.
|
4
|
+
version: 1.17.6
|
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: 2023-11-
|
11
|
+
date: 2023-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|