start of iteration 2
This commit is contained in:
parent
9fb87a74ce
commit
729ed13521
75 changed files with 705 additions and 170 deletions
|
|
@ -11,7 +11,9 @@ class ReportsController < ApplicationController
|
|||
# GET /reports/1
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.html do
|
||||
@current_page = page_param && @report.pages.find(page_param) || @report.pages.first
|
||||
end
|
||||
format.pdf
|
||||
format.xlsx do
|
||||
response.headers["Content-Disposition"] = %(attachment; filename="#{filename(@report, extension: 'xlsx')}")
|
||||
|
|
@ -35,7 +37,7 @@ class ReportsController < ApplicationController
|
|||
format.docx do
|
||||
send_file(Docx::Document.new.generate do |document|
|
||||
document.heading1(@report.name)
|
||||
document.paragraph(@report.comment_html)
|
||||
document.paragraph(@report.comment)
|
||||
# document.heading1("slfkj")
|
||||
# document.paragraph("sldkfj")
|
||||
@report.elements.each do |element|
|
||||
|
|
@ -127,10 +129,14 @@ class ReportsController < ApplicationController
|
|||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def report_params
|
||||
params.require(:report).permit(:name, :comment_html)
|
||||
params.require(:report).permit(:name, :comment)
|
||||
end
|
||||
|
||||
def filename(report, extension: "html")
|
||||
"#{report.name}-#{Time.current.strftime('%Y%m%d%H%M')}.#{extension}"
|
||||
end
|
||||
|
||||
def page_param
|
||||
params[:page_id]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue