bmc 1.4.3 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/app/filters/bmc/filter/by_key_value.rb +2 -2
- data/app/filters/bmc/filter.rb +3 -2
- data/app/helpers/bmc/button_helper.rb +16 -3
- data/app/jobs/concerns/bmc/setup_job_concern.rb +1 -1
- data/app/models/concerns/bmc/default_values_concern.rb +1 -1
- data/app/models/concerns/bmc/model_to_s.rb +1 -1
- data/app/models/concerns/bmc/search.rb +1 -1
- data/app/sorters/bmc/sorter.rb +5 -4
- data/lib/bmc/active_model_type_cast.rb +5 -5
- data/lib/bmc/form_back_url.rb +1 -1
- data/lib/bmc/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: 4b45ace9fe342248cb63e77ac701779ed69c5d6bf05ff3f0b0e2b23a7b46665b
|
4
|
+
data.tar.gz: 057b8aacdcd98a348b54276233b0a5ffc353580e79256c4d05c700c402779d55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 222d61f28a75cf0699935d6272599737ac4eb9c984b5f6012c8b174f593c2eae007d91a758d1a33f67f23d2bc8b13ceb9009979e45317d758dbd184600db19ff
|
7
|
+
data.tar.gz: 6f51eeb1722bf8bc536871700f4e633157e29f100f2677de68fc174cd93e30508511e2087b0aad626de55c7f77789d8d648bf3a982a90ec8a517b426ea763b46
|
data/CHANGELOG.md
CHANGED
@@ -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
|
17
|
+
if value.to_s.in?(%w[nil null])
|
18
18
|
query.where("#{column} IS NULL")
|
19
|
-
elsif value.to_s.in?(%w
|
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)
|
data/app/filters/bmc/filter.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module BMC::ButtonHelper
|
2
2
|
class << self
|
3
|
-
attr_writer :default_size, :default_style
|
3
|
+
attr_writer :default_size, :default_style, :confirm_attribute, :method_attribute
|
4
4
|
|
5
5
|
def default_size
|
6
6
|
@default_size ||= :sm
|
@@ -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
|
-
|
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.
|
64
|
+
options[BMC::ButtonHelper.confirm_attribute] = confirm
|
52
65
|
end
|
53
66
|
|
54
67
|
public_send(helper, content, url, options.sort.to_h)
|
@@ -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}"
|
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
|
data/app/sorters/bmc/sorter.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
class BMC::Sorter
|
2
2
|
include BMC::SortingHelper
|
3
3
|
|
4
|
-
attr_reader :collection, :sort_param, :column, :direction
|
4
|
+
attr_reader :collection, :sort_param, :options, :column, :direction
|
5
5
|
|
6
6
|
def self.call(...)
|
7
7
|
new(...).call
|
8
8
|
end
|
9
9
|
|
10
|
-
def initialize(collection, sort_param =
|
11
|
-
@collection
|
12
|
-
@sort_param
|
10
|
+
def initialize(collection, sort_param, options = {})
|
11
|
+
@collection = collection
|
12
|
+
@sort_param = sort_param
|
13
|
+
@options = options
|
13
14
|
@column, @direction = sortable_column_order(sort_param.to_s)
|
14
15
|
end
|
15
16
|
|
@@ -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
|
5
|
+
super(value.tr(",", ".").gsub(/[^-0-9.]/, ""))
|
6
6
|
else
|
7
|
-
super
|
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
|
22
|
+
super(sanitize(value))
|
23
23
|
else
|
24
|
-
super
|
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
|
44
|
+
super(value)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
data/lib/bmc/form_back_url.rb
CHANGED
data/lib/bmc/version.rb
CHANGED
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
|
+
version: 1.5.1
|
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:
|
11
|
+
date: 2024-04-11 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.
|
233
|
+
rubygems_version: 3.5.6
|
234
234
|
signing_key:
|
235
235
|
specification_version: 4
|
236
236
|
summary: BMC
|