Add new asset icons to report [SCI-5263]

This commit is contained in:
aignatov-bio 2021-01-19 12:53:49 +01:00
parent f594a44cdb
commit 07831c0294
5 changed files with 37 additions and 6 deletions

View file

@ -368,6 +368,10 @@ label {
.file-name { .file-name {
margin-left: 15px; margin-left: 15px;
} }
.image-icon.report {
display: none;
}
} }
img { img {
@ -464,6 +468,10 @@ label {
margin-left: 5px; margin-left: 5px;
white-space: nowrap; white-space: nowrap;
} }
.image-icon.report {
display: none;
}
} }
&:hover > .report-element-header .file-name { &:hover > .report-element-header .file-name {

View file

@ -97,6 +97,14 @@ div.print-report {
img { img {
max-width: 100%; max-width: 100%;
} }
.image-icon.preview {
display: none;
}
.image-icon.report {
display: initial !important;
}
} }
.report-step-table-element { .report-step-table-element {
@ -199,6 +207,14 @@ div.print-report {
} }
} }
.image-icon.preview {
display: none;
}
.image-icon.report {
display: initial !important;
}
img { img {
max-width: 100%; max-width: 100%;
} }

View file

@ -30,7 +30,7 @@ module FileIconsHelper
end end
# For showing next to file # For showing next to file
def file_extension_icon(asset) def file_extension_icon(asset, report = false)
file_ext = asset.file_name.split('.').last file_ext = asset.file_name.split('.').last
if Constants::FILE_TEXT_FORMATS.include?(file_ext) if Constants::FILE_TEXT_FORMATS.include?(file_ext)
image_link = 'icon_small/docx_file.svg' image_link = 'icon_small/docx_file.svg'
@ -46,7 +46,14 @@ module FileIconsHelper
image_link = Extends::FILE_ICON_MAPPINGS[file_ext] if Extends::FILE_ICON_MAPPINGS[file_ext] image_link = Extends::FILE_ICON_MAPPINGS[file_ext] if Extends::FILE_ICON_MAPPINGS[file_ext]
if image_link if image_link
ActionController::Base.helpers.image_tag(image_link, class: 'image-icon') if report
content_tag(:span) do
concat ActionController::Base.helpers.image_tag(image_link, class: 'image-icon preview')
concat wicked_pdf_image_tag(image_link, class: 'image-icon report')
end
else
ActionController::Base.helpers.image_tag(image_link, class: 'image-icon')
end
else else
'' ''
end end
@ -100,8 +107,8 @@ module FileIconsHelper
end end
end end
def file_extension_icon_html(asset) def file_extension_icon_html(asset, report = false)
html = file_extension_icon(asset) html = file_extension_icon(asset, report)
if html.blank? if html.blank?
html = ActionController::Base.helpers.content_tag( html = ActionController::Base.helpers.content_tag(
:i, :i,

View file

@ -14,7 +14,7 @@
<div class="report-element-header"> <div class="report-element-header">
<div class="row"> <div class="row">
<div class="pull-left result-icon"> <div class="pull-left result-icon">
<span class="<%= icon_class %>"></span> <%= file_extension_icon_html(asset, true) %>
</div> </div>
<div class="pull-left result-name"> <div class="pull-left result-name">
<%= result.name %> <%= result.name %>

View file

@ -5,7 +5,7 @@
<div class="report-element-header"> <div class="report-element-header">
<div class="row"> <div class="row">
<div class="pull-left attachment-icon"> <div class="pull-left attachment-icon">
<span class="fas <%= icon_class %>"></span> <%= file_extension_icon_html(asset, true) %>
</div> </div>
<div class="pull-left file-name"> <div class="pull-left file-name">
<% if defined? export_all and export_all %> <% if defined? export_all and export_all %>