active_scaffold 3.4.42 → 3.4.43

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: 5aecf180e9830138a0201706df7188764f0b9883
4
- data.tar.gz: bdd48e47cb5e3e89d68b276c2b0d34b10ea5b672
3
+ metadata.gz: 4c89a2575bfac755ce70fde2774b15e2a4ee4290
4
+ data.tar.gz: 47f69051b49d59a150b04c81c74d151452d1c629
5
5
  SHA512:
6
- metadata.gz: fb10543e6069522af0f3c29f478af48beb4576f8e4a5238c229b7d23bdf7abea0f668c8fdfb60dfd2aab150042ae9b9ee6c8e84feb5832863ebb5b056bb41abc
7
- data.tar.gz: d535738279bf832a6c7af0a402187440ea7ac4898a7e14b3a0d3d5b636b47b060e2e71ce3c60433ca9aebb06abb285700a8fb771c677fe1ca231e34655b7b0c8
6
+ metadata.gz: b8ac30db93e48681891cea00067f401ac8327f7ec139c38d8e5cccebbb493a7e5bbc535a5c1536d0666c768e60032de15f604b7c98274e02df0716c2d49f8304
7
+ data.tar.gz: f0f0300ea76e0a5c78e8839d2d3a18eb47f99f076319988f187992c95f05c1a40e4b0e3e8dbe46ab9861a34c97c4dffbbf488959ca085289370a56fe30e283ca
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ = 3.4.43
2
+ - Fix human conditions for date and datetime columns, not using date picker
3
+
1
4
  = 3.4.42
2
5
  - fix do_refresh_list on actions with GET route, it used :id and :action from request for sorting and pagination links
3
6
  - Fix for using jquery-ui-rails 6.0
@@ -138,7 +138,8 @@ module ActiveScaffold
138
138
 
139
139
  def condition_value_for_datetime(column, value, conversion = :to_time)
140
140
  if value.is_a? Hash
141
- Time.zone.local(*[:year, :month, :day, :hour, :minute, :second].collect { |part| value[part].to_i }) rescue nil
141
+ time = Time.zone.local(*[:year, :month, :day, :hour, :minute, :second].collect { |part| value[part].to_i }) rescue nil
142
+ time.send(conversion) if time
142
143
  elsif value.respond_to?(:strftime)
143
144
  if conversion == :to_time
144
145
  # Explicitly get the current zone, because TimeWithZone#to_time in rails 3.2.3 returns UTC.
@@ -17,6 +17,7 @@ module ActiveScaffold
17
17
 
18
18
  def format_human_condition(column, opt, from = nil, to = nil)
19
19
  attribute = column.active_record_class.human_attribute_name(column.name)
20
+ opt ||= from && to ? :between : (from ? :'>=' : :'<=')
20
21
  "#{attribute} #{as_(opt).downcase} #{from} #{to}"
21
22
  end
22
23
 
@@ -36,8 +37,10 @@ module ActiveScaffold
36
37
 
37
38
  def active_scaffold_human_condition_date(column, value)
38
39
  conversion = column.column.type == :date ? :to_date : :to_time
39
- from = I18n.l controller.condition_value_for_datetime(column, value['from'], conversion)
40
- to = "- #{I18n.l controller.condition_value_for_datetime(column, value['to'], conversion)}" if value['opt'] == 'BETWEEN'
40
+ from = controller.class.condition_value_for_datetime(column, value['from'], conversion)
41
+ from = I18n.l from if from
42
+ to = controller.class.condition_value_for_datetime(column, value['to'], conversion) if value['opt'] == 'BETWEEN' || (value['opt'].nil? && value['to'])
43
+ to = "- #{I18n.l to}" if to
41
44
  format_human_condition column, value['opt'], from, to
42
45
  end
43
46
  alias_method :active_scaffold_human_condition_time, :active_scaffold_human_condition_date
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 4
5
- PATCH = 42
5
+ PATCH = 43
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.42
4
+ version: 3.4.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Many, see README
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-20 00:00:00.000000000 Z
11
+ date: 2017-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails