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 f8c83547d..36400d80e 100644 --- a/app/utilities/protocol_importers/protocols_io/v3/step_components.rb +++ b/app/utilities/protocol_importers/protocols_io/v3/step_components.rb @@ -115,10 +115,11 @@ module ProtocolImporters { type: 'reagent', name: desc_component[:source][:name], - mol_weight: desc_component[:source][:mol_weight], details: { + catalog_number: desc_component[:source][:sku], link: desc_component[:source][:vendor][:link], - linear_formula: desc_component[:source][:linfor] + linear_formula: desc_component[:source][:linfor], + mol_weight: desc_component[:source][:mol_weight] } } when :gotostep diff --git a/app/views/protocol_importers/templates/_details.html.erb b/app/views/protocol_importers/templates/_details.html.erb index 40fee2b91..99b88b066 100644 --- a/app/views/protocol_importers/templates/_details.html.erb +++ b/app/views/protocol_importers/templates/_details.html.erb @@ -1,6 +1,10 @@

- <%= item[:details]&.any? ? "#{t('protocol_importers.templates.details.title') }" : '' %> - <% item[:details]&.each do |k, v| %> - <%= "#{k.camelize.to_s}: #{v.to_s}" %> + <% if item[:details]&.any? %> + <%= t('protocol_importers.templates.details.title')%>: +
+ <% item[:details].reject { |_,v| v.blank? }.each do |k, v| %> + <%= "#{k.humanize}: #{v.to_s}" %> +
+ <% end %> <% end %>

diff --git a/app/views/protocol_importers/templates/_reagent.html.erb b/app/views/protocol_importers/templates/_reagent.html.erb index 589e8598a..fcf991475 100644 --- a/app/views/protocol_importers/templates/_reagent.html.erb +++ b/app/views/protocol_importers/templates/_reagent.html.erb @@ -1,7 +1,15 @@ -

<%= t('protocol_importers.templates.reagent.title') %>
+

+ <%= t('protocol_importers.templates.reagent.title') %> +
<%= "#{t('protocol_importers.templates.reagent.name')}: #{item[:name]}" %> - <%= "#{t('protocol_importers.templates.reagent.mol_weight')}: #{item[:mol_weight]}" %> - <%= "#{t('protocol_importers.templates.reagent.link')}: #{item[:source]}" if item[:source] %> + <% if item[:source] %> + <%= t('protocol_importers.templates.reagent.link') %>: + <%= "#{item[:source]}" %> + <% end -%>

-<%= render partial: 'protocol_importers/templates/details', locals: { item: item } %> +<%= render( + partial: 'protocol_importers/templates/details', + locals: { item: item } + ) +%> diff --git a/spec/fixtures/files/protocol_importers/normalized_single_protocol.json b/spec/fixtures/files/protocol_importers/normalized_single_protocol.json index 9ade81ca8..ed84e621b 100644 --- a/spec/fixtures/files/protocol_importers/normalized_single_protocol.json +++ b/spec/fixtures/files/protocol_importers/normalized_single_protocol.json @@ -72,10 +72,11 @@ { "type": "reagent", "name": "2 mg Gastrin I, human", - "mol_weight": 0.1, "details": { + "catalog_number": "", "link": "https://www.biorbyt.com/gastrin-i-human-orb321073", - "linear_formula": "C130H204N38O31S" + "linear_formula": "C130H204N38O31S", + "mol_weight": 0.1 } }, {