calendar_date_select 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/calendar_date_select/format_american.js +1 -1
  3. data/app/assets/javascripts/calendar_date_select/format_danish.js +1 -1
  4. data/app/assets/javascripts/calendar_date_select/format_db.js +1 -1
  5. data/app/assets/javascripts/calendar_date_select/format_finnish.js +1 -1
  6. data/app/assets/javascripts/calendar_date_select/format_hyphen_ampm.js +1 -1
  7. data/app/assets/javascripts/calendar_date_select/format_italian.js +1 -1
  8. data/app/helpers/calendar_date_select/form_helpers.rb +10 -3
  9. data/app/helpers/calendar_date_select/includes_helper.rb +2 -2
  10. data/lib/calendar_date_select/version.rb +1 -1
  11. metadata +14 -132
  12. data/.gitignore +0 -16
  13. data/Gemfile +0 -20
  14. data/Gemfile.lock +0 -111
  15. data/History.txt +0 -290
  16. data/README.md +0 -17
  17. data/Rakefile +0 -8
  18. data/VERSION +0 -1
  19. data/calendar_date_select.gemspec +0 -26
  20. data/js_test/functional/.tmp_cds_test.html +0 -306
  21. data/js_test/functional/cds_test.html +0 -376
  22. data/js_test/functional/format_iso_date_test.html +0 -52
  23. data/js_test/prototype.js +0 -4184
  24. data/js_test/test.css +0 -40
  25. data/js_test/unit/cds_helper_methods.html +0 -46
  26. data/js_test/unittest.js +0 -564
  27. data/spec/dummy/.gitignore +0 -15
  28. data/spec/dummy/Gemfile +0 -38
  29. data/spec/dummy/Gemfile.lock +0 -118
  30. data/spec/dummy/README.rdoc +0 -261
  31. data/spec/dummy/Rakefile +0 -7
  32. data/spec/dummy/app/assets/images/rails.png +0 -0
  33. data/spec/dummy/app/assets/javascripts/application.js +0 -16
  34. data/spec/dummy/app/assets/stylesheets/application.css +0 -13
  35. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  36. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  37. data/spec/dummy/app/mailers/.gitkeep +0 -0
  38. data/spec/dummy/app/models/.gitkeep +0 -0
  39. data/spec/dummy/app/views/application/example.html.erb +0 -5
  40. data/spec/dummy/app/views/layouts/application.html.erb +0 -15
  41. data/spec/dummy/config.ru +0 -4
  42. data/spec/dummy/config/application.rb +0 -67
  43. data/spec/dummy/config/boot.rb +0 -6
  44. data/spec/dummy/config/database.yml +0 -25
  45. data/spec/dummy/config/environment.rb +0 -5
  46. data/spec/dummy/config/environments/development.rb +0 -37
  47. data/spec/dummy/config/environments/production.rb +0 -67
  48. data/spec/dummy/config/environments/test.rb +0 -37
  49. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  50. data/spec/dummy/config/initializers/inflections.rb +0 -15
  51. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  52. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  53. data/spec/dummy/config/initializers/session_store.rb +0 -8
  54. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  55. data/spec/dummy/config/locales/en.yml +0 -5
  56. data/spec/dummy/config/routes.rb +0 -58
  57. data/spec/dummy/db/seeds.rb +0 -7
  58. data/spec/dummy/lib/assets/.gitkeep +0 -0
  59. data/spec/dummy/lib/tasks/.gitkeep +0 -0
  60. data/spec/dummy/log/.gitkeep +0 -0
  61. data/spec/dummy/public/404.html +0 -26
  62. data/spec/dummy/public/422.html +0 -26
  63. data/spec/dummy/public/500.html +0 -25
  64. data/spec/dummy/public/favicon.ico +0 -0
  65. data/spec/dummy/public/robots.txt +0 -5
  66. data/spec/dummy/script/rails +0 -6
  67. data/spec/dummy/test/fixtures/.gitkeep +0 -0
  68. data/spec/dummy/test/functional/.gitkeep +0 -0
  69. data/spec/dummy/test/integration/.gitkeep +0 -0
  70. data/spec/dummy/test/test_helper.rb +0 -13
  71. data/spec/dummy/test/unit/.gitkeep +0 -0
  72. data/spec/dummy/vendor/assets/javascripts/.gitkeep +0 -0
  73. data/spec/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
  74. data/spec/dummy/vendor/plugins/.gitkeep +0 -0
  75. data/spec/helpers/calendar_date_select_spec.rb +0 -14
  76. data/spec/helpers/form_helpers_spec.rb +0 -181
  77. data/spec/helpers/includes_helper_spec.rb +0 -42
  78. data/spec/spec_helper.rb +0 -10
@@ -1,7 +0,0 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
- #
4
- # Examples:
5
- #
6
- # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
- # Mayor.create(name: 'Emanuel', city: cities.first)
File without changes
File without changes
File without changes
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/404.html -->
21
- <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/422.html -->
21
- <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,25 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/500.html -->
21
- <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
23
- </div>
24
- </body>
25
- </html>
File without changes
@@ -1,5 +0,0 @@
1
- # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
- #
3
- # To ban all spiders from the entire site uncomment the next two lines:
4
- # User-Agent: *
5
- # Disallow: /
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
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'
File without changes
File without changes
File without changes
@@ -1,13 +0,0 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path('../../config/environment', __FILE__)
3
- require 'rails/test_help'
4
-
5
- class ActiveSupport::TestCase
6
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7
- #
8
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
9
- # -- they do not yet inherit this setting
10
- fixtures :all
11
-
12
- # Add more helper methods to be used by all tests here...
13
- end
File without changes
File without changes
@@ -1,14 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe CalendarDateSelect do
4
- it "should detect presence of time in a string" do
5
- CalendarDateSelect.has_time?("January 7, 2007").should == false
6
- CalendarDateSelect.has_time?("January 7, 2007 5:50pm").should == true
7
- CalendarDateSelect.has_time?("January 7, 2007 5:50 pm").should == true
8
- CalendarDateSelect.has_time?("January 7, 2007 16:30 pm").should == true
9
-
10
- CalendarDateSelect.has_time?(Date.parse("January 7, 2007 3:00 pm")).should == false
11
- CalendarDateSelect.has_time?(Time.parse("January 7, 2007 3:00 pm")).should == true
12
- CalendarDateSelect.has_time?(DateTime.parse("January 7, 2007 3:00 pm")).should == true
13
- end
14
- end
@@ -1,181 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- describe CalendarDateSelect::FormHelpers do
3
- include ERB::Util
4
- before(:each) do
5
- @controller = ActionController::Base.new
6
- @request = OpenStruct.new
7
- @controller.request = @request
8
-
9
- @model = OpenStruct.new
10
- end
11
-
12
- describe "mixed mode" do
13
- it "should not output a time when the value is a Date" do
14
- @model.start_datetime = Date.parse("January 2, 2007")
15
- output = helper.calendar_date_select(:model, :start_datetime, :time => "mixed")
16
- output.should_not match(/12:00 AM/)
17
- end
18
-
19
- it "should output a time when the value is a Time" do
20
- @model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
21
- output = helper.calendar_date_select(:model, :start_datetime, :time => "mixed")
22
- output.should match(/12:00 AM/)
23
- end
24
- end
25
-
26
- it "should render a time when time is passed as 'true'" do
27
- @model.start_datetime = Date.parse("January 2, 2007")
28
- output = helper.calendar_date_select(:model, :start_datetime, :time => "true")
29
- output.should match(/12:00 AM/)
30
- end
31
-
32
- it "should time_false__model_returns_time__should_render_without_time" do
33
- @model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
34
- output = helper.calendar_date_select(:model, :start_datetime)
35
- output.should_not match(/12:00 AM/)
36
- end
37
-
38
- it "should _nil_model__shouldnt_populate_value" do
39
- @model = nil
40
- output = helper.calendar_date_select(:model, :start_datetime)
41
-
42
- output.should_not match(/value/)
43
- end
44
-
45
- describe "default time mode" do
46
- it "should wrap default date in javascript function when passed as string" do
47
- @model.start_datetime = nil
48
- output = helper.calendar_date_select(:model, :start_datetime, :default_time => "new Date()")
49
- output.should match(/value=""/)
50
- output.should include("default_time:function() { return new Date() }")
51
- end
52
-
53
- it "should wrap formatted date with default time with Date() when passed a date object" do
54
- @model.start_datetime = nil
55
- output = helper.calendar_date_select(:model, :start_datetime, :default_time => Date.parse("January 2, 2007"))
56
- output.should match(/value=""/)
57
- output.should include(h "default_time:new Date('January 02, 2007 12:00 AM')")
58
- end
59
-
60
- it "should wrap formatted date and time with Date() when passed a time object" do
61
- @model.start_datetime = nil
62
- output = helper.calendar_date_select(:model, :start_datetime, :default_time => Time.parse("January 2, 2007 5:45 PM"))
63
- output.should match(/value=""/)
64
- output.should include(h "default_time:new Date('January 02, 2007 05:45 PM')")
65
- end
66
- end
67
-
68
- it "should _vdc__should_auto_format_function" do
69
- @model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
70
- output = helper.calendar_date_select(:model,
71
- :start_datetime,
72
- :valid_date_check => "date < new Date()"
73
- )
74
- output.should include("valid_date_check:function(date) { return(date &lt; new Date()) }")
75
-
76
- output = helper.calendar_date_select(:model,
77
- :start_datetime,
78
- :valid_date_check => "return(date < new Date())"
79
- )
80
- output.should include("valid_date_check:function(date) { return(date &lt; new Date()) }")
81
- output = helper.calendar_date_select(:model,
82
- :start_datetime,
83
- :valid_date_check => "function(p) { return(date < new Date()) }"
84
- )
85
- output.should include("valid_date_check:function(p) { return(date &lt; new Date()) }")
86
- end
87
-
88
- it "should raise an error if the valid_date_check function is missing a return statement" do
89
- message = ":valid_date_check function is missing a 'return' statement. Try something like: :valid_date_check => 'if (date > new(Date)) return true; else return false;'"
90
- lambda {
91
- output = helper.calendar_date_select(:model,
92
- :start_datetime,
93
- :valid_date_check => "date = 5; date < new Date());"
94
- )
95
- }.should raise_error(ArgumentError, message)
96
-
97
- lambda {
98
- output = helper.calendar_date_select(:model,
99
- :start_datetime,
100
- :valid_date_check => "function(p) { date = 5; date < new Date()); }"
101
- )
102
- }.should raise_error(ArgumentError, message)
103
- end
104
-
105
- it "should render the year_range argument correctly" do
106
- output = helper.calendar_date_select(:model, :start_datetime)
107
- output.should include("year_range:10")
108
- output = helper.calendar_date_select(:model, :start_datetime, :year_range => 2000..2010)
109
- output.should include("year_range:[2000, 2010]")
110
- output = helper.calendar_date_select(:model, :start_datetime, :year_range => (15.years.ago..5.years.ago))
111
- output.should include("year_range:[#{15.years.ago.year}, #{5.years.ago.year}]")
112
- end
113
-
114
- it "should disregard the :object parameter when nil" do
115
- @model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
116
- output = helper.calendar_date_select(:model, :start_datetime, :time => true, :object => nil)
117
- output.should include(CalendarDateSelect.format_date(@model.start_datetime))
118
- end
119
-
120
- it "should regard :object parameter" do
121
- @model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
122
- output = helper.calendar_date_select(:lame_o, :start_datetime, :time => true, :object => @model)
123
- output.should include(CalendarDateSelect.format_date(@model.start_datetime))
124
- end
125
-
126
- it "should respect parameters provided in default_options" do
127
- new_options = CalendarDateSelect.default_options.merge(:popup => "force")
128
- CalendarDateSelect.stub!(:default_options).and_return(new_options)
129
- helper.calendar_date_select_tag(:name, "").should include(h "popup:'force'")
130
- end
131
-
132
- it "should respect the :image option" do
133
- output = helper.calendar_date_select_tag(:name, "Some String", :image => "boogy.png")
134
- output.should include("boogy.png")
135
- end
136
-
137
- it "should not pass the :image option as a javascript option" do
138
- output = helper.calendar_date_select_tag(:name, "Some String", :image => "boogy.png")
139
- output.should_not include("image:")
140
- end
141
-
142
- it "should use the CSS class helper.calendar_date_select_tag for popup selector icon" do
143
- output = helper.calendar_date_select_tag(:name, "Some String", :image => "boogy.png")
144
- output.should include("calendar_date_select_popup_icon")
145
- end
146
-
147
- describe "helper.calendar_date_select_tag" do
148
- before(:each) do
149
- @time = Time.parse("January 2, 2007 12:01:23 AM")
150
- end
151
-
152
- it "should use the string verbatim when provided" do
153
- output = helper.calendar_date_select_tag(:name, "Some String")
154
-
155
- output.should include("Some String")
156
- end
157
-
158
- it "should not render the time when time is false (or nil)" do
159
- output = helper.calendar_date_select_tag(:name, @time, :time => false)
160
-
161
- output.should_not match(/12:01 AM/)
162
- output.should include(CalendarDateSelect.format_date(@time.to_date))
163
- end
164
-
165
- it "should render the time when :time => true" do
166
- output = helper.calendar_date_select_tag(:name, @time, :time => true)
167
-
168
- output.should include(CalendarDateSelect.format_date(@time))
169
- end
170
-
171
- it "should render the time when :time => 'mixed'" do
172
- output = helper.calendar_date_select_tag(:name, @time, :time => 'mixed')
173
- output.should include(CalendarDateSelect.format_date(@time))
174
- end
175
-
176
- it "not include the image option in the result input tag" do
177
- output = helper.calendar_date_select_tag(:name, @time, :time => 'mixed')
178
- output.should_not include("image=")
179
- end
180
- end
181
- end
@@ -1,42 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CalendarDateSelect::IncludesHelper do
4
- describe "calendar_date_select_includes" do
5
- it "should include the specified locale" do
6
- helper.calendar_date_select_includes(:locale => "fr").should include("calendar_date_select/locale/fr.js")
7
- end
8
-
9
- it "should include the specified style" do
10
- helper.calendar_date_select_includes(:style => "blue").should include("calendar_date_select/blue.css")
11
- end
12
-
13
- it "should complain if you provide an illegitimate argument" do
14
- lambda { helper.calendar_date_select_includes(:language => "fr") }.should raise_error(ArgumentError)
15
- end
16
- end
17
-
18
- describe "calendar_date_select_javascripts" do
19
- it "should return an array of javascripts" do
20
- helper.calendar_date_select_javascripts.should == ["calendar_date_select/calendar_date_select"]
21
- end
22
-
23
- it "should return the :javascript_include of the specified format, if the specified format expects it" do
24
- CalendarDateSelect.stub!(:format).and_return(CalendarDateSelect::FORMATS[:hyphen_ampm])
25
- helper.calendar_date_select_javascripts.should == ["calendar_date_select/calendar_date_select", "calendar_date_select/format_hyphen_ampm"]
26
- end
27
-
28
- it "should blow up if an illegitimate argument is passed" do
29
- lambda { helper.calendar_date_select_javascripts(:language => "fr") }.should raise_error(ArgumentError)
30
- end
31
- end
32
-
33
- describe "calendar_date_select_stylesheets" do
34
- it "should return an array of stylesheet" do
35
- helper.calendar_date_select_javascripts.should == ["calendar_date_select/calendar_date_select"]
36
- end
37
-
38
- it "should blow up if an illegitimate argument is passed" do
39
- lambda { helper.calendar_date_select_stylesheets(:css_version => "blue") }.should raise_error(ArgumentError)
40
- end
41
- end
42
- end
@@ -1,10 +0,0 @@
1
- ENV["RAILS_ENV"] = "test"
2
-
3
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
- require 'rspec/rails'
5
- # require 'active_support'
6
- # require 'action_pack'
7
- # require 'action_controller'
8
- # require 'action_view'
9
-
10
- Rails.backtrace_cleaner.remove_silencers!