Module: ReportsKit::Helper

Includes:
NormalizedParams
Defined in:
lib/reports_kit/helper.rb

Instance Method Summary collapse

Methods included from NormalizedParams

#context_params, #report_key, #report_params

Instance Method Details

#render_report(report_params, context_params: {}, actions: %w(export_csv export_xls),, js_report_class: 'Report', &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/reports_kit/helper.rb', line 5

def render_report(report_params, context_params: {}, actions: %w(export_csv export_xls), js_report_class: 'Report', &block)
  report_params = { key: report_params } if report_params.is_a?(String)
  params.merge!(context_params: context_params, report_params: report_params)
  properties = Reports::Properties.generate(self)
  builder = ReportBuilder.new(
    report_params: report_params,
    context_params: context_params,
    actions: actions,
    js_report_class: js_report_class,
    properties: properties,
    view_context: self,
    block: block
  )
  capture do
    capture(builder, &block) if block
    builder.render
  end
end