azahara_schema 0.1.16 → 0.1.17

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: a243c727640b3870ddb7d121dec13b0f73908f076a3134916919baa6974a55d4
4
- data.tar.gz: 822beaa0827d42da8c1ab255bdc28e6448d1c5ed19647e503e4943b4b7bf403e
3
+ metadata.gz: a14e9a8c3362597472cda8ccc365c47e818fb89f905c8ab6aa682763c329536d
4
+ data.tar.gz: 7b42eaacf12b867c599eaecd3a5d8f5bf6203dbeab5b178b029392a2b4164c98
5
5
  SHA512:
6
- metadata.gz: 4dfb95a06ce4a2ce673e5107e8a8f2caeddb7d1598b8b8e8050c9fd14ba90556125cd09150223787925519819cf0362d5c061adfc9b438267adc49f469f68b0e
7
- data.tar.gz: 4db13b53f6c44d6c1252cd9bd214e115f80851f65b702d0b07d2baae5d5f80289f3c7d5eb29f75c1a6a8c47387d173340bb5abef529933e4fc6de7425eff7d3a
6
+ metadata.gz: b25f86081f3b3985bd4840695d8f41bcc4c673228db1a394df1aa095f106fe82884e33873723a481ae02d6b4881fdac6459e5451981f3d09aad246b65b1aae82
7
+ data.tar.gz: 22da5b868389f86c35e7af515673494416c4a3ac8ecbf25d47a361f7dac30a5b349bdc00a77628dfe760e7cd09b91c5a269b296bb46f34358d72dd8a5bd97178
@@ -19,7 +19,7 @@
19
19
  margin-bottom: 1.5rem;
20
20
  .control-label {
21
21
  // text-align: right;
22
- padding-top: $input-padding-y;
22
+ // padding-top: $input-padding-y;
23
23
  }
24
24
  }
25
25
  }
@@ -69,9 +69,15 @@ module AzaharaSchema
69
69
 
70
70
  # values has to be array!
71
71
  def arel_statement(operator, values)
72
+ values = values.collect{|v| format.sanitize_value(v) }
72
73
  case operator
73
74
  when '='
74
- arel_field.in(values)
75
+ condition = arel_field.in(values.compact) if values.compact.any?
76
+ if values.include?(nil)
77
+ c_nil = arel_field.eq(nil)
78
+ condition = condition ? condition.or(c_nil) : c_nil
79
+ end
80
+ condition
75
81
  when '~'
76
82
  vals = values.collect{|v| v.split }.flatten
77
83
  arl = arel_field.matches("%#{vals[0]}%")
@@ -55,6 +55,10 @@ module AzaharaSchema
55
55
  def searchable?
56
56
  false
57
57
  end
58
+
59
+ def sanitize_value(value)
60
+ value
61
+ end
58
62
  end
59
63
 
60
64
  class NumberFormat < Base
@@ -69,6 +73,10 @@ module AzaharaSchema
69
73
 
70
74
  class IntegerFormat < NumberFormat
71
75
  add 'integer'
76
+
77
+ def sanitize_value(value)
78
+ value.to_s.present? ? value.to_s.to_i : nil
79
+ end
72
80
  end
73
81
 
74
82
  class FloatFormat < NumberFormat
@@ -93,6 +101,10 @@ module AzaharaSchema
93
101
  def searchable?
94
102
  true
95
103
  end
104
+
105
+ def sanitize_value(value)
106
+ value.to_s.presence
107
+ end
96
108
  end
97
109
 
98
110
  class ListFormat < StringFormat
@@ -1,3 +1,3 @@
1
1
  module AzaharaSchema
2
- VERSION = '0.1.16'
2
+ VERSION = '0.1.17'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azahara_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-14 00:00:00.000000000 Z
11
+ date: 2017-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails