If your using the calendar_date_select widget to allow the user to select
dates in the future, the now button doesn't make much sense. So I added a
"now_button" option, like the "clear_button" option. I was wondering if
this is something you would consider adding?
This is against calendar_date_select-1.15.
( This is against the js in the public folder, not the one in the gem
folder, sorry.)
--- a/public/javascripts/calendar_date_select/calendar_date_select.js
+++ b/public/javascripts/calendar_date_select/calendar_date_select.js
@@ -89,7 +89,8 @@ CalendarDateSelect.prototype = {
popup_by: this.target_element,
month_year: "dropdowns",
onchange: this.target_element.onchange,
- valid_date_check: nil
+ valid_date_check: nil,
+ now_button: true
}).merge(options || {});
this.use_time = this.options.get("time");
this.parseDate();
@@ -226,7 +227,7 @@ CalendarDateSelect.prototype = {
if (this.options.get("time")=="mixed") buttons_div.build("span",
{innerHTML: " | ", className:"button_seperator"})
- if (this.options.get("time")) b = buttons_div.build("a", {
+ if (this.options.get("now_button") && this.options.get("time")) b =
buttons_div.build("a", {
innerHTML: _translations["Now"],
href: "#",
onclick: function() {this.today(true); return
false}.bindAsEventListener(this)
---
a/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select/form_helpers.rb
+++
b/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select/form_helpers.rb
@@ -154,7 +154,7 @@ module CalendarDateSelect::FormHelpers
options, javascript_options =
CalendarDateSelect.default_options.merge(options), {}
image = options.delete(:image)
callbacks = [:before_show, :before_close, :after_show, :after_close,
:after_navigate]
- for key in [:time, :valid_date_check, :embedded, :buttons,
:clear_button, :format, :year_range, :month_year, :popup, :hidden,
:minute_interval] + callbacks
+ for key in [:time, :valid_date_check, :embedded, :buttons,
:clear_button, :format, :year_range, :month_year, :popup, :hidden,
:minute_interval, :now_button] + callbacks
javascript_options[key] = options.delete(key) if options.has_key?(key)
end
Thanks,
James
Original issue reported on code.google.com by james57....@googlemail.com on 14 Dec 2009 at 7:33
Original issue reported on code.google.com by
james57....@googlemail.com
on 14 Dec 2009 at 7:33