bmc 1.4.2 → 1.5.0

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: 76fecfb84df0ecc80387ef64b76d6042594473fd93bce1ad0a9dfdcb3530574b
4
- data.tar.gz: bc953b87c09e7b152e609398a53cc4893ca8b748805d84a05020ed5afa0b900f
3
+ metadata.gz: 66917c46eb778377885fb86604c50632bc8e9d9c51a2974da48ffb4a30417567
4
+ data.tar.gz: d53cf1ba56317ebe9789806270a408441690cc55d28ef87b9d0f4f3a0d7e9a64
5
5
  SHA512:
6
- metadata.gz: f78df23115e0bb884a5a3d255022f7b17cc1a052b8de20ff03200f894235615b8e3c94b317e293e77a0aa067e07a8c95a442492e87b633e51e0ff0d864e67cba
7
- data.tar.gz: 8f8c25277438fa515c0b219eaf089365404ae3f788bbd62f2531ab96bbbf8dee5c01a52a9995d0f832bdadf01f48d1a594b60940272bdee3833f30ca1b105ff4
6
+ metadata.gz: 6a38bde69e6cc4a9ad5187eade8fecd53f76d193d36d417a67c1eb46c1ac9283d3d94d6a3f473ac3d0ba4dc97e4bcaf60e1dcff0103c3e9c9d9673a46d705c1e
7
+ data.tar.gz: 1dcc4a6a907c341dc93e36ab4f7bb81821f92523f8b86b4caa2fc854a76c334767ce49e437fcdc87c7c1bb73d30e4fd9b5eef774925375862d48b3a8f2ac1ac4
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## v1.5.0
6
+ - Use Turbo instead of rails-ujs by default
7
+
8
+ ## v1.4.3
9
+ - Rails 7.1
10
+
5
11
  ## v1.4.2
6
12
  - Add customizable placeholder to `search_form`
7
13
 
@@ -1,2 +0,0 @@
1
- //= link_directory ../javascripts/bmc .js
2
- //= link_directory ../stylesheets/bmc .css
@@ -14,9 +14,9 @@ class BMC::Filter::ByKeyValue
14
14
 
15
15
  column = column_for(query)
16
16
 
17
- if value.to_s.in?(%w(nil null))
17
+ if value.to_s.in?(%w[nil null])
18
18
  query.where("#{column} IS NULL")
19
- elsif value.to_s.in?(%w(not_nil not_null))
19
+ elsif value.to_s.in?(%w[not_nil not_null])
20
20
  query.where("#{column} IS NOT NULL")
21
21
  else
22
22
  query.where("#{column} = ?", value)
@@ -9,6 +9,14 @@ module BMC::ButtonHelper
9
9
  def default_style
10
10
  @default_style ||= :outline_primary
11
11
  end
12
+
13
+ def confirm_attribute
14
+ @confirm_attribute ||= :"data-turbo-confirm"
15
+ end
16
+
17
+ def method_attribute
18
+ @method_attribute ||= :"data-turbo-method"
19
+ end
12
20
  end
13
21
 
14
22
  def bs_button( # rubocop:disable Metrics/ParameterLists
@@ -30,7 +38,12 @@ module BMC::ButtonHelper
30
38
  content = fa_s(icon).concat(" ").concat(tag.span(text, class: "text"))
31
39
 
32
40
  if method != :get
33
- options[:method] = method
41
+ if helper == :link_to
42
+ options[BMC::ButtonHelper.method_attribute] = method
43
+ options[:rel] = "nofollow"
44
+ elsif helper == :button_to
45
+ options[:method] = method
46
+ end
34
47
  confirm = true if confirm.nil?
35
48
  end
36
49
 
@@ -48,7 +61,7 @@ module BMC::ButtonHelper
48
61
 
49
62
  unless confirm.nil?
50
63
  confirm = ta(:confirm) if confirm == true
51
- options.deep_merge!(data: {confirm: confirm})
64
+ options[BMC::ButtonHelper.confirm_attribute] = confirm
52
65
  end
53
66
 
54
67
  public_send(helper, content, url, options.sort.to_h)
@@ -21,7 +21,7 @@ module BMC::SetupJobConcern
21
21
  end
22
22
 
23
23
  attrs.length.times do |i|
24
- instance_variable_set("@#{attrs[i]}", args[i])
24
+ instance_variable_set(:"@#{attrs[i]}", args[i])
25
25
  end
26
26
  end
27
27
  end
@@ -5,7 +5,7 @@ module BMC::DefaultValuesConcern
5
5
  end
6
6
 
7
7
  def assign_default(attribute, value)
8
- send("#{attribute}=", value) if send(attribute).nil?
8
+ send(:"#{attribute}=", value) if send(attribute).nil?
9
9
  end
10
10
 
11
11
  included do
@@ -1,6 +1,6 @@
1
1
  module BMC::ModelToS
2
2
  def to_s
3
- %w(name title label).map do |m|
3
+ %w[name title label].map do |m|
4
4
  return send(m) if respond_to?(m)
5
5
  end
6
6
 
@@ -20,7 +20,7 @@ module BMC::Search
20
20
  }.join(" OR ")
21
21
  }.map { |e| "(#{e})" }.join(" AND ")
22
22
 
23
- sql_params = words.map.with_index { |word, index| ["w#{index}".to_sym, "%#{word}%"] }.to_h
23
+ sql_params = words.map.with_index { |word, index| [:"w#{index}", "%#{word}%"] }.to_h
24
24
 
25
25
  where(sql_query, sql_params)
26
26
  end # def search
@@ -2,9 +2,9 @@ module BMC::ActiveModelTypeCast
2
2
  module Decimal
3
3
  def cast_value(value)
4
4
  if value.is_a?(String)
5
- super value.tr(",", ".").gsub(/[^-0-9.]/, "")
5
+ super(value.tr(",", ".").gsub(/[^-0-9.]/, ""))
6
6
  else
7
- super value
7
+ super(value)
8
8
  end
9
9
  end
10
10
  end
@@ -19,9 +19,9 @@ module BMC::ActiveModelTypeCast
19
19
 
20
20
  def cast_value(value)
21
21
  if sanitizable?(value)
22
- super sanitize(value)
22
+ super(sanitize(value))
23
23
  else
24
- super value
24
+ super(value)
25
25
  end
26
26
  end
27
27
 
@@ -41,7 +41,7 @@ module BMC::ActiveModelTypeCast
41
41
  module Boolean
42
42
  def cast_value(value)
43
43
  value = value.strip if value.is_a?(String)
44
- super value
44
+ super(value)
45
45
  end
46
46
  end
47
47
  end
@@ -3,7 +3,7 @@ module BMC::FormBackUrl
3
3
  tag.input(
4
4
  :type => "hidden",
5
5
  :name => "back_url",
6
- :value => (params[:back_url].presence || request.referer),
6
+ :value => params[:back_url].presence || request.referer,
7
7
  )
8
8
  end
9
9
 
data/lib/bmc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module BMC
2
- VERSION = "1.4.2"
2
+ VERSION = "1.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bmc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benoit MARTIN-CHAVE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-01 00:00:00.000000000 Z
11
+ date: 2024-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails-i18n
@@ -230,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
230
  - !ruby/object:Gem::Version
231
231
  version: '0'
232
232
  requirements: []
233
- rubygems_version: 3.4.10
233
+ rubygems_version: 3.5.6
234
234
  signing_key:
235
235
  specification_version: 4
236
236
  summary: BMC