visual_condition_builder 0.1.0 → 0.1.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21b282ae1f76851c3fa269f704e7bce918948b35
|
4
|
+
data.tar.gz: ff210a4140a81bb4c3d4da3b3a24df682b0c172f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e74f401deb7f39c547daa37b2fe48a61a3ec8d839fa9fb6b81686ed0efe014b9d4d37533b6bd44206db5a4eb28682685c37b6e2e0e8517a59a4b1ff6bb12c9eb
|
7
|
+
data.tar.gz: 4bbfa1aa0b1ea8033d832710443037963250a6eb70c86ffd0c2b993586adfe818f9dd421a97b56fde09beb7d33f79098197c0b0a19ab10d62e2deee2000f5e6d
|
data/README.md
CHANGED
@@ -27,9 +27,9 @@ en:
|
|
27
27
|
not_start: 'not starts with'
|
28
28
|
end: 'ends with'
|
29
29
|
not_end: 'not ends with'
|
30
|
-
true: 'is true'
|
30
|
+
"true": 'is true'
|
31
31
|
not_true: 'not is true'
|
32
|
-
false: 'is false'
|
32
|
+
"false": 'is false'
|
33
33
|
not_false: 'not is false'
|
34
34
|
present: 'is present '
|
35
35
|
blank: 'is blank'
|
@@ -50,11 +50,15 @@ module VisualConditionBuilder
|
|
50
50
|
if args[:values].present? && args[:values].is_a?(Proc)
|
51
51
|
args[:values] = args[:values].call
|
52
52
|
end
|
53
|
+
if normalized_name(args[:type])==:boolean && args[:label] !~ /\?$/
|
54
|
+
args[:label]+='?'
|
55
|
+
end
|
56
|
+
|
53
57
|
self.dictionaries[@dictionary_name] << args
|
54
58
|
end
|
55
59
|
|
56
60
|
def operators_by_type(type)
|
57
|
-
type = type.present? ? type
|
61
|
+
type = type.present? ? normalized_name(type) : 'string'
|
58
62
|
operators = case type
|
59
63
|
when :date, :datetime
|
60
64
|
[:eq, :between, :today, :yesterday, :tomorrow, :this_week, :last_week, :next_week, :present, :blank]
|
@@ -62,6 +66,8 @@ module VisualConditionBuilder
|
|
62
66
|
[:eq, :between, :present, :blank]
|
63
67
|
when :decimal, :integer
|
64
68
|
[:eq, :between]
|
69
|
+
when :boolean
|
70
|
+
[:true, :false, :present, :blank]
|
65
71
|
when :string
|
66
72
|
[:cont, :eq, :start, :end, :present, :blank]
|
67
73
|
else
|
@@ -133,7 +139,7 @@ module VisualConditionBuilder
|
|
133
139
|
not_null: {no_value: true, multiple: false},
|
134
140
|
}
|
135
141
|
if op.present?
|
136
|
-
(operators[
|
142
|
+
(operators[normalized_name(op)] || {})
|
137
143
|
else
|
138
144
|
operators
|
139
145
|
end
|
@@ -141,7 +147,7 @@ module VisualConditionBuilder
|
|
141
147
|
|
142
148
|
def operator_default(op)
|
143
149
|
op_default = operators_list(op)
|
144
|
-
operator = {operator:
|
150
|
+
operator = {operator: normalized_name(op)}
|
145
151
|
operator.deep_merge!(op_default) if op_default.present?
|
146
152
|
operator
|
147
153
|
end
|
@@ -159,7 +165,7 @@ module VisualConditionBuilder
|
|
159
165
|
array.reduce Hash.new, :merge
|
160
166
|
end
|
161
167
|
|
162
|
-
def
|
168
|
+
def normalized_name(op)
|
163
169
|
op.to_s.downcase.to_sym
|
164
170
|
end
|
165
171
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: visual_condition_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno Porto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A great and easy visual condition builder to your rails project
|
14
14
|
email:
|