-
Notifications
You must be signed in to change notification settings - Fork 13
Customization for different Controllers Actions
Shiva Bhusal edited this page Apr 10, 2016
·
1 revision
Lets say you have to generate two different reports with only the list/table
being common and have different header and footer. In other words you want to have your own layout where you can yield
the view given by QueryReport
. Also from different controllers
or Actions
- You need to say
Query Report
that you are going to use your custom view so please don't botherrendering
. - You need to manually specify the view you want to render using
render 'templatename'
or letRails
render thedefault template
.- Better would be using the default template; say, if you have
reports#sales
action then your template would beviews/reports/sales.slim
or.erb
- Better would be using the default template; say, if you have
def sales
reporter(events, custom_view: true) do
...
end
end
custom_view: true
tells Query Report
not to render its default view. For more info see this
and in views/reports/sales.slim
= render partial: 'header', locals: {report: @report}
div.sales-analytics
= render_query_report(@report)
= render partial: 'footer', locals: {report: @report}