diff --git a/app/utilities/protocol_importers/protocols_io/v3/step_components.rb b/app/utilities/protocol_importers/protocols_io/v3/step_components.rb index 04207462e..9641917d2 100644 --- a/app/utilities/protocol_importers/protocols_io/v3/step_components.rb +++ b/app/utilities/protocol_importers/protocols_io/v3/step_components.rb @@ -118,9 +118,9 @@ module ProtocolImporters { type: 'reagent', name: desc_component[:source][:name], + link: desc_component[:source][:url], details: { catalog_number: desc_component[:source][:sku], - link: desc_component[:source][:vendor][:link], linear_formula: desc_component[:source][:linfor], mol_weight: desc_component[:source][:mol_weight] } diff --git a/app/views/protocol_importers/templates/_command.html.erb b/app/views/protocol_importers/templates/_command.html.erb index 21ab069e0..b260ec714 100644 --- a/app/views/protocol_importers/templates/_command.html.erb +++ b/app/views/protocol_importers/templates/_command.html.erb @@ -1,5 +1,11 @@
<%= t('protocol_importers.templates.command.title') %>
- <%= "#{t('protocol_importers.templates.command.name')}: #{item[:name]}" %>
- <%= "#{t('protocol_importers.templates.command.code')}: #{item[:command]}
" %>
+ <% if item[:name].present? %>
+ <%= "#{t('protocol_importers.templates.command.name')}: #{item[:name]}" %>
+ <% end %>
+
+ <% if item[:command].present? %>
+ <%= t('protocol_importers.templates.command.code') %>:
+ <%= item[:command] %>
+<% end %>
<%= t('protocol_importers.templates.dataset.title') %>
- <%= "#{t('protocol_importers.templates.dataset.name')}: #{item[:name]}" %>
- <%= "#{t('protocol_importers.templates.dataset.link')}: #{item[:source]}" if item[:source] %>
+ <% if item[:name].present? %>
+ <%= "#{t('protocol_importers.templates.dataset.name')}: #{item[:name]}" %>
+ <% end %>
+ <% if item[:source].present? %>
+ <%= t('protocol_importers.templates.dataset.link') %>: <%= item[:source] %>
+ <% end %>
- <% if item[:details]&.any? %>
- <%= t('protocol_importers.templates.details.title')%>:
+ <% items = item[:details]&.reject { |_,v| v.blank? } %>
+ <% if items&.any? %>
+ <%= t('protocol_importers.templates.details.title')%>:
- <% item[:details].reject { |_,v| v.blank? }.each do |k, v| %>
+ <% items.each do |k, v| %>
<%= "#{k.humanize}: #{v.to_s}" %>
<% end %>
diff --git a/app/views/protocol_importers/templates/_gotostep.html.erb b/app/views/protocol_importers/templates/_gotostep.html.erb
index 56a77ea2c..fa9f0e042 100644
--- a/app/views/protocol_importers/templates/_gotostep.html.erb
+++ b/app/views/protocol_importers/templates/_gotostep.html.erb
@@ -1,4 +1,5 @@
<%= t('protocol_importers.templates.gotostep.title') %>
<%= "#{t('protocol_importers.templates.gotostep.number')}: #{item[:step_id]}" %>
<%= "#{t('protocol_importers.templates.gotostep.reason')}: #{item[:value]}" %>
- <%= render partial: 'protocol_importers/templates/details', locals: { item: item } %>
+
<%= t('protocol_importers.templates.note.title') %>
- <%= "#{t('protocol_importers.templates.note.author')}: #{item[:author]}" %>
- <%= item[:body] %>
<%= t('protocol_importers.templates.reagent.title') %>
- <%= "#{t('protocol_importers.templates.reagent.name')}: #{item[:name]}" %>
- <% if item[:source] %>
+ <%= "#{t('protocol_importers.templates.reagent.name')}: #{item[:name]}" %>
+ <% if item[:link].present? %>
<%= t('protocol_importers.templates.reagent.link') %>:
- <%= "#{item[:source]}" %>
- <% end -%>
+ <%= item[:link] %>
+ <% end %>
<%= t('protocol_importers.templates.software.title') %>
- <%= "#{t('protocol_importers.templates.software.name')}: #{item[:name]}" %>
- <%= "#{t('protocol_importers.templates.software.link')}: #{ActionController::Base.helpers.link_to(item[:source], item[:source])}" %>
+ <% if item[:name].present? %>
+ <%= "#{t('protocol_importers.templates.software.name')}: #{item[:name]}" %>
+ <% end %>
+
+ <% if item[:source].present? %>
+ <%= t('protocol_importers.templates.software.link') %>: <%= item[:source] %>
+ <% end %>
<%= t('protocol_importers.templates.warning.title') %>
+
<%= t('protocol_importers.templates.warning.title') %>
<%= item[:body] %>
<%= sanitize(@description[:body], tags: Constants::PROTOCOLS_DESC_TAGS) %>
<%= sanitize(@step_description[:body], tags: Constants::PROTOCOLS_DESC_TAGS) %>
<% end %> diff --git a/spec/fixtures/files/protocol_importers/normalized_single_protocol.json b/spec/fixtures/files/protocol_importers/normalized_single_protocol.json index 70b5892b0..29b823e1b 100644 --- a/spec/fixtures/files/protocol_importers/normalized_single_protocol.json +++ b/spec/fixtures/files/protocol_importers/normalized_single_protocol.json @@ -72,9 +72,9 @@ { "type": "reagent", "name": "2 mg Gastrin I, human", + "link": "https://www.biorbyt.com/gastrin-i-human-orb321073", "details": { "catalog_number": "", - "link": "https://www.biorbyt.com/gastrin-i-human-orb321073", "linear_formula": "C130H204N38O31S", "mol_weight": 0.1 } diff --git a/spec/fixtures/files/protocol_importers/protocols_io/v3/single_protocol.json b/spec/fixtures/files/protocol_importers/protocols_io/v3/single_protocol.json index df91692ca..db9046602 100644 --- a/spec/fixtures/files/protocol_importers/protocols_io/v3/single_protocol.json +++ b/spec/fixtures/files/protocol_importers/protocols_io/v3/single_protocol.json @@ -486,7 +486,7 @@ "mol_weight": 0.1, "name": "2 mg Gastrin I, human", "linfor": "C130H204N38O31S", - "url": "", + "url": "https://www.biorbyt.com/gastrin-i-human-orb321073", "sku": "", "public": 0, "vendor": {