Change dropdown options for importing protocols [SCI-9288]

This commit is contained in:
Andrej 2023-09-18 13:15:55 +02:00
parent 1068f9b979
commit aebea07be4
3 changed files with 35 additions and 9 deletions

View file

@ -22,6 +22,20 @@
}
}
.btn-beta-icon {
&::after {
background-color: var(--sn-coral);
border-radius: 1px;
color: var(--sn-white);
content: "BETA";
font-size: .5rem;
left: 7rem;
padding: .125rem .25rem;
position: absolute;
top: .1rem;
}
}
.dropdown-menu {
border: 0;
}

View file

@ -11,23 +11,35 @@
</button>
<div id="protocol-import-group" class="relative sci-btn-group only-active" role="group">
<button class="btn btn-light btn-open-file" title="<%= t("protocols.index.import_tooltip") %>"
<button class="btn btn-light" title="<%= t("protocols.index.import_tooltip") %>"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
<span class="sn-icon sn-icon-import"></span><span class="hidden-xs"><%= t("protocols.index.import") %></span>
</button>
<ul class="dropdown-menu">
<ul class="dropdown-menu rounded !grid !p-2.5 !gap-y-px sn-shadow-menu-sm">
<li>
<a class="btn-link-alt btn-secondary-link btn-open-file" <%= can_create_protocols_in_repository?(@current_team) ? 'data-action="import"' : 'disabled="disabled"' %>>
<span><%= Protocol.docx_parser_enabled? ? t('protocols.index.import_eln_docx') : t('protocols.index.import_eln') %></span>
<input type="file" value="" accept="<%= Protocol.docx_parser_enabled? ? '.eln,.docx' : '.eln' %>" data-role="import-file-input"
<a class="btn-open-file !pl-3 !py-2.5 hover:!bg-sn-super-light-blue rounded !text-sn-blue data-action='import'" >
<span><%= t('protocols.index.import_eln') %></span>
<input type="file" value="" accept=".eln" data-role="import-file-input"
data-team-id="<%= @current_team.id %>" data-import-url="<%= import_protocols_path %>">
</a>
</li>
<li class="import-protocols-io">
<%= link_to t("protocols.index.import_protocols_io"), '', data: { target: '#protocolsioModal', toggle: 'modal' } %>
<% if Protocol.docx_parser_enabled?%>
<li>
<a class="btn-open-file btn-beta-icon !pl-3 !py-2.5 hover:!bg-sn-super-light-blue !text-sn-blue rounded data-action='import'" >
<span><%= t('protocols.index.import_docx')%></span>
<input type="file" value="" accept=".docx" data-role="import-file-input"
data-team-id="<%= @current_team.id %>" data-import-url="<%= import_protocols_path %>">
</a>
</li>
<% end %>
<li>
<%= link_to t("protocols.index.import_protocols_io"),
'',
class: '!pl-3 !py-2.5 hover:!bg-sn-super-light-blue !text-sn-blue rounded',
data: { target: '#protocolsioModal', toggle: 'modal' } %>
</li>
</ul>
</div>

View file

@ -3011,8 +3011,8 @@ en:
edit: "Edit"
clone_btn: "Copy"
import: "Import"
import_eln: "From file (.eln)"
import_eln_docx: "From file (.docx, .eln)"
import_eln: "SciNote file (.eln)"
import_docx: "MS Word (.docx)"
import_protocols_io: "From Protocols.io"
modal_import_json_upload: "Upload"
modal_import_json_title: "Import protocols.io file"