mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-08 04:47:22 +08:00
Hound is love, Hound is life
This commit is contained in:
parent
65adc7a556
commit
3d7b633c25
2 changed files with 8 additions and 5 deletions
|
@ -232,7 +232,9 @@ class Project < ApplicationRecord
|
||||||
res
|
res
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_teams_export_report_html(user, team, html_name, obj_filenames = nil)
|
def generate_teams_export_report_html(
|
||||||
|
user, team, html_title, obj_filenames = nil
|
||||||
|
)
|
||||||
ActionController::Renderer::RACK_KEY_TRANSLATION['warden'] ||= 'warden'
|
ActionController::Renderer::RACK_KEY_TRANSLATION['warden'] ||= 'warden'
|
||||||
proxy = Warden::Proxy.new({}, Warden::Manager.new({}))
|
proxy = Warden::Proxy.new({}, Warden::Manager.new({}))
|
||||||
proxy.set_user(user, scope: :user, store: false)
|
proxy.set_user(user, scope: :user, store: false)
|
||||||
|
@ -287,7 +289,7 @@ class Project < ApplicationRecord
|
||||||
ApplicationController.render(
|
ApplicationController.render(
|
||||||
layout: false,
|
layout: false,
|
||||||
locals: {
|
locals: {
|
||||||
title: html_name,
|
title: html_title,
|
||||||
content: parsed_html.children.map(&:to_s).join
|
content: parsed_html.children.map(&:to_s).join
|
||||||
},
|
},
|
||||||
template: 'team_zip_exports/report',
|
template: 'team_zip_exports/report',
|
||||||
|
|
|
@ -117,8 +117,9 @@ class TeamZipExport < ZipExport
|
||||||
|
|
||||||
# Generate and export whole project report HTML
|
# Generate and export whole project report HTML
|
||||||
html_name = "#{project_name} Report.html"
|
html_name = "#{project_name} Report.html"
|
||||||
project_report_pdf =
|
project_report_pdf = p.generate_teams_export_report_html(
|
||||||
p.generate_teams_export_report_html(@user, @team, html_name, obj_filenames)
|
@user, @team, html_name, obj_filenames
|
||||||
|
)
|
||||||
file = FileUtils.touch("#{project_path}/#{html_name}").first
|
file = FileUtils.touch("#{project_path}/#{html_name}").first
|
||||||
File.open(file, 'wb') { |f| f.write(project_report_pdf) }
|
File.open(file, 'wb') { |f| f.write(project_report_pdf) }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue