mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-31 20:19:05 +08:00
adds correct preview images to files [fixes SCI-2254]
This commit is contained in:
parent
d466fdf8e8
commit
9812a9f160
3 changed files with 11 additions and 5 deletions
|
@ -9,10 +9,14 @@ module FileIconsHelper
|
||||||
file_ext = asset.file_file_name.split('.').last
|
file_ext = asset.file_file_name.split('.').last
|
||||||
if %w(doc docm docx dot dotm dotx odt rtf).include?(file_ext)
|
if %w(doc docm docx dot dotm dotx odt rtf).include?(file_ext)
|
||||||
fa_class = 'fa-file-word'
|
fa_class = 'fa-file-word'
|
||||||
elsif %w(csv ods xls xlsb xlsm xlsx).include?(file_ext)
|
elsif %w(ods xls xlsb xlsm xlsx).include?(file_ext)
|
||||||
fa_class = 'fa-file-excel'
|
fa_class = 'fa-file-excel'
|
||||||
elsif %w(odp pot potm potx pps ppsm ppsx ppt pptm pptx).include?(file_ext)
|
elsif %w(odp pot potm potx pps ppsm ppsx ppt pptm pptx).include?(file_ext)
|
||||||
fa_class = 'fa-file-powerpoint'
|
fa_class = 'fa-file-powerpoint'
|
||||||
|
elsif %w(pdf).include?(file_ext)
|
||||||
|
fa_class = 'fa-file-pdf'
|
||||||
|
elsif %w(txt csv tab tex).include?(file_ext)
|
||||||
|
fa_class = 'fa-file-alt'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Now check for custom mappings or possible overrides
|
# Now check for custom mappings or possible overrides
|
||||||
|
|
|
@ -6,14 +6,13 @@
|
||||||
<div class="col-xs-3">
|
<div class="col-xs-3">
|
||||||
<% i = 0 %>
|
<% i = 0 %>
|
||||||
<% @archived_results.each do |result| %>
|
<% @archived_results.each do |result| %>
|
||||||
|
|
||||||
<%= render partial: "my_modules/archive/result.html.erb", locals: { result: result } %>
|
<%= render partial: "my_modules/archive/result.html.erb", locals: { result: result } %>
|
||||||
|
|
||||||
<% i = i + 1 %>
|
<% i = i + 1 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if i == 0 %>
|
<% if i == 0 %>
|
||||||
<em><%=t "my_modules.module_archive.no_archived_results" %></em>
|
<em><%=t "my_modules.module_archive.no_archived_results" %></em>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>window.initPreviewModal()</script>
|
||||||
|
|
|
@ -9,7 +9,10 @@
|
||||||
<li>
|
<li>
|
||||||
<% option_text = t("my_modules.module_archive.option_download") %>
|
<% option_text = t("my_modules.module_archive.option_download") %>
|
||||||
<% if result.is_asset %>
|
<% if result.is_asset %>
|
||||||
<%= link_to option_text, download_asset_path(result.asset), data: {no_turbolink: true} %>
|
<%= link_to 'View', download_asset_path(result.asset),
|
||||||
|
class: 'file-preview-link',
|
||||||
|
id: "modal_link#{result.asset.id}",
|
||||||
|
data: { no_turbolink: true, id: true, status: 'asset-present', 'preview-url': asset_file_preview_path(result.asset) } %>
|
||||||
<% elsif result.is_text %>
|
<% elsif result.is_text %>
|
||||||
<%= link_to option_text, result_text_download_path(result.result_text_id), data: {no_turbolink: true} %>
|
<%= link_to option_text, result_text_download_path(result.result_text_id), data: {no_turbolink: true} %>
|
||||||
<% elsif result.is_table %>
|
<% elsif result.is_table %>
|
||||||
|
|
Loading…
Reference in a new issue