choose table partitial depending on query

git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1466 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
rkh 14 years ago
parent cc6f32cb38
commit 8fbf20bf02
  1. 6
      app/controllers/cost_reports_controller.rb
  2. 4
      app/helpers/reporting_helper.rb
  3. 0
      app/views/cost_reports/_cost_entry_table.rhtml
  4. 4
      app/views/cost_reports/_cost_report_table.rhtml
  5. 0
      app/views/cost_reports/_simple_cost_report_table.rhtml

@ -7,7 +7,13 @@ class CostReportsController < ApplicationController
def index
CostQuery::QueryUtils.cache.clear
if @query.group_bys.empty?
@table_partial = "cost_entry_table"
elsif @query.depth_of(:column) == 0 or @query.depth_of(:row) == 0
@table_partial = "simple_cost_report_table"
else
@table_partial = "cost_report_table"
end
render :layout => !request.xhr?
end

@ -41,6 +41,10 @@ module ReportingHelper
klass.find(id).name
end
def debug_fields(result, prefix = ", ")
prefix << result.fields.inspect << ", " << result.key.inspect if params[:debug]
end
##
# For a given row, determine how to render it's contents according to usability and
# localization rules

@ -4,10 +4,6 @@
<%
def debug_fields(result, prefix = ", ")
prefix << result.fields.inspect << ", " << result.key.inspect if params[:debug]
end
walker.for_final_row do |row, cells|
html = "<th class='normal inner left'>#{show_row row}#{debug_fields(row)}</th>"
html << cells.join

Loading…
Cancel
Save