start of iteration 2
Some checks failed
/ Run tests (push) Failing after 1m19s
/ Run system tests (push) Failing after 1m18s
/ Build, push and deploy image (push) Has been skipped

This commit is contained in:
david 2024-10-31 23:13:18 +01:00
parent 9fb87a74ce
commit 729ed13521
75 changed files with 705 additions and 170 deletions

View file

@ -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