calendar_date_select 1.15 → 1.16
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/History.txt +29 -0
- data/Manifest.txt +1 -1
- data/{Readme.txt → README.txt} +2 -0
- data/Rakefile +18 -13
- data/VERSION +1 -0
- data/calendar_date_select.gemspec +96 -0
- data/js_test/functional/.tmp_cds_test.html +306 -0
- data/js_test/functional/cds_test.html +31 -0
- data/js_test/functional/format_iso_date_test.html +52 -0
- data/lib/calendar_date_select/calendar_date_select.rb +10 -4
- data/lib/calendar_date_select/form_helpers.rb +16 -4
- data/public/javascripts/calendar_date_select/calendar_date_select.js +9 -4
- data/public/javascripts/calendar_date_select/format_american.js +2 -1
- data/public/javascripts/calendar_date_select/format_danish.js +31 -0
- data/public/javascripts/calendar_date_select/format_iso_date.js +19 -36
- data/public/javascripts/calendar_date_select/locale/ar.js +10 -0
- data/public/javascripts/calendar_date_select/locale/da.js +11 -0
- data/public/javascripts/calendar_date_select/locale/es.js +11 -0
- data/public/javascripts/calendar_date_select/locale/fr.js +2 -1
- data/public/javascripts/calendar_date_select/locale/it.js +9 -0
- data/public/javascripts/calendar_date_select/locale/nl.js +11 -0
- data/public/javascripts/calendar_date_select/locale/pl.js +2 -1
- data/public/javascripts/calendar_date_select/locale/sl.js +11 -0
- data/public/stylesheets/calendar_date_select/green.css +142 -0
- data/spec/calendar_date_select/form_helpers_spec.rb +23 -0
- data/spec/calendar_date_select/includes_helper_spec.rb +46 -0
- data/spec/spec_helper.rb +1 -1
- metadata +52 -39
@@ -50,6 +50,29 @@ describe CalendarDateSelect::FormHelpers do
|
|
50
50
|
output.should_not match(/value/)
|
51
51
|
end
|
52
52
|
|
53
|
+
describe "default time mode" do
|
54
|
+
it "should wrap default date in javascript function when passed as string" do
|
55
|
+
@model.start_datetime = nil
|
56
|
+
output = calendar_date_select(:model, :start_datetime, :default_time => "new Date()")
|
57
|
+
output.should match(/value=""/)
|
58
|
+
output.should include("default_time:function() { return new Date() }")
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should wrap formatted date with default time with Date() when passed a date object" do
|
62
|
+
@model.start_datetime = nil
|
63
|
+
output = calendar_date_select(:model, :start_datetime, :default_time => Date.parse("January 2, 2007"))
|
64
|
+
output.should match(/value=""/)
|
65
|
+
output.should include("default_time:new Date('January 02, 2007 12:00 AM')")
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should wrap formatted date and time with Date() when passed a time object" do
|
69
|
+
@model.start_datetime = nil
|
70
|
+
output = calendar_date_select(:model, :start_datetime, :default_time => Time.parse("January 2, 2007 5:45 PM"))
|
71
|
+
output.should match(/value=""/)
|
72
|
+
output.should include("default_time:new Date('January 02, 2007 05:45 PM')")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
53
76
|
it "should _vdc__should_auto_format_function" do
|
54
77
|
@model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
|
55
78
|
output = calendar_date_select(:model,
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe CalendarDateSelect::IncludesHelper do
|
4
|
+
include ActionView::Helpers::TagHelper
|
5
|
+
include ActionView::Helpers::AssetTagHelper
|
6
|
+
include CalendarDateSelect::IncludesHelper
|
7
|
+
|
8
|
+
describe "calendar_date_select_includes" do
|
9
|
+
it "should include the specified locale" do
|
10
|
+
calendar_date_select_includes(:locale => "fr").should include("calendar_date_select/locale/fr.js")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should include the specified style" do
|
14
|
+
calendar_date_select_includes(:style => "blue").should include("calendar_date_select/blue.css")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should complain if you provide an illegitimate argument" do
|
18
|
+
lambda { calendar_date_select_includes(:language => "fr") }.should raise_error(ArgumentError)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "calendar_date_select_javascripts" do
|
23
|
+
it "should return an array of javascripts" do
|
24
|
+
calendar_date_select_javascripts.should == ["calendar_date_select/calendar_date_select"]
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should return the :javascript_include of the specified format, if the specified format expects it" do
|
28
|
+
CalendarDateSelect.stub!(:format).and_return(CalendarDateSelect::FORMATS[:hyphen_ampm])
|
29
|
+
calendar_date_select_javascripts.should == ["calendar_date_select/calendar_date_select", "calendar_date_select/format_hyphen_ampm"]
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should blow up if an illegitimate argument is passed" do
|
33
|
+
lambda { calendar_date_select_javascripts(:language => "fr") }.should raise_error(ArgumentError)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "calendar_date_select_stylesheets" do
|
38
|
+
it "should return an array of stylesheet" do
|
39
|
+
calendar_date_select_javascripts.should == ["calendar_date_select/calendar_date_select"]
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should blow up if an illegitimate argument is passed" do
|
43
|
+
lambda { calendar_date_select_stylesheets(:css_version => "blue") }.should raise_error(ArgumentError)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,56 +1,59 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calendar_date_select
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 16
|
8
|
+
version: "1.16"
|
5
9
|
platform: ruby
|
6
10
|
authors:
|
7
|
-
-
|
11
|
+
- Shih-gian Lee
|
12
|
+
- Enrique Garcia Cota (kikito)
|
13
|
+
- Tim Charper
|
14
|
+
- Lars E. Hoeg
|
8
15
|
autorequire:
|
9
16
|
bindir: bin
|
10
17
|
cert_chain: []
|
11
18
|
|
12
|
-
date:
|
19
|
+
date: 2010-03-29 00:00:00 -06:00
|
13
20
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 1.8.0
|
24
|
-
version:
|
25
|
-
description: ""
|
26
|
-
email:
|
27
|
-
- tim c harper at gmail dot com
|
21
|
+
dependencies: []
|
22
|
+
|
23
|
+
description: Calendar date picker for rails
|
24
|
+
email: ""
|
28
25
|
executables: []
|
29
26
|
|
30
27
|
extensions: []
|
31
28
|
|
32
29
|
extra_rdoc_files:
|
33
|
-
-
|
34
|
-
- Manifest.txt
|
35
|
-
- Readme.txt
|
30
|
+
- README.txt
|
36
31
|
files:
|
32
|
+
- .gitignore
|
37
33
|
- History.txt
|
34
|
+
- MIT-LICENSE
|
35
|
+
- Manifest.txt
|
36
|
+
- README.txt
|
37
|
+
- Rakefile
|
38
|
+
- VERSION
|
39
|
+
- calendar_date_select.gemspec
|
38
40
|
- init.rb
|
41
|
+
- js_test/functional/.tmp_cds_test.html
|
39
42
|
- js_test/functional/cds_test.html
|
43
|
+
- js_test/functional/format_iso_date_test.html
|
40
44
|
- js_test/prototype.js
|
41
45
|
- js_test/test.css
|
42
46
|
- js_test/unit/cds_helper_methods.html
|
43
47
|
- js_test/unittest.js
|
48
|
+
- lib/calendar_date_select.rb
|
44
49
|
- lib/calendar_date_select/calendar_date_select.rb
|
45
|
-
- lib/calendar_date_select/includes_helper.rb
|
46
50
|
- lib/calendar_date_select/form_helpers.rb
|
47
|
-
- lib/calendar_date_select.rb
|
48
|
-
- Manifest.txt
|
49
|
-
- MIT-LICENSE
|
51
|
+
- lib/calendar_date_select/includes_helper.rb
|
50
52
|
- public/blank_iframe.html
|
51
53
|
- public/images/calendar_date_select/calendar.gif
|
52
54
|
- public/javascripts/calendar_date_select/calendar_date_select.js
|
53
55
|
- public/javascripts/calendar_date_select/format_american.js
|
56
|
+
- public/javascripts/calendar_date_select/format_danish.js
|
54
57
|
- public/javascripts/calendar_date_select/format_db.js
|
55
58
|
- public/javascripts/calendar_date_select/format_euro_24hr.js
|
56
59
|
- public/javascripts/calendar_date_select/format_euro_24hr_ymd.js
|
@@ -58,50 +61,60 @@ files:
|
|
58
61
|
- public/javascripts/calendar_date_select/format_hyphen_ampm.js
|
59
62
|
- public/javascripts/calendar_date_select/format_iso_date.js
|
60
63
|
- public/javascripts/calendar_date_select/format_italian.js
|
64
|
+
- public/javascripts/calendar_date_select/locale/ar.js
|
65
|
+
- public/javascripts/calendar_date_select/locale/da.js
|
61
66
|
- public/javascripts/calendar_date_select/locale/de.js
|
67
|
+
- public/javascripts/calendar_date_select/locale/es.js
|
62
68
|
- public/javascripts/calendar_date_select/locale/fi.js
|
63
69
|
- public/javascripts/calendar_date_select/locale/fr.js
|
70
|
+
- public/javascripts/calendar_date_select/locale/it.js
|
71
|
+
- public/javascripts/calendar_date_select/locale/nl.js
|
64
72
|
- public/javascripts/calendar_date_select/locale/pl.js
|
65
73
|
- public/javascripts/calendar_date_select/locale/pt.js
|
66
74
|
- public/javascripts/calendar_date_select/locale/ru.js
|
75
|
+
- public/javascripts/calendar_date_select/locale/sl.js
|
67
76
|
- public/stylesheets/calendar_date_select/blue.css
|
68
77
|
- public/stylesheets/calendar_date_select/default.css
|
78
|
+
- public/stylesheets/calendar_date_select/green.css
|
69
79
|
- public/stylesheets/calendar_date_select/plain.css
|
70
80
|
- public/stylesheets/calendar_date_select/red.css
|
71
81
|
- public/stylesheets/calendar_date_select/silver.css
|
72
|
-
- Rakefile
|
73
|
-
- Readme.txt
|
74
|
-
- spec/
|
75
|
-
- spec/calendar_date_select
|
76
82
|
- spec/calendar_date_select/calendar_date_select_spec.rb
|
77
83
|
- spec/calendar_date_select/form_helpers_spec.rb
|
84
|
+
- spec/calendar_date_select/includes_helper_spec.rb
|
78
85
|
- spec/spec_helper.rb
|
79
86
|
has_rdoc: true
|
80
|
-
homepage: http://
|
87
|
+
homepage: http://github.com/timcharper/calendar_date_select
|
88
|
+
licenses: []
|
89
|
+
|
81
90
|
post_install_message:
|
82
91
|
rdoc_options:
|
83
|
-
- --
|
84
|
-
- README.txt
|
92
|
+
- --charset=UTF-8
|
85
93
|
require_paths:
|
86
94
|
- lib
|
87
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
96
|
requirements:
|
89
97
|
- - ">="
|
90
98
|
- !ruby/object:Gem::Version
|
99
|
+
segments:
|
100
|
+
- 0
|
91
101
|
version: "0"
|
92
|
-
version:
|
93
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
103
|
requirements:
|
95
104
|
- - ">="
|
96
105
|
- !ruby/object:Gem::Version
|
106
|
+
segments:
|
107
|
+
- 0
|
97
108
|
version: "0"
|
98
|
-
version:
|
99
109
|
requirements: []
|
100
110
|
|
101
|
-
rubyforge_project:
|
102
|
-
rubygems_version: 1.3.
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 1.3.6
|
103
113
|
signing_key:
|
104
|
-
specification_version:
|
105
|
-
summary:
|
106
|
-
test_files:
|
107
|
-
|
114
|
+
specification_version: 3
|
115
|
+
summary: Calendar date picker for rails
|
116
|
+
test_files:
|
117
|
+
- spec/calendar_date_select/calendar_date_select_spec.rb
|
118
|
+
- spec/calendar_date_select/form_helpers_spec.rb
|
119
|
+
- spec/calendar_date_select/includes_helper_spec.rb
|
120
|
+
- spec/spec_helper.rb
|