just-datetime-picker 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -137,6 +137,10 @@ This code is licensed under GPLv3[http://www.gnu.org/licenses/gpl.html].
137
137
 
138
138
  == ChangeLog
139
139
 
140
+ === 0.0.4 (September 28, 2012)
141
+
142
+ * Fixed bug that caused "Invalid date" error if date field was empty which effectively made all date/time picker fields required, even if there were no associated validations ({Marcin Lewandowski}[https://github.com/saepia])
143
+
140
144
  === 0.0.3 (September 21, 2012)
141
145
 
142
146
  * Added mongoid[http://www.mongoid.org] support (doabit[https://github.com/doabit] & {Marcin Lewandowski}[https://github.com/saepia])
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |gem|
3
- gem.authors = ["Marcin Lewandowski"]
3
+ gem.authors = ["Marcin Lewandowski", "doabit"]
4
4
  gem.email = ["marcin@saepia.net"]
5
5
  gem.description = %q{Gem that just creates date/time picker in Active Admin forms}
6
6
  gem.summary = %q{Gem that just creates date/time picker in Active Admin forms}
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
12
12
  gem.name = "just-datetime-picker"
13
13
  gem.require_paths = ["lib"]
14
- gem.version = '0.0.3'
14
+ gem.version = '0.0.4'
15
15
  gem.add_dependency 'formtastic', '>= 2.0.0'
16
16
  gem.add_dependency 'activeadmin', '>= 0.5.0'
17
17
  end
@@ -6,6 +6,9 @@ module Just
6
6
 
7
7
  class JustDateValidator < ActiveModel::EachValidator
8
8
  def validate_each(record, attribute, value)
9
+ return if value.nil?
10
+ return if value.to_s.empty?
11
+
9
12
  begin
10
13
  Date.parse(value)
11
14
  rescue ArgumentError
@@ -66,16 +69,22 @@ module Just
66
69
  end
67
70
 
68
71
  define_method "#{field_name}_date=" do |v|
72
+ return if v.to_s.empty?
73
+
69
74
  instance_variable_set("@#{field_name}_date", v)
70
75
  just_combine_datetime field_name
71
76
  end
72
77
 
73
78
  define_method "#{field_name}_time_hour=" do |v|
79
+ return if v.to_s.empty?
80
+
74
81
  instance_variable_set("@#{field_name}_time_hour", v.to_i)
75
82
  just_combine_datetime field_name
76
83
  end
77
84
 
78
85
  define_method "#{field_name}_time_minute=" do |v|
86
+ return if v.to_s.empty?
87
+
79
88
  instance_variable_set("@#{field_name}_time_minute", v.to_i)
80
89
  just_combine_datetime field_name
81
90
  end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: just-datetime-picker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Marcin Lewandowski
9
+ - doabit
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2012-09-21 00:00:00.000000000 Z
13
+ date: 2012-09-28 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: formtastic
@@ -82,18 +83,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
83
  - - ! '>='
83
84
  - !ruby/object:Gem::Version
84
85
  version: '0'
85
- segments:
86
- - 0
87
- hash: 3099708817768725854
88
86
  required_rubygems_version: !ruby/object:Gem::Requirement
89
87
  none: false
90
88
  requirements:
91
89
  - - ! '>='
92
90
  - !ruby/object:Gem::Version
93
91
  version: '0'
94
- segments:
95
- - 0
96
- hash: 3099708817768725854
97
92
  requirements: []
98
93
  rubyforge_project:
99
94
  rubygems_version: 1.8.24