From f58eeeeb567eae2cea32a69294512dd2dad4b9fd Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Wed, 6 Apr 2011 16:16:24 +0200 Subject: [PATCH 1/4] actually render the progressbar as response --- lib/report/controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/report/controller.rb b/lib/report/controller.rb index 48f32616c4..8407798596 100644 --- a/lib/report/controller.rb +++ b/lib/report/controller.rb @@ -38,7 +38,7 @@ module Report::Controller end def table_with_progress_info - render_widget Widget::Table::Progressbar, @query + render :text => render_widget(Widget::Table::Progressbar, @query), :layout => false end if Rails.version.start_with? "3" From a23c67deff9021f026eb23f26f525938a43c01e8 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Wed, 6 Apr 2011 16:17:03 +0200 Subject: [PATCH 2/4] Widget::Table::Progressbar::THRESHOLD is the heuristically chosen value for 'large reports' (whatever that means) now --- lib/widget/table/progressbar.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/widget/table/progressbar.rb b/lib/widget/table/progressbar.rb index 1daa266530..a800b2b769 100644 --- a/lib/widget/table/progressbar.rb +++ b/lib/widget/table/progressbar.rb @@ -1,10 +1,9 @@ class Widget::Table::Progressbar < Widget::Base - attr_accessor :threshhold + THRESHHOLD = 500 def render - @threshhold ||= 500 size = @query.size - if size >= @threshhold + if size >= THRESHHOLD write (content_tag :div, :id => "progressbar", :class => "form_controls", :"data-query-size" => size do content_tag :div, :id => "progressbar-load-table-question", :class => "form_controls" do From ea315ffd9575581f7fce352ce38586c96c50bded Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Wed, 6 Apr 2011 16:34:48 +0200 Subject: [PATCH 3/4] re-add lost '+' --- lib/widget/filters/date.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/widget/filters/date.rb b/lib/widget/filters/date.rb index 8ea167e5f0..404414f4bb 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 + 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 From 4ce42927bd36d25a8d4a537a435fa76e6eda962d Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Wed, 6 Apr 2011 16:44:21 +0200 Subject: [PATCH 4/4] 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