just-datetime-picker 0.0.1 → 0.0.2
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.
- data/README.rdoc +16 -3
- data/Rakefile +1 -1
- data/lib/just-datetime-picker/activerecord.rb +3 -3
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Introduction
|
2
2
|
|
3
|
-
This is a simple gem for Active Admin that just
|
3
|
+
This is a simple gem for Active Admin that just adds support for Date/Time picker.
|
4
4
|
|
5
5
|
Screenshot[https://raw.github.com/saepia/just-datetime-picker/master/doc/just-datetime-picker.png]
|
6
6
|
|
@@ -78,9 +78,12 @@ Once you have the source, you can unpack it and use from wherever you downloaded
|
|
78
78
|
|
79
79
|
== Assets
|
80
80
|
|
81
|
+
=== CSS
|
82
|
+
|
81
83
|
You can try to run rails g just:date_time:install to install default CSS,
|
82
|
-
but I found that
|
83
|
-
|
84
|
+
but I found that method sometimes does not work.
|
85
|
+
|
86
|
+
In such case, just append the following code to your CSS stylesheet:
|
84
87
|
|
85
88
|
.input.just_datetime_picker input.just-datetime-picker-field {
|
86
89
|
width: auto !important;
|
@@ -98,6 +101,16 @@ the following to your CSS:
|
|
98
101
|
margin-left: 1ex;
|
99
102
|
}
|
100
103
|
|
104
|
+
=== JavaScript
|
105
|
+
|
106
|
+
If you use nested set and dynamically create date or date/time pickers,
|
107
|
+
they {won't be active by default due to bug in Active Admin}[https://github.com/sferik/rails_admin/issues/1309].
|
108
|
+
|
109
|
+
You can use following script to overcome that problem:
|
110
|
+
|
111
|
+
$('a.button').live('click', function() {
|
112
|
+
$('input.datepicker:not(.hasDatepicker)').datepicker();
|
113
|
+
});
|
101
114
|
|
102
115
|
= Additional info
|
103
116
|
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'jeweler'
|
4
4
|
Jeweler::Tasks.new do |s|
|
5
5
|
s.name = "just-datetime-picker"
|
6
|
-
s.version = '0.0.
|
6
|
+
s.version = '0.0.2'
|
7
7
|
s.authors = ["Marcin Lewandowski"]
|
8
8
|
s.email = ["marcin@saepia.net"]
|
9
9
|
s.summary = %q{Gem that just creates date/time picker in active admin and propably any other formtastic-based form}
|
@@ -22,9 +22,9 @@ module Just
|
|
22
22
|
attr_reader "#{field_name}_time_hour"
|
23
23
|
attr_reader "#{field_name}_time_minute"
|
24
24
|
|
25
|
-
validates "#{field_name}_date", :just_date => true
|
26
|
-
validates "#{field_name}_time_hour", :numericality => { :only_integer => true, :greater_than_or_equal_to => 0, :less_than_or_equal_to => 23, :message => :just_datetime_invalid_time_hour }
|
27
|
-
validates "#{field_name}_time_minute", :numericality => { :only_integer => true, :greater_than_or_equal_to => 0, :less_than_or_equal_to => 59, :message => :just_datetime_invalid_time_minute }
|
25
|
+
validates "#{field_name}_date", :just_date => true, :allow_nil => true, :allow_blank => false
|
26
|
+
validates "#{field_name}_time_hour", :numericality => { :only_integer => true, :greater_than_or_equal_to => 0, :less_than_or_equal_to => 23, :message => :just_datetime_invalid_time_hour }, :allow_nil => true, :allow_blank => false
|
27
|
+
validates "#{field_name}_time_minute", :numericality => { :only_integer => true, :greater_than_or_equal_to => 0, :less_than_or_equal_to => 59, :message => :just_datetime_invalid_time_minute }, :allow_nil => true, :allow_blank => false
|
28
28
|
|
29
29
|
after_validation do
|
30
30
|
date_attribute = "#{field_name}_date".to_sym
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: just-datetime-picker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: formtastic
|