OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/widget/table.rb

47 lines
1.2 KiB

class Widget::Table < Widget::Base
extend Report::InheritedAttribute
include ReportingHelper # FIXME ugs in the ugly. have to think of something else for mapping stuff
inherited_attribute :debug, :default => false
def initialize(query, options = {})
raise ArgumentError, "Tables only work on Reports!" unless query.is_a? Report
super(query)
debug = options[:debug] || false
mapping = options[:mapping] || {}
end
def debug?
!!debug
end
def render_with_options(options = {}, &block)
if canvas = options[:to]
canvas << "\n" << render(&block)
else
render(&block)
end
end
14 years ago
def render
# if @query.depth_of(:column) + @query.depth_of(:row) == 1
# widget = Widget::Table::SimpleTable
# else
# if @query.depth_of(:row) == 0
# @query.column(:singleton_value)
# elsif @query.depth_of(:column) == 0
# @query.row(:singleton_value)
# end
# end
widget = Widget::Table::ReportTable
14 years ago
content_tag :div, :id => "result-table" do
if @query.result.count > 0
render_widget widget, @query, { :debug => debug? }
14 years ago
else
content_tag :p, l(:label_no_data), :class => "nodata"
end
end
end
end