effective_datatables 3.3.3 → 3.3.4

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
  SHA1:
3
- metadata.gz: 8245b3e64597822fd3608577b0d198b645743bbf
4
- data.tar.gz: 2bab04a7e1dbacbb782c78084c5122e8297cf28e
3
+ metadata.gz: 3a4540891ea565b13ae981a76c6f66cab9db27dc
4
+ data.tar.gz: 2f9bdac71e4ebe1633a4155e2e80f6f1c7108d16
5
5
  SHA512:
6
- metadata.gz: 8e57129d7124e7096e47b90260ed6fb6d9393c90cc863ccac05f26df52c6a38219badd9ad0a0b88392f391ad8f0438b302594586d14852b6f243a894cfd168e9
7
- data.tar.gz: dde278cf7dcb86fefab899db6c8f234698cdb22f71ea51fa797cadcef2999324c13e17fab7ddea71d315514ad33ae15fe7f81b58f2e0e7be21ea7551cb95667a
6
+ metadata.gz: f4ac68ad4047dc1fb880a5f605d446fa64919cb5a0613f6531b3899028cb216b245c2f9de60b692099550792fdd9cdb9d443f50b8b9425a6bbef4233b6605677
7
+ data.tar.gz: a5eaf8683a46485d5dbd3d80967fa21ed32280dad8223284cf1cefbdf3633ae129bd71d2619567fb233b01c68c960a5c002228a746647f7c7f893d85458c2e17
@@ -71,6 +71,15 @@ module EffectiveDatatablesPrivateHelper
71
71
  date_linked: false,
72
72
  input_js: { useStrict: true, keepInvalid: true }
73
73
  # Keep invalid format like "2015-11" so we can still search by year, month or day
74
+ when :time
75
+ form.input name, label: false, required: false, value: value,
76
+ as: (ActionView::Helpers::FormBuilder.instance_methods.include?(:effective_time_picker) ? :effective_time_picker : :string),
77
+ placeholder: placeholder,
78
+ wrapper_html: wrapper_html,
79
+ input_group: false,
80
+ input_html: input_html,
81
+ date_linked: false,
82
+ input_js: { useStrict: false, keepInvalid: true }
74
83
  when :select, :boolean
75
84
  form.input name, label: false, required: false, value: value,
76
85
  as: (ActionView::Helpers::FormBuilder.instance_methods.include?(:effective_select) ? :effective_select : :select),
@@ -112,6 +112,8 @@ module Effective
112
112
  end
113
113
  )
114
114
  obj >= term && obj <= end_at
115
+ when :time
116
+ (obj.hour == term.hour) && (term.min == 0 ? true : (obj.min == term.min))
115
117
  when :decimal, :currency
116
118
  if fuzzy && (term.round(0) == term) && value.to_s.include?('.') == false
117
119
  if term < 0
@@ -176,6 +178,8 @@ module Effective
176
178
  raise 'unsupported'
177
179
  elsif obj.respond_to?(column[:name])
178
180
  obj.send(column[:name])
181
+ elsif column[:as] == :time && obj.respond_to?(:strftime)
182
+ (@_column_as_time ||= Time.zone.now.beginning_of_day) + ((1.hour * obj.hour) + (1.minute * obj.min)) # For search/order by time
179
183
  else
180
184
  obj
181
185
  end
@@ -94,6 +94,8 @@ module Effective
94
94
  when Integer ; view.number_to_currency(value / 100.0) # an Integer representing the number of cents
95
95
  when Numeric ; view.number_to_currency(value)
96
96
  end
97
+ when :time
98
+ (value.strftime('%H:%M') rescue BLANK)
97
99
  else
98
100
  value.to_s
99
101
  end
@@ -39,6 +39,7 @@ module Effective
39
39
 
40
40
  if opts[:resource].column(field)
41
41
  opts[:as] ||= opts[:resource].sql_type(field)
42
+ opts[:as] = :integer if opts[:resource].sql_type(field) == :belongs_to && field.end_with?('_id')
42
43
  opts[:sql_column] = opts[:resource].sql_column(field) if opts[:sql_column].nil?
43
44
 
44
45
  opts[:resource].sort_column = field
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '3.3.3'.freeze
2
+ VERSION = '3.3.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.3
4
+ version: 3.3.4
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: 2017-10-20 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails