calendar_date_select 1.16.1 → 1.16.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ == Version 1.16.2
2
+
3
+ * Fixed calendar_date_select's method of firing onChange for its target element. (Ethan)
4
+ * added Czech translation. (deric)
5
+ * Fixed issue #11. (Kevin Triemstra)
6
+ * Fixed rubygems dependency in Rakefile (to fix jeweler load error). (Thilo-Alexander Ginkel)
7
+
1
8
  == Version 1.16.1
2
9
 
3
10
  * 1.16 was a lemon release. Sorry! Deploy script had an error and messed up the code on the way out.
data/README.txt CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  http://code.google.com/p/calendardateselect/
4
4
 
5
- This project is looking for a new maintainer. Please contact me if you have sufficient interest in this project to move it forward.
5
+ * This project is looking for a new maintainer. Please contact me if you have sufficient interest in this project to move it forward.
6
6
 
7
7
  == Examples
8
8
 
@@ -15,4 +15,3 @@ Please take care to do the following:
15
15
  * Clean up your patch (don't send a patch bomb with a hundred features in one)
16
16
  * Write test cases!
17
17
  * As a general rule of thumb, think of ways to make things more general purpose than specific.
18
-
data/Rakefile CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
 
4
4
  begin
5
+ require 'rubygems'
5
6
  require 'jeweler'
6
7
  Jeweler::Tasks.new do |gemspec|
7
8
  gemspec.name = "calendar_date_select"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.16.1
1
+ 1.16.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{calendar_date_select}
8
- s.version = "1.16.1"
8
+ s.version = "1.16.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Shih-gian Lee", "Enrique Garcia Cota (kikito)", "Tim Charper", "Lars E. Hoeg"]
@@ -93,4 +93,3 @@ Gem::Specification.new do |s|
93
93
  else
94
94
  end
95
95
  end
96
-
@@ -21,6 +21,7 @@
21
21
  <div id="cds_test_div">
22
22
  <input type="text" id="cds_test" />
23
23
  </div>
24
+ <div id="cds_status"></div>
24
25
 
25
26
  <!-- Tests -->
26
27
  <script type="text/javascript" language="javascript">
@@ -357,6 +358,16 @@
357
358
 
358
359
  assertEqual(1, $$(".calendar_date_select").length);
359
360
  cds.close();
361
+ }},
362
+ test__dynamic_onchange_should_be_fired: function() {with (this) {
363
+ Event.observe($('cds_test'), 'change', function()
364
+ { $('cds_status').innerHTML='calendar input changed';
365
+ });
366
+ cds = new CalendarDateSelect($("cds_test"), {time: "mixed"});
367
+ today_now = $$(".cds_buttons a[href=#]");
368
+ today_now[0].onclick();
369
+ assertMatch('calendar input changed', $('cds_status').innerHTML, "status div should indicate date changed");
370
+ cds.close();
360
371
  }}
361
372
  });
362
373
  // ]]>
@@ -1,5 +1,5 @@
1
1
  module CalendarDateSelect
2
- VERSION = '1.16.1'
2
+ VERSION = '1.16.2'
3
3
 
4
4
  FORMATS = {
5
5
  :natural => {
@@ -1,4 +1,4 @@
1
- // CalendarDateSelect version 1.16.1 - a prototype based date picker
1
+ // CalendarDateSelect version 1.16.2 - a prototype based date picker
2
2
  // Questions, comments, bugs? - see the project page: http://code.google.com/p/calendardateselect
3
3
  if (typeof Prototype == 'undefined') alert("CalendarDateSelect Error: Prototype could not be found. Please make sure that your application's layout includes prototype.js (.g. <%= javascript_include_tag :defaults %>) *before* it includes calendar_date_select.js (.g. <%= calendar_date_select_includes %>).");
4
4
  if (Prototype.Version < "1.6") alert("Prototype 1.6.0 is required. If using earlier version of prototype, please use calendar_date_select version 1.8.3");
@@ -88,7 +88,20 @@ CalendarDateSelect.prototype = {
88
88
  minute_interval: 5,
89
89
  popup_by: this.target_element,
90
90
  month_year: "dropdowns",
91
- onchange: this.target_element.onchange,
91
+ onchange: function(target_element)
92
+ { return function()
93
+ { if(target_element.dispatchEvent)
94
+ { var event=document.createEvent('HTMLEvents');
95
+ event.initEvent('change', true, true);
96
+ target_element.dispatchEvent(event);
97
+ }
98
+ else
99
+ { var event=document.createEventObject();
100
+ event.type='onChange';
101
+ target_element.fireEvent('onChange', event);
102
+ }
103
+ };
104
+ }(this.target_element),
92
105
  valid_date_check: nil
93
106
  }).merge(options || {});
94
107
  this.use_time = this.options.get("time");
@@ -313,7 +326,7 @@ CalendarDateSelect.prototype = {
313
326
  validYear: function(year) { if (this.flexibleYearRange()) { return true;} else { return this.yearRange().include(year);} },
314
327
  dayHover: function(element) {
315
328
  var hover_date = new Date(this.selected_date);
316
- hover_date.setYear(element.year); hover_date.setMonth(element.month); hover_date.setDate(element.day);
329
+ hover_date.setFullYear(element.year, element.month, element.day);
317
330
  this.updateFooter(hover_date.toFormattedString(this.use_time));
318
331
  },
319
332
  dayHoverOut: function(element) { this.updateFooter(); },
@@ -360,9 +373,7 @@ CalendarDateSelect.prototype = {
360
373
  if ((this.target_element.disabled || this.target_element.readOnly) && this.options.get("popup") != "force") return false;
361
374
  if (parts.get("day")) {
362
375
  var t_selected_date = this.selected_date, vdc = this.options.get("valid_date_check");
363
- t_selected_date.setYear(parts.get("year"));
364
- t_selected_date.setMonth(parts.get("month"));
365
- t_selected_date.setDate(parts.get("day"));
376
+ t_selected_date.setFullYear(parts.get("year"), parts.get("month"), parts.get("day"));
366
377
 
367
378
  if (vdc && ! vdc(t_selected_date.stripTime())) { return false; }
368
379
  this.selected_date = t_selected_date;
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,7 @@ require "rubygems"
2
2
 
3
3
  require 'spec'
4
4
 
5
- gem 'activesupport', "2.3.4"
5
+ gem 'activesupport', "~> 2.3.5"
6
6
  gem 'actionpack', ">= 2.2.0"
7
7
 
8
8
  require 'active_support'
@@ -23,4 +23,4 @@ class String
23
23
  def to_regexp
24
24
  is_a?(Regexp) ? self : Regexp.new(Regexp.escape(self.to_s))
25
25
  end
26
- end
26
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calendar_date_select
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 83
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 16
8
- - 1
9
- version: 1.16.1
9
+ - 2
10
+ version: 1.16.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Shih-gian Lee
@@ -17,7 +18,7 @@ autorequire:
17
18
  bindir: bin
18
19
  cert_chain: []
19
20
 
20
- date: 2010-03-29 00:00:00 -06:00
21
+ date: 2010-03-29 00:00:00 -04:00
21
22
  default_executable:
22
23
  dependencies: []
23
24
 
@@ -94,23 +95,27 @@ rdoc_options:
94
95
  require_paths:
95
96
  - lib
96
97
  required_ruby_version: !ruby/object:Gem::Requirement
98
+ none: false
97
99
  requirements:
98
100
  - - ">="
99
101
  - !ruby/object:Gem::Version
102
+ hash: 3
100
103
  segments:
101
104
  - 0
102
105
  version: "0"
103
106
  required_rubygems_version: !ruby/object:Gem::Requirement
107
+ none: false
104
108
  requirements:
105
109
  - - ">="
106
110
  - !ruby/object:Gem::Version
111
+ hash: 3
107
112
  segments:
108
113
  - 0
109
114
  version: "0"
110
115
  requirements: []
111
116
 
112
117
  rubyforge_project:
113
- rubygems_version: 1.3.6
118
+ rubygems_version: 1.3.7
114
119
  signing_key:
115
120
  specification_version: 3
116
121
  summary: Calendar date picker for rails