From 4ce42927bd36d25a8d4a537a435fa76e6eda962d Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Wed, 6 Apr 2011 16:44:21 +0200 Subject: [PATCH] oops, calendar header tags might be empty --- lib/widget/base.rb | 1 + lib/widget/filters/date.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/widget/base.rb b/lib/widget/base.rb index fded356447..eaa668b3de 100644 --- a/lib/widget/base.rb +++ b/lib/widget/base.rb @@ -18,6 +18,7 @@ class Widget::Base < Widget # Write a string to the canvas. The string is marked as html_safe. # This will write twice, if @cache_output is set. def write(str) + str ||= "" @output ||= "".html_safe @output.write str.html_safe @cache_output.write(str.html_safe) if @cache_output diff --git a/lib/widget/filters/date.rb b/lib/widget/filters/date.rb index 404414f4bb..afec956496 100644 --- a/lib/widget/filters/date.rb +++ b/lib/widget/filters/date.rb @@ -1,6 +1,6 @@ class Widget::Filters::Date < Widget::Filters::Base def calendar_for(field_id) - include_calendar_headers_tags + + write include_calendar_headers_tags image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) + javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });") end