mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 02:04:33 +08:00
Merge pull request #1445 from okriuchykhin/ok_SCI_2931
Fix image URLs in export all document [SCI-2931]
This commit is contained in:
commit
be514fd62d
7 changed files with 28 additions and 9 deletions
|
@ -206,6 +206,11 @@ label {
|
|||
padding-top: 10px;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
|
||||
.report-export-img {
|
||||
max-height: 300px;
|
||||
max-width: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
.report-element-children {
|
||||
|
|
|
@ -1945,10 +1945,6 @@ a.disabled-with-click-events {
|
|||
padding-bottom: 60px;
|
||||
}
|
||||
|
||||
.tiny-mce-pdf-ready {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.doorkeeper-authorization {
|
||||
|
||||
margin-bottom: 45px;
|
||||
|
|
|
@ -26,7 +26,15 @@ module TinyMceHelper
|
|||
img = TinyMceAsset.find_by_id(match[1])
|
||||
next unless img && check_image_permissions(obj, img)
|
||||
if pdf_export_ready
|
||||
report_image_asset_url(img, :tiny_mce_asset, 'tiny-mce-pdf-ready')
|
||||
tmp_f = Tempfile.open(img.image_file_name, Rails.root.join('tmp'))
|
||||
begin
|
||||
img.image.copy_to_local_file(:large, tmp_f.path)
|
||||
encoded_image = Base64.strict_encode64(tmp_f.read)
|
||||
"<img src='data:image/jpg;base64,#{encoded_image}'>"
|
||||
ensure
|
||||
tmp_f.close
|
||||
tmp_f.unlink
|
||||
end
|
||||
else
|
||||
image_tag(img.url,
|
||||
class: 'img-responsive',
|
||||
|
|
|
@ -38,7 +38,11 @@
|
|||
<div class="report-element-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 file-image">
|
||||
<%= report_image_asset_url(asset) %>
|
||||
<% if defined?(export_all) && export_all %>
|
||||
<img class="report-export-img" src="<%= path %>">
|
||||
<% else %>
|
||||
<%= report_image_asset_url(asset) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<% comments = result.result_comments %>
|
||||
<% timestamp = result.created_at %>
|
||||
<% name = result.name %>
|
||||
<% pdf_export_ready = defined?(export_all) && export_all %>
|
||||
<div class="report-element report-result-element report-result-text-element" data-ts="<%= timestamp.to_i %>" data-type="result_text" data-id='{ "result_id": <%= result.id %> }' data-scroll-id="<%= result.id %>" data-modal-title="<%=t "projects.reports.elements.modals.result_contents.head_title", result: result.name %>" data-name="<%= name %>" data-icon-class="fas fa-asterisk">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
|
@ -23,7 +24,7 @@
|
|||
<div class="report-element-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 text-container ql-editor">
|
||||
<%= custom_auto_link(generate_image_tag_from_token(result_text.text, result_text, true),
|
||||
<%= custom_auto_link(generate_image_tag_from_token(result_text.text, result_text, pdf_export_ready),
|
||||
team: current_team,
|
||||
simple_format: false,
|
||||
tags: %w(img)) %>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<% assets = step.assets %>
|
||||
<% checklists = step.checklists %>
|
||||
<% comments = step.step_comments %>
|
||||
<% pdf_export_ready = defined?(export_all) && export_all %>
|
||||
<div class="report-element report-step-element" data-ts="<%= timestamp.to_i %>" data-type="step" data-id='{ "step_id": <%= step.id %> }' data-scroll-id="<%= step.id %>" data-modal-title="<%=t "projects.reports.elements.modals.step_contents.head_title", step: step.name %>" data-name="<%=t "projects.reports.elements.step.sidebar_name", pos: (step.position + 1), name: step.name %>" data-icon-class="fas fa-arrow-circle-right">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
|
@ -30,7 +31,7 @@
|
|||
<div class="row">
|
||||
<div class="col-xs-12 ql-editor">
|
||||
<% if strip_tags(step.description).present? %>
|
||||
<%= custom_auto_link(generate_image_tag_from_token(step.description, step, true),
|
||||
<%= custom_auto_link(generate_image_tag_from_token(step.description, step, pdf_export_ready),
|
||||
team: current_team,
|
||||
simple_format: false,
|
||||
tags: %w(img)) %>
|
||||
|
|
|
@ -32,7 +32,11 @@
|
|||
<% if is_image %>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 file-image">
|
||||
<%= report_image_asset_url(asset) %>
|
||||
<% if defined?(export_all) && export_all %>
|
||||
<img class="report-export-img" src="<%= path %>">
|
||||
<% else %>
|
||||
<%= report_image_asset_url(asset) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in a new issue