|
|
@ -4,10 +4,10 @@ class Widget::Base < Widget |
|
|
|
def initialize(query) |
|
|
|
def initialize(query) |
|
|
|
@query = query |
|
|
|
@query = query |
|
|
|
@engine = query.class |
|
|
|
@engine = query.class |
|
|
|
@output = "".html_safe |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def write(str) |
|
|
|
def write(str) |
|
|
|
|
|
|
|
@output ||= "".html_safe |
|
|
|
@output.write str |
|
|
|
@output.write str |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -16,13 +16,8 @@ class Widget::Base < Widget |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def render_with_options(options = {}, &block) |
|
|
|
def render_with_options(options = {}, &block) |
|
|
|
if canvas = options[:to] |
|
|
|
@output = options[:to] if options.has_key? :to |
|
|
|
@output = canvas |
|
|
|
render(&block) |
|
|
|
end |
|
|
|
|
|
|
|
result = render(&block) |
|
|
|
|
|
|
|
if @output.respond_to? :to_str and @output.empty? # FIXME: Transitional support |
|
|
|
|
|
|
|
@output += "\n#{result}".html_safe |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
@output |
|
|
|
@output |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|