Merge pull request #1880 from biosistemika/SCI-3644-hide-import-button

SCI-3644 Import button is always visible
This commit is contained in:
Miha Mencin 2019-07-03 11:50:10 +02:00 committed by GitHub
commit 882e453b9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 5 deletions

View file

@ -159,17 +159,28 @@
.protocol-card {
border-bottom: 1px solid $color-gainsboro;
margin-right: 20px;
padding: 12px 11px 7px 11px;
padding: 12px 11px;
&.active {
border: 2px solid $brand-primary;
border-radius: 2px;
box-shadow: 0 1px 4px 0 $color-black;
padding-bottom: 7px;
}
&:hover {
background-color: rgba(64,161,215,0.1);
padding-bottom: 7px;
}
.external-import-btn {
display: none;
}
&:hover .external-import-btn, &.active .external-import-btn{
display: block;
}
}
.protocol-title {

View file

@ -9,12 +9,12 @@ class ExternalProtocolsController < ApplicationController
service_call = ProtocolImporters::SearchProtocolsService
.call(protocol_source: index_params[:protocol_source],
query_params: index_params)
if service_call.succeed?
show_import_button = can_create_protocols_in_repository?(@team)
render json: {
html: render_to_string(
partial: 'protocol_importers/list_of_protocol_cards.html.erb',
locals: { protocols: service_call.protocols_list }
locals: { protocols: service_call.protocols_list, show_import_button: show_import_button }
)
}
else

View file

@ -1,4 +1,4 @@
<% protocols[:protocols].each do |protocol| %>
<%= render partial: 'protocol_importers/protocol_card',
locals: { protocol: protocol } %>
locals: { protocol: protocol, show_import_button: show_import_button } %>
<% end %>

View file

@ -16,7 +16,9 @@
<%= t('protocol_importers.card.views_and_steps', nr_of_views: protocol[:nr_of_views], nr_of_steps: protocol[:nr_of_steps]) %>
</div>
<div class='col-md-6 info-line'>
<button type="button" class='external-import-btn btn btn-primary pull-right'><%= t('protocol_importers.card.import_button_text') %></button>
<% if show_import_button %>
<button type="button" class='external-import-btn btn btn-primary pull-right'><%= t('protocol_importers.card.import_button_text') %></button>
<% end %>
</div>
</div>
</div>