Merge pull request #5993 from sboursen-scinote/sb_SCI-9038

Set sequence attachments file icon [SCI-9038]
This commit is contained in:
ajugo 2023-08-25 21:53:22 +02:00 committed by GitHub
commit db4aa53f72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 4 deletions

View file

@ -0,0 +1,10 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.4923 3.51517C10.0704 3.60025 8.69275 4.04129 7.48581 4.79777C6.27887 5.55426 5.28139 6.60192 4.58502 7.84452C3.88865 9.08711 3.51572 10.4848 3.50049 11.9091C3.48526 13.3335 3.82822 14.7388 4.49786 15.996" stroke="#1D2939" stroke-linecap="round"/>
<path d="M11.5501 6.51843C10.6743 6.59031 9.8284 6.87102 9.08335 7.33704C8.3383 7.80307 7.71577 8.44084 7.26789 9.19694C6.82001 9.95304 6.55984 10.8055 6.50916 11.6828C6.45847 12.5601 6.61875 13.4368 6.97658 14.2395" stroke="#1D2939" stroke-linecap="round"/>
<path d="M10.7142 14.144C11.0835 14.3654 11.5036 14.4878 11.934 14.4991C12.3644 14.5105 12.7904 14.4105 13.1708 14.2089" stroke="#1D2939" stroke-linecap="round"/>
<path d="M11.5231 9.54591C11.0365 9.64048 10.5889 9.87759 10.2374 10.2271C9.88584 10.5766 9.64613 11.0227 9.54873 11.5088" stroke="#1D2939" stroke-linecap="round"/>
<path d="M16.4528 15.2284C17.2432 14.1382 17.6062 12.7958 17.473 11.4558" stroke="#1D2939" stroke-linecap="round"/>
<path d="M8.8669 16.5204C9.66189 17.0714 10.5881 17.403 11.5522 17.4817C12.5163 17.5605 13.4841 17.3836 14.358 16.9689" stroke="#1D2939" stroke-linecap="round"/>
<path d="M19.4459 7.90013C18.6397 6.43599 17.4197 5.24203 15.9386 4.46756" stroke="#1D2939" stroke-linecap="round"/>
<path d="M6.52764 18.5041C7.79803 19.573 9.35364 20.2464 11.0024 20.4413C12.6512 20.6361 14.3209 20.3439 15.8054 19.6006C17.29 18.8573 18.5244 17.6955 19.3562 16.2587C20.188 14.8219 20.5808 13.1729 20.4862 11.5154" stroke="#1D2939" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -445,3 +445,15 @@
padding: 4px 8px;
white-space: nowrap;
}
.sn-file-ove {
height: 1.5rem;
width: 1.5rem;
&::before {
content: url("icon_small/sequence-editor.svg");
display: inline-block;
margin: auto;
width: 100%;
}
}

View file

@ -13,14 +13,12 @@ class GeneSequenceAssetsController < ApplicationController
before_action :check_manage_permission, only: %i(new update create)
def new
@ove_enabled = OpenVectorEditorService.enabled?
render :edit, layout: false
end
def edit
@file_url = rails_representation_url(@asset.file)
@file_name = @asset.render_file_name
@ove_enabled = OpenVectorEditorService.enabled?
log_activity(:protocol_sequence_asset_edit_started)
render :edit, layout: false
end

View file

@ -40,6 +40,8 @@ module FileIconsHelper
image_link = 'icon_small/pptx_file.svg'
elsif asset.file.attached? && asset.file.metadata['asset_type'] == 'marvinjs'
image_link = 'icon_small/marvinjs_file.svg'
elsif asset.file.attached? && asset.file.metadata['asset_type'] == 'gene_sequence'
image_link = 'icon_small/sequence-editor.svg'
end
# Now check for custom mappings or possible overrides

View file

@ -2,6 +2,7 @@
<div class="list-attachment-container asset"
:data-asset-id="attachment.id"
>
<div v-html="attachment.attributes.icon"></div>
<i class="fas asset-icon" :class="attachment.attributes.icon"></i>
<a :href="attachment.attributes.urls.blob"
class="file-preview-link file-name"

View file

@ -15,7 +15,7 @@ class AssetSerializer < ActiveModel::Serializer
:preview_image
def icon
file_fa_icon_class(object)
file_extension_icon_html(object)
end
def file_name

View file

@ -1,7 +1,9 @@
<% @asset_results.each do |asset| %>
<h5>
<h5 class="flex flex-row flex-nowrap items-center gap-1">
<% if asset.blob.metadata["asset_type"] == 'marvinjs' %>
<span class="mce-i-marvinjs"></span>
<% elsif asset.blob.metadata["asset_type"] == 'gene_sequence' %>
<span class="sn-file-ove"></span>
<% else %>
<% if wopi_file?(asset) %>
<%= file_extension_icon(asset) %>