Initial commit
This commit is contained in:
31
app/controllers/issues_and_concerns_reports_controller.rb
Normal file
31
app/controllers/issues_and_concerns_reports_controller.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
class IssuesAndConcernsReportsController < ApplicationController
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.xlsx { send_issues_and_concerns_report_xls }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def videos
|
||||
policy_scope(Video)
|
||||
end
|
||||
|
||||
def video
|
||||
authorize videos.find(params[:video_id])
|
||||
end
|
||||
|
||||
def issues_and_concerns_report
|
||||
authorize ExcelReports::IssuesAndConcernsReports::IssuesAndConcernsReport.new(video)
|
||||
end
|
||||
|
||||
def send_issues_and_concerns_report_xls
|
||||
send_data(
|
||||
issues_and_concerns_report.to_xls,
|
||||
{
|
||||
filename: issues_and_concerns_report.filename,
|
||||
type: Mime[:xlsx]
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user