date_time_picker 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +21 -21
- data/README.rdoc +72 -72
- data/lib/date_time_picker/date_time_picker_helpers.rb +78 -78
- data/lib/date_time_picker.rb +37 -37
- data/lib/generators/date_time_picker/USAGE +2 -2
- data/lib/generators/date_time_picker/date_time_picker_generator.rb +11 -11
- data/lib/generators/date_time_picker/templates/date_time_picker.rb +2 -2
- data/lib/simple_form/inputs/ui_date_input.rb +4 -4
- data/lib/simple_form/inputs/ui_date_time_input.rb +4 -4
- data/lib/simple_form/inputs/ui_time_input.rb +4 -4
- data/lib/simple_form/inputs_ext.rb +3 -3
- data/test/Rakefile +7 -7
- data/test/app/controllers/application_controller.rb +5 -5
- data/test/app/views/layouts/application.html.erb +12 -12
- data/test/config/application.rb +12 -12
- data/test/config/boot.rb +3 -3
- data/test/config/date_time_picker.yml +1 -1
- data/test/config/environment.rb +5 -5
- data/test/config/environments/test.rb +7 -7
- data/test/config/routes.rb +3 -3
- data/test/config.ru +4 -4
- data/test/script/rails +6 -6
- data/test/spec/application_spec.rb +13 -13
- data/test/spec/spec_helper.rb +4 -4
- data/vendor/assets/i18n/date_time_picker_ca.js +43 -0
- data/vendor/assets/i18n/date_time_picker_cs.js +43 -0
- data/vendor/assets/i18n/date_time_picker_de.js +43 -0
- data/vendor/assets/i18n/date_time_picker_el.js +42 -0
- data/vendor/assets/i18n/date_time_picker_es.js +42 -0
- data/vendor/assets/i18n/date_time_picker_et.js +42 -0
- data/vendor/assets/i18n/date_time_picker_fi.js +43 -0
- data/vendor/assets/i18n/date_time_picker_fr.js +45 -0
- data/vendor/assets/i18n/date_time_picker_gl.js +42 -0
- data/vendor/assets/i18n/date_time_picker_he.js +43 -0
- data/vendor/assets/i18n/date_time_picker_hu.js +43 -0
- data/vendor/assets/i18n/date_time_picker_id.js +42 -0
- data/vendor/assets/i18n/date_time_picker_it.js +43 -0
- data/vendor/assets/i18n/date_time_picker_ja.js +42 -0
- data/vendor/assets/i18n/date_time_picker_ko.js +42 -0
- data/vendor/assets/i18n/date_time_picker_lt.js +42 -0
- data/vendor/assets/i18n/date_time_picker_nl.js +42 -0
- data/vendor/assets/i18n/date_time_picker_no.js +43 -0
- data/vendor/assets/i18n/date_time_picker_pl.js +43 -0
- data/vendor/assets/i18n/date_time_picker_pt-BR.js +42 -0
- data/vendor/assets/i18n/date_time_picker_pt.js +41 -0
- data/vendor/assets/i18n/date_time_picker_ro.js +46 -0
- data/vendor/assets/i18n/date_time_picker_ru.js +42 -0
- data/vendor/assets/i18n/date_time_picker_sk.js +43 -0
- data/vendor/assets/i18n/date_time_picker_sv.js +43 -0
- data/vendor/assets/i18n/date_time_picker_tr.js +42 -0
- data/vendor/assets/i18n/date_time_picker_vi.js +43 -0
- data/vendor/assets/i18n/date_time_picker_zh-CN.js +43 -0
- data/vendor/assets/i18n/date_time_picker_zh-TW.js +43 -0
- data/vendor/assets/javascripts/date_time_picker.js +19 -19
- data/vendor/assets/javascripts/date_time_picker_all.js +1 -1
- data/vendor/assets/timepicker/jquery-ui-timepicker-addon.css +6 -0
- data/vendor/assets/timepicker/jquery-ui-timepicker-addon.js +1326 -0
- metadata +53 -22
data/MIT-LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
Copyright (c) 2011 Artem Rufanov
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
1
|
+
Copyright (c) 2011 Artem Rufanov
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
data/README.rdoc
CHANGED
@@ -1,72 +1,72 @@
|
|
1
|
-
= DateTimePicker
|
2
|
-
|
3
|
-
A library allows to select date and time, which uses jQuery UI.
|
4
|
-
|
5
|
-
== Requirements
|
6
|
-
|
7
|
-
You should have +jquery-rails+ gem installed and require +jquery+ and +jquery-ui+ assets (don't forget to require CSS for your jQuery UI).
|
8
|
-
|
9
|
-
== Installation
|
10
|
-
|
11
|
-
Add this to your Gemfile and run the +bundle+ command
|
12
|
-
|
13
|
-
gem 'date_time_picker'
|
14
|
-
|
15
|
-
Run generator to create initializer
|
16
|
-
|
17
|
-
rails generate date_time_picker
|
18
|
-
|
19
|
-
or create file manually and
|
20
|
-
|
21
|
-
DateTimePicker.activate :simple_form
|
22
|
-
|
23
|
-
You can pass
|
24
|
-
|
25
|
-
== I18n
|
26
|
-
|
27
|
-
By default plugin includes most using locales and you can require them from your application.js or using the helper, but if you want to add your locales
|
28
|
-
or/and change one of them, then just put them into your assets dir.
|
29
|
-
|
30
|
-
== Usage
|
31
|
-
|
32
|
-
To add necessary assets add into your head
|
33
|
-
|
34
|
-
<%= date_time_picker_assets %>
|
35
|
-
|
36
|
-
Or you can add them manually by requiring +date_time_picker+ and +date_time_picker_locale+
|
37
|
-
|
38
|
-
To use the picker inside the form
|
39
|
-
|
40
|
-
<%= f.date_time_picker :datetime %>
|
41
|
-
|
42
|
-
To use it outside the form
|
43
|
-
|
44
|
-
<%= date_time_picker :datetime %>
|
45
|
-
|
46
|
-
To specify special options add them into the end
|
47
|
-
|
48
|
-
<%= t.date_time_picker :datetime, :id => 'input_id', :class => [:class_1, :class_2], :ampm => true %>
|
49
|
-
|
50
|
-
The full list of available options you can find on the {jQuery UI Datepicker docs}[http://docs.jquery.com/UI/Datepicker] and {jQuery UI Timepicker}[http://trentrichardson.com/examples/timepicker/].
|
51
|
-
|
52
|
-
By default plugin uses app locale, but if you want to specify it manually you can do this
|
53
|
-
|
54
|
-
<%= t.date_time_picker :datetime, :locale => :ru %>
|
55
|
-
|
56
|
-
Also available
|
57
|
-
|
58
|
-
<%= date_picker :date_only %>
|
59
|
-
|
60
|
-
<%= time_picker :time_only %>
|
61
|
-
|
62
|
-
== SimpleForm support
|
63
|
-
|
64
|
-
To use the picker inside the form
|
65
|
-
|
66
|
-
<%= f.input :created_at, as: :ui_date_time %>
|
67
|
-
|
68
|
-
Also available
|
69
|
-
|
70
|
-
<%= f.input :created_at, as: :ui_date %>
|
71
|
-
|
72
|
-
<%= f.input :created_at, as: :ui_time %>
|
1
|
+
= DateTimePicker
|
2
|
+
|
3
|
+
A library allows to select date and time, which uses jQuery UI.
|
4
|
+
|
5
|
+
== Requirements
|
6
|
+
|
7
|
+
You should have +jquery-rails+ gem installed and require +jquery+ and +jquery-ui+ assets (don't forget to require CSS for your jQuery UI).
|
8
|
+
|
9
|
+
== Installation
|
10
|
+
|
11
|
+
Add this to your Gemfile and run the +bundle+ command
|
12
|
+
|
13
|
+
gem 'date_time_picker'
|
14
|
+
|
15
|
+
Run generator to create initializer
|
16
|
+
|
17
|
+
rails generate date_time_picker
|
18
|
+
|
19
|
+
or create file manually and activate date_time_picker inside an initializer:
|
20
|
+
|
21
|
+
DateTimePicker.activate :simple_form
|
22
|
+
|
23
|
+
You can pass only :simple_form to the activate method.
|
24
|
+
|
25
|
+
== I18n
|
26
|
+
|
27
|
+
By default plugin includes most using locales and you can require them from your application.js or using the helper, but if you want to add your locales
|
28
|
+
or/and change one of them, then just put them into your assets dir.
|
29
|
+
|
30
|
+
== Usage
|
31
|
+
|
32
|
+
To add necessary assets add into your head
|
33
|
+
|
34
|
+
<%= date_time_picker_assets %>
|
35
|
+
|
36
|
+
Or you can add them manually by requiring +date_time_picker+ and +date_time_picker_locale+
|
37
|
+
|
38
|
+
To use the picker inside the form
|
39
|
+
|
40
|
+
<%= f.date_time_picker :datetime %>
|
41
|
+
|
42
|
+
To use it outside the form
|
43
|
+
|
44
|
+
<%= date_time_picker :datetime %>
|
45
|
+
|
46
|
+
To specify special options add them into the end
|
47
|
+
|
48
|
+
<%= t.date_time_picker :datetime, :id => 'input_id', :class => [:class_1, :class_2], :ampm => true %>
|
49
|
+
|
50
|
+
The full list of available options you can find on the {jQuery UI Datepicker docs}[http://docs.jquery.com/UI/Datepicker] and {jQuery UI Timepicker}[http://trentrichardson.com/examples/timepicker/].
|
51
|
+
|
52
|
+
By default plugin uses app locale, but if you want to specify it manually you can do this
|
53
|
+
|
54
|
+
<%= t.date_time_picker :datetime, :locale => :ru %>
|
55
|
+
|
56
|
+
Also available
|
57
|
+
|
58
|
+
<%= date_picker :date_only %>
|
59
|
+
|
60
|
+
<%= time_picker :time_only %>
|
61
|
+
|
62
|
+
== SimpleForm support
|
63
|
+
|
64
|
+
To use the picker inside the form
|
65
|
+
|
66
|
+
<%= f.input :created_at, as: :ui_date_time %>
|
67
|
+
|
68
|
+
Also available
|
69
|
+
|
70
|
+
<%= f.input :created_at, as: :ui_date %>
|
71
|
+
|
72
|
+
<%= f.input :created_at, as: :ui_time %>
|
@@ -1,78 +1,78 @@
|
|
1
|
-
module DateTimePicker
|
2
|
-
module ViewHelpers
|
3
|
-
|
4
|
-
def self.helper(name, template, method, options) # :nodoc:
|
5
|
-
value = options.delete :value
|
6
|
-
id = options.delete :id
|
7
|
-
classes = options.delete :class
|
8
|
-
case classes
|
9
|
-
when NilClass
|
10
|
-
classes = method
|
11
|
-
when Array
|
12
|
-
classes << method
|
13
|
-
else
|
14
|
-
classes = [classes, method]
|
15
|
-
end
|
16
|
-
locale = options.delete :locale
|
17
|
-
locale ||= I18n.locale
|
18
|
-
template.text_field_tag name, value, :id => id, :class => classes, :data => {:locale => locale, :options => options.to_json}
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.restore_args(args, method)
|
22
|
-
case args.count
|
23
|
-
when 1
|
24
|
-
name = args[0]
|
25
|
-
options = {}
|
26
|
-
when 2
|
27
|
-
name = args[0]
|
28
|
-
options = args[1]
|
29
|
-
else
|
30
|
-
raise ArgumentError.new(args.count)
|
31
|
-
end
|
32
|
-
method = method.to_s.gsub '_', ''
|
33
|
-
return name, options, method
|
34
|
-
end
|
35
|
-
|
36
|
-
module FormHelpers
|
37
|
-
|
38
|
-
def self.included(base)
|
39
|
-
['date_time_picker', 'date_picker', 'time_picker'].each do |method|
|
40
|
-
base.send :define_method, method do |*args|
|
41
|
-
name, options, method = ViewHelpers.restore_args(args, __method__)
|
42
|
-
options[:id] ||= "#{object_name}_#{name}"
|
43
|
-
ViewHelpers.helper("#{object_name}[#{name}]", @template, method, options)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
module TagHelpers
|
51
|
-
|
52
|
-
def self.included(base)
|
53
|
-
['date_time_picker', 'date_picker', 'time_picker'].each do |method|
|
54
|
-
base.send :define_method, method do |*args|
|
55
|
-
name, options, method = ViewHelpers.restore_args(args, __method__)
|
56
|
-
ViewHelpers.helper(name, self, method, options)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
module AssetsHelper
|
64
|
-
|
65
|
-
def date_time_picker_assets(locale = I18n.locale)
|
66
|
-
javascript_include_tag(:date_time_picker_all) + stylesheet_link_tag(:date_time_picker)
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
module ActionView # :nodoc:
|
75
|
-
Helpers::FormBuilder.send :include, DateTimePicker::ViewHelpers::FormHelpers
|
76
|
-
Base.send :include, DateTimePicker::ViewHelpers::TagHelpers
|
77
|
-
Base.send :include, DateTimePicker::ViewHelpers::AssetsHelper
|
78
|
-
end
|
1
|
+
module DateTimePicker
|
2
|
+
module ViewHelpers
|
3
|
+
|
4
|
+
def self.helper(name, template, method, options) # :nodoc:
|
5
|
+
value = options.delete :value
|
6
|
+
id = options.delete :id
|
7
|
+
classes = options.delete :class
|
8
|
+
case classes
|
9
|
+
when NilClass
|
10
|
+
classes = method
|
11
|
+
when Array
|
12
|
+
classes << method
|
13
|
+
else
|
14
|
+
classes = [classes, method]
|
15
|
+
end
|
16
|
+
locale = options.delete :locale
|
17
|
+
locale ||= I18n.locale
|
18
|
+
template.text_field_tag name, value, :id => id, :class => classes, :data => {:locale => locale, :options => options.to_json}
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.restore_args(args, method)
|
22
|
+
case args.count
|
23
|
+
when 1
|
24
|
+
name = args[0]
|
25
|
+
options = {}
|
26
|
+
when 2
|
27
|
+
name = args[0]
|
28
|
+
options = args[1]
|
29
|
+
else
|
30
|
+
raise ArgumentError.new(args.count)
|
31
|
+
end
|
32
|
+
method = method.to_s.gsub '_', ''
|
33
|
+
return name, options, method
|
34
|
+
end
|
35
|
+
|
36
|
+
module FormHelpers
|
37
|
+
|
38
|
+
def self.included(base)
|
39
|
+
['date_time_picker', 'date_picker', 'time_picker'].each do |method|
|
40
|
+
base.send :define_method, method do |*args|
|
41
|
+
name, options, method = ViewHelpers.restore_args(args, __method__)
|
42
|
+
options[:id] ||= "#{object_name}_#{name}"
|
43
|
+
ViewHelpers.helper("#{object_name}[#{name}]", @template, method, options)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
module TagHelpers
|
51
|
+
|
52
|
+
def self.included(base)
|
53
|
+
['date_time_picker', 'date_picker', 'time_picker'].each do |method|
|
54
|
+
base.send :define_method, method do |*args|
|
55
|
+
name, options, method = ViewHelpers.restore_args(args, __method__)
|
56
|
+
ViewHelpers.helper(name, self, method, options)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
module AssetsHelper
|
64
|
+
|
65
|
+
def date_time_picker_assets(locale = I18n.locale)
|
66
|
+
javascript_include_tag(:date_time_picker_all) + stylesheet_link_tag(:date_time_picker)
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
module ActionView # :nodoc:
|
75
|
+
Helpers::FormBuilder.send :include, DateTimePicker::ViewHelpers::FormHelpers
|
76
|
+
Base.send :include, DateTimePicker::ViewHelpers::TagHelpers
|
77
|
+
Base.send :include, DateTimePicker::ViewHelpers::AssetsHelper
|
78
|
+
end
|
data/lib/date_time_picker.rb
CHANGED
@@ -1,37 +1,37 @@
|
|
1
|
-
# :main: README.rdoc
|
2
|
-
|
3
|
-
module DateTimePicker # :nodoc:
|
4
|
-
DIR = File.expand_path(File.dirname(__FILE__)) # :nodoc:
|
5
|
-
class Engine < ::Rails::Engine # :nodoc:
|
6
|
-
end
|
7
|
-
|
8
|
-
module ClassMethods
|
9
|
-
def activate *names
|
10
|
-
names = names.flatten
|
11
|
-
names.each {|name| activate_one name }
|
12
|
-
end
|
13
|
-
|
14
|
-
def activate_one name
|
15
|
-
valid_framework? name
|
16
|
-
load_extension name
|
17
|
-
end
|
18
|
-
|
19
|
-
def load_extension name
|
20
|
-
require "#{name}/inputs_ext"
|
21
|
-
rescue Exception => e
|
22
|
-
raise NotImplementedError, "Unsupported Formbuilder or framework: #{name} - #{e}"
|
23
|
-
end
|
24
|
-
|
25
|
-
def valid_framework? name
|
26
|
-
case name.to_sym
|
27
|
-
when :simple_form
|
28
|
-
raise ArgumentError, "SimpleForm not defined" unless defined?(SimpleForm)
|
29
|
-
when :formtastic
|
30
|
-
raise ArgumentError, "Formtastic not defined" unless defined?(Formtastic)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
extend ClassMethods
|
35
|
-
end
|
36
|
-
|
37
|
-
require File.join(DateTimePicker::DIR, 'date_time_picker', 'date_time_picker_helpers')
|
1
|
+
# :main: README.rdoc
|
2
|
+
|
3
|
+
module DateTimePicker # :nodoc:
|
4
|
+
DIR = File.expand_path(File.dirname(__FILE__)) # :nodoc:
|
5
|
+
class Engine < ::Rails::Engine # :nodoc:
|
6
|
+
end
|
7
|
+
|
8
|
+
module ClassMethods
|
9
|
+
def activate *names
|
10
|
+
names = names.flatten
|
11
|
+
names.each {|name| activate_one name }
|
12
|
+
end
|
13
|
+
|
14
|
+
def activate_one name
|
15
|
+
valid_framework? name
|
16
|
+
load_extension name
|
17
|
+
end
|
18
|
+
|
19
|
+
def load_extension name
|
20
|
+
require "#{name}/inputs_ext"
|
21
|
+
rescue Exception => e
|
22
|
+
raise NotImplementedError, "Unsupported Formbuilder or framework: #{name} - #{e}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def valid_framework? name
|
26
|
+
case name.to_sym
|
27
|
+
when :simple_form
|
28
|
+
raise ArgumentError, "SimpleForm not defined" unless defined?(SimpleForm)
|
29
|
+
when :formtastic
|
30
|
+
raise ArgumentError, "Formtastic not defined" unless defined?(Formtastic)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
extend ClassMethods
|
35
|
+
end
|
36
|
+
|
37
|
+
require File.join(DateTimePicker::DIR, 'date_time_picker', 'date_time_picker_helpers')
|
@@ -1,2 +1,2 @@
|
|
1
|
-
Description:
|
2
|
-
The date_time_picker generator creates config/initializers/date_time_picker.rb.
|
1
|
+
Description:
|
2
|
+
The date_time_picker generator creates config/initializers/date_time_picker.rb.
|
@@ -1,11 +1,11 @@
|
|
1
|
-
module DateTimePicker
|
2
|
-
module Generators
|
3
|
-
class DateTimePickerGenerator < Rails::Generators::Base
|
4
|
-
source_root File.expand_path('../templates', __FILE__)
|
5
|
-
|
6
|
-
def generate_date_time_picker
|
7
|
-
copy_file "date_time_picker.rb", "config/initializers/date_time_picker.rb"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
1
|
+
module DateTimePicker
|
2
|
+
module Generators
|
3
|
+
class DateTimePickerGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def generate_date_time_picker
|
7
|
+
copy_file "date_time_picker.rb", "config/initializers/date_time_picker.rb"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -1,2 +1,2 @@
|
|
1
|
-
# Configure DateTimePicker
|
2
|
-
# DateTimePicker.activate :simple_form
|
1
|
+
# Configure DateTimePicker
|
2
|
+
# DateTimePicker.activate :simple_form
|
@@ -1,5 +1,5 @@
|
|
1
|
-
class UiDateInput < SimpleForm::Inputs::Base
|
2
|
-
def input
|
3
|
-
@builder.date_picker(attribute_name, input_html_options)
|
4
|
-
end
|
1
|
+
class UiDateInput < SimpleForm::Inputs::Base
|
2
|
+
def input
|
3
|
+
@builder.date_picker(attribute_name, input_html_options)
|
4
|
+
end
|
5
5
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
class UiDateTimeInput < SimpleForm::Inputs::Base
|
2
|
-
def input
|
3
|
-
@builder.date_time_picker(attribute_name, input_html_options)
|
4
|
-
end
|
1
|
+
class UiDateTimeInput < SimpleForm::Inputs::Base
|
2
|
+
def input
|
3
|
+
@builder.date_time_picker(attribute_name, input_html_options)
|
4
|
+
end
|
5
5
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
class UiTimeInput < SimpleForm::Inputs::Base
|
2
|
-
def input
|
3
|
-
@builder.time_picker(attribute_name, input_html_options)
|
4
|
-
end
|
1
|
+
class UiTimeInput < SimpleForm::Inputs::Base
|
2
|
+
def input
|
3
|
+
@builder.time_picker(attribute_name, input_html_options)
|
4
|
+
end
|
5
5
|
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
require 'simple_form/inputs/ui_date_input'
|
2
|
-
require 'simple_form/inputs/ui_date_time_input'
|
3
|
-
require 'simple_form/inputs/ui_time_input'
|
1
|
+
require 'simple_form/inputs/ui_date_input'
|
2
|
+
require 'simple_form/inputs/ui_date_time_input'
|
3
|
+
require 'simple_form/inputs/ui_time_input'
|
data/test/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
|
3
|
-
require 'rspec/core/rake_task'
|
4
|
-
task :default => :spec
|
5
|
-
RSpec::Core::RakeTask.new do |t|
|
6
|
-
t.pattern = File.expand_path 'spec/*_spec.rb'
|
7
|
-
end
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
task :default => :spec
|
5
|
+
RSpec::Core::RakeTask.new do |t|
|
6
|
+
t.pattern = File.expand_path 'spec/*_spec.rb'
|
7
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
class ApplicationController < ActionController::Base
|
2
|
-
def index
|
3
|
-
render :action => params[:id]
|
4
|
-
end
|
5
|
-
end
|
1
|
+
class ApplicationController < ActionController::Base
|
2
|
+
def index
|
3
|
+
render :action => params[:id]
|
4
|
+
end
|
5
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<%= javascript_include_tag :jquery %>
|
5
|
-
<%= javascript_include_tag 'jquery-ui'.to_sym %>
|
6
|
-
<%= stylesheet_link_tag 'jquery-ui'.to_sym %>
|
7
|
-
<%= date_time_picker_assets %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
<%= yield %>
|
11
|
-
</body>
|
12
|
-
</html>
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<%= javascript_include_tag :jquery %>
|
5
|
+
<%= javascript_include_tag 'jquery-ui'.to_sym %>
|
6
|
+
<%= stylesheet_link_tag 'jquery-ui'.to_sym %>
|
7
|
+
<%= date_time_picker_assets %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<%= yield %>
|
11
|
+
</body>
|
12
|
+
</html>
|
data/test/config/application.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require 'action_controller/railtie'
|
4
|
-
require 'sprockets/railtie'
|
5
|
-
|
6
|
-
require 'jquery-rails'
|
7
|
-
require '../lib/date_time_picker.rb'
|
8
|
-
|
9
|
-
module App
|
10
|
-
class Application < Rails::Application
|
11
|
-
end
|
12
|
-
end
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'action_controller/railtie'
|
4
|
+
require 'sprockets/railtie'
|
5
|
+
|
6
|
+
require 'jquery-rails'
|
7
|
+
require '../lib/date_time_picker.rb'
|
8
|
+
|
9
|
+
module App
|
10
|
+
class Application < Rails::Application
|
11
|
+
end
|
12
|
+
end
|
data/test/config/boot.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
|
-
ENV['RAILS_ENV'] = 'test'
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
ENV['RAILS_ENV'] = 'test'
|
@@ -1 +1 @@
|
|
1
|
-
minDate: 0
|
1
|
+
minDate: 0
|
data/test/config/environment.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Load the rails application
|
2
|
-
require File.expand_path('../application', __FILE__)
|
3
|
-
|
4
|
-
# Initialize the rails application
|
5
|
-
App::Application.initialize!
|
1
|
+
# Load the rails application
|
2
|
+
require File.expand_path('../application', __FILE__)
|
3
|
+
|
4
|
+
# Initialize the rails application
|
5
|
+
App::Application.initialize!
|
@@ -1,7 +1,7 @@
|
|
1
|
-
App::Application.configure do
|
2
|
-
config.active_support.deprecation = :stderr
|
3
|
-
config.assets.enabled = true
|
4
|
-
config.assets.version = '1.0'
|
5
|
-
config.secret_token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
|
6
|
-
config.i18n.default_locale = :ru
|
7
|
-
end
|
1
|
+
App::Application.configure do
|
2
|
+
config.active_support.deprecation = :stderr
|
3
|
+
config.assets.enabled = true
|
4
|
+
config.assets.version = '1.0'
|
5
|
+
config.secret_token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
|
6
|
+
config.i18n.default_locale = :ru
|
7
|
+
end
|
data/test/config/routes.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
App::Application.routes.draw do
|
2
|
-
match ':id' => "application#index"
|
3
|
-
end
|
1
|
+
App::Application.routes.draw do
|
2
|
+
match ':id' => "application#index"
|
3
|
+
end
|
data/test/config.ru
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# This file is used by Rack-based servers to start the application.
|
2
|
-
|
3
|
-
require ::File.expand_path('../config/environment', __FILE__)
|
4
|
-
run App::Application
|
1
|
+
# This file is used by Rack-based servers to start the application.
|
2
|
+
|
3
|
+
require ::File.expand_path('../config/environment', __FILE__)
|
4
|
+
run App::Application
|
data/test/script/rails
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#!/usr/bin/env ruby1.8
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
1
|
+
#!/usr/bin/env ruby1.8
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|