Fix handsontable assets inclusion in report templates [SCI-5692]

This commit is contained in:
Oleksii Kriuchykhin 2021-05-04 16:05:19 +02:00
parent f529dc649e
commit a307a16033
18 changed files with 77570 additions and 95 deletions

View file

@ -21,7 +21,7 @@
@import "shared_styles/elements/*";
@import "handsontable.full.min";
@import "handsontable.full";
@import "emojionearea.min";
@import "ajax-bootstrap-select.min";
@import "extend/bootstrap";

View file

@ -186,7 +186,7 @@ class ReportsController < ApplicationController
respond_to do |format|
format.json do
@report.update!(pdf_file_processing: true)
Reports::PdfJob.perform_later(@report, @report.settings[:template], current_user)
Reports::PdfJob.perform_later(@report, current_user)
render json: {
message: I18n.t('projects.reports.index.generation.accepted_message')
}
@ -548,6 +548,6 @@ class ReportsController < ApplicationController
end
def generate_pdf_report
Reports::PdfJob.perform_later(@report, @report.settings[:template], current_user) if @report.persisted?
Reports::PdfJob.perform_later(@report, current_user) if @report.persisted?
end
end

View file

@ -17,12 +17,12 @@ module Reports
PREVIEW_EXTENSIONS = %w(docx pdf).freeze
def perform(report, template, user)
def perform(report, user)
file = Tempfile.new(['report', '.pdf'], binmode: true)
begin
template_name = Extends::REPORT_TEMPLATES[template.to_sym]
template_name = Extends::REPORT_TEMPLATES[report.settings[:template]&.to_sym]
raise StandardError if template_name.blank?
raise StandardError, 'Report template not found!' if template_name.blank?
ActionController::Renderer::RACK_KEY_TRANSLATION['warden'] ||= 'warden'
proxy = Warden::Proxy.new({}, Warden::Manager.new({}))

View file

@ -69,7 +69,7 @@
</div>
</div>
<%= javascript_include_tag "handsontable.full.min" %>
<%= javascript_include_tag "handsontable.full" %>
<!-- Libraries for formulas -->
<%= render partial: "shared/formulas_libraries.html.erb" %>

View file

@ -27,7 +27,7 @@
</div>
<% end %>
<%= javascript_include_tag "handsontable.full.min" %>
<%= javascript_include_tag "handsontable.full" %>
<!-- Libraries for formulas -->
<%= render partial: "shared/formulas_libraries.html.erb" %>

View file

@ -130,7 +130,7 @@
<%= render partial: "protocols/import_export/import_elements.html.erb" %>
<%= javascript_include_tag "handsontable.full.min" %>
<%= javascript_include_tag "handsontable.full" %>
<!-- Libraries for formulas -->
<%= render partial: "shared/formulas_libraries.html.erb" %>

View file

@ -13,7 +13,7 @@
</div>
</div>
<%= javascript_include_tag "handsontable.full.min" %>
<%= javascript_include_tag "handsontable.full" %>
<%= javascript_include_tag "lodash" %>
<%= javascript_include_tag "numeral" %>
<%= javascript_include_tag "numeric" %>

View file

@ -1,3 +1,4 @@
<% protocol ||= my_module.protocol %>
<% my_module = protocol.my_module %>
<% for_export_all = defined?(export_all) && export_all %>
<div class="report-element report-module-protocol-element" data-ts="<%= protocol.created_at %>" data-type="my_module_protocol" data-id='{ "my_module_id": <%= my_module.id %> }' data-scroll-id="<%= protocol.id %>">

View file

@ -79,7 +79,7 @@
<%= render partial: 'reports/new/save_PDF_to_inventory_modal' %>
<%= javascript_include_tag "handsontable.full.min" %>
<%= javascript_include_tag "handsontable.full" %>
<!-- Libraries for formulas -->
<%= render partial: "shared/formulas_libraries.html.erb" %>

View file

@ -7,7 +7,7 @@
<%= bootstrap_cdn_link_tag %>
<%= font_awesome_cdn_link_tag %>
<%= wicked_pdf_javascript_include_tag "jquery" %>
<%= wicked_pdf_javascript_include_tag "handsontable.full.min" %>
<%= wicked_pdf_javascript_include_tag "handsontable.full" %>
<!-- Libraries for formulas -->
<%= wicked_pdf_javascript_include_tag "lodash" %>
<%= wicked_pdf_javascript_include_tag "numeral" %>

View file

@ -12,7 +12,7 @@
<div class='template-selector'>
<%= label_tag :templateSelector, t('projects.reports.wizard.first_step.select_template') %>
<%= select_tag :templateSelector,
options_for_select(@templates, report.settings[:template]),
options_for_select(@templates.invert, report.settings[:template]),
data: {
placeholder: t('projects.reports.wizard.first_step.select_template'),
values_editor_path: reports_new_template_values_path(report_id: report.id)

View file

@ -20,7 +20,7 @@
<% if can_read_protocol_in_module?(protocol) || can_read_protocol_in_repository?(protocol) %>
<%= link_to text, '#', 'data-action': 'protocol-preview', 'data-url': preview_protocol_path(protocol) %>
<%= javascript_include_tag "handsontable.full.min" %>
<%= javascript_include_tag "handsontable.full" %>
<!-- Libraries for formulas -->
<%= render partial: "shared/formulas_libraries.html.erb" %>

View file

@ -12,7 +12,7 @@
</style>
<!-- Libraries for tables and formulas -->
<% ['handsontable.full.min.js', 'lodash.js', 'numeral.js', 'numeric.js',
<% ['handsontable.full.js', 'lodash.js', 'numeral.js', 'numeric.js',
'md5.js', 'jstat.js', 'formula.js', 'parser.js', 'ruleJS.js',
'handsontable.formula.js', 'big.min.js' ].each do |js_asset| %>
<script type="text/javascript">

View file

@ -16,8 +16,8 @@ Rails.application.config.assets.paths << Rails.root.join('node_modules')
Rails.application.config.assets.precompile += %w(underscore.js)
Rails.application.config.assets.precompile += %w(jsPlumb-2.0.4-min.js)
Rails.application.config.assets.precompile += %w(jsnetworkx.js)
Rails.application.config.assets.precompile += %w(handsontable.full.min.js)
Rails.application.config.assets.precompile += %w(handsontable.full.min.css)
Rails.application.config.assets.precompile += %w(handsontable.full.js)
Rails.application.config.assets.precompile += %w(handsontable.full.css)
Rails.application.config.assets.precompile += %w(sugar.min.js jquerymy-1.2.14.min.js)
Rails.application.config.assets.precompile += %w(users/settings/list_toggle.js.erb)
Rails.application.config.assets.precompile += %w(users/settings/account/preferences/index.js)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long