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: 2c64c14e776a0ac77215a2f959501bb99fd2f9fa1c5e61153ee17bf312de92f5
4
- data.tar.gz: f424ca3d20d69148e10d4da63713b57c56de2545c05296c1af55ed3b1685b545
3
+ metadata.gz: 3b2a7d47bccf1fd227f588ae7ea5d25375a00536fee1bccae10e9b8abdac8eb4
4
+ data.tar.gz: aa117408de621d35fb3ddb31740eef7c5693e13e7fed704a1d5f5235fd068482
5
5
  SHA512:
6
- metadata.gz: 647c8bd55eb7f33901ad665b26874142ebf99dc944c208f7ae9a1fd0055a611fb92086c8c6294e9a86821721f2d9548283ff48605e02e9ec4b11c983da84b4ba
7
- data.tar.gz: b9ee04bbd4c0e123da289cdb359ea3879b80bca4408ac88f4710aac56a95914e9df4555613f046eac97a6440acf9770ed10c79cd4d565435fb4909e05d2923e5
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(options[:model] || options[:scope]).last
10
- class_name = (options[:scope] || subject.class.name.parameterize.underscore)
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
- options[:url] ||= if options[:engine] && options[:model].present?
67
- resource = Effective::Resource.new(options[:model])
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
- return object.instance_exec(&opts[:if])
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
- return object.send(opts[:if])
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
- return opts[:if]
258
- end
256
+ # if opts.key?(:if)
257
+ # return opts[:if]
258
+ # end
259
259
 
260
- if opts[:unless].respond_to?(:call)
261
- return !object.instance_exec(&opts[:unless])
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
- return !object.send(opts[:unless])
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
- return !opts[:unless]
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
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '1.17.5'.freeze
2
+ VERSION = '1.17.6'.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: 1.17.5
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-27 00:00:00.000000000 Z
11
+ date: 2023-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails