Merge pull request #1555 from okriuchykhin/ok_SCI_3151

Embed tables JS files to main HTML of Export All [SCI-3151]
This commit is contained in:
Alex Kriuchykhin 2019-03-07 14:34:28 +01:00 committed by GitHub
commit 3da3ef0e8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 25 deletions

View file

@ -129,22 +129,10 @@ class TeamZipExport < ZipExport
)
file = FileUtils.touch("#{project_path}/#{html_name}").first
File.open(file, 'wb') { |f| f.write(project_report_pdf) }
# Add Handsontable and dependent JS files (mimick frontend formula
# processing).
required_js = %w(handsontable.full.min.js lodash.js numeral.js numeric.js
md5.js jstat.js formula.js parser.js ruleJS.js
handsontable.formula.js big.min.js)
required_js.each do |filename|
filepath = File.join(Rails.root,
"vendor/assets/javascripts/#{filename}")
dest_folder = "#{project_path}/"
FileUtils.cp(filepath, dest_folder)
end
end
ensure
# Change current dir outside tmp_dir, since tmp_dir will be deleted
Dir.chdir(File.join(Rails.root, 'tmp'))
Dir.chdir(Rails.root)
end
def generate_notification(user)

View file

@ -11,19 +11,41 @@
.html_safe %>
</style>
<script src="handsontable.full.min.js"></script>
<script type="text/javascript">
<%= raw Rails.application.assets['handsontable.full.min.js'].to_s %>
</script>
<!-- Libraries for formulas -->
<script src="lodash.js"></script>
<script src="numeral.js"></script>
<script src="numeric.js"></script>
<script src="md5.js"></script>
<script src="jstat.js"></script>
<script src="formula.js"></script>
<script src="parser.js"></script>
<script src="ruleJS.js"></script>
<script src="handsontable.formula.js"></script>
<script src="big.min.js"></script>
<script type="text/javascript">
<%= raw Rails.application.assets['lodash.js'].to_s %>
</script>
<script type="text/javascript">
<%= raw Rails.application.assets['numeral.js'].to_s %>
</script>
<script type="text/javascript">
<%= raw Rails.application.assets['numeric.js'].to_s %>
</script>
<script type="text/javascript">
<%= raw Rails.application.assets['md5.js'].to_s %>
</script>
<script type="text/javascript">
<%= raw Rails.application.assets['jstat.js'].to_s %>
</script>
<script type="text/javascript">
<%= raw Rails.application.assets['formula.js'].to_s %>
</script>
<script type="text/javascript">
<%= raw Rails.application.assets['parser.js'].to_s %>
</script>
<script type="text/javascript">
<%= raw Rails.application.assets['ruleJS.js'].to_s %>
</script>
<script type="text/javascript">
<%= raw Rails.application.assets['handsontable.formula.js'].to_s %>
</script>
<script type="text/javascript">
<%= raw Rails.application.assets['big.min.js'].to_s %>
</script>
<!-- Init Handsontables -->
<script>