Commit afd5fb86c317abcfebf40f3fbed6d698ced3f734
- Date: Sun Apr 06 09:08:09 +0000 2008
- Committer: Tim Harper (timcharper@gmail.com)
- Author: Tim Harper (timcharper@gmail.com)
- Commit SHA1: afd5fb86c317abcfebf40f3fbed6d698ced3f734
- Tree SHA1: 37e9fd89bfe1e1d75e76fd969f2a74215ec25fd8
extracted method clearSelectedClass
Commit diff
| |   |
| 327 | 327 | this.updateFooter(hover_date.toFormattedString(this.use_time)); |
| 328 | 328 | }, |
| 329 | 329 | dayHoverOut: function(element) { this.updateFooter(); }, |
| 330 | clearSelectedClass: function() {if (this.selected_cell) this.selected_cell.removeClassName("selected");}, |
| 330 | 331 | setSelectedClass: function() { |
| 331 | 332 | if (!this.selection_made) return; |
| 332 | | |
| 333 | | // clear selection |
| 334 | | if (this.selected_cell) this.selected_cell.removeClassName("selected"); |
| 335 | | |
| 333 | this.clearSelectedClass() |
| 336 | 334 | if ($R(0,42).include( days_until = this.beginning_date.stripTime().daysDistance(this.selected_date.stripTime()) )) { |
| 337 | 335 | this.selected_cell = this.calendar_day_grid[days_until]; |
| 338 | 336 | this.selected_cell.addClassName("selected"); |
| … | … | |
| 434 | 434 | if (e.keyCode==Event.KEY_ESC) this.close(); |
| 435 | 435 | }, |
| 436 | 436 | callback: function(name, param) { if (this.options.get(name)) { this.options.get(name).bind(this.target_element)(param); } } |
| 437 | | } |
| 437 | } |
| 438 | |
| toggle raw diff |
--- a/public/javascripts/calendar_date_select/calendar_date_select.js
+++ b/public/javascripts/calendar_date_select/calendar_date_select.js
@@ -327,12 +327,10 @@ CalendarDateSelect.prototype = {
this.updateFooter(hover_date.toFormattedString(this.use_time));
},
dayHoverOut: function(element) { this.updateFooter(); },
+ clearSelectedClass: function() {if (this.selected_cell) this.selected_cell.removeClassName("selected");},
setSelectedClass: function() {
if (!this.selection_made) return;
-
- // clear selection
- if (this.selected_cell) this.selected_cell.removeClassName("selected");
-
+ this.clearSelectedClass()
if ($R(0,42).include( days_until = this.beginning_date.stripTime().daysDistance(this.selected_date.stripTime()) )) {
this.selected_cell = this.calendar_day_grid[days_until];
this.selected_cell.addClassName("selected");
@@ -436,4 +434,5 @@ CalendarDateSelect.prototype = {
if (e.keyCode==Event.KEY_ESC) this.close();
},
callback: function(name, param) { if (this.options.get(name)) { this.options.get(name).bind(this.target_element)(param); } }
-}
\ No newline at end of file
+}
+ |