diff --git a/app/helpers/protocols_io_helper.rb b/app/helpers/protocols_io_helper.rb
index 74cbddc4f..83705de64 100644
--- a/app/helpers/protocols_io_helper.rb
+++ b/app/helpers/protocols_io_helper.rb
@@ -153,8 +153,7 @@ module ProtocolsIoHelper
def prepare_for_view(
attribute_text1, size, table = 'no_table', image_allowed = false
)
- image_tag = Array(nil)
- image_tag = Array('img') if image_allowed
+ image_tag = image_allowed ? Array('img') : Array(nil)
if table == 'no_table'
attribute_text = sanitize_input(not_null(attribute_text1), image_tag)
elsif table == 'table'
@@ -301,9 +300,7 @@ module ProtocolsIoHelper
description_string += '
'
elsif json_hash[e].present?
new_e = '' + e.humanize + ''
-
- image_tag = Array(nil)
- image_tag = Array('img') if allowed_image_attributes.include? e
+ image_tag = allowed_image_attributes.include?(e) ? Array('img') : Array(nil)
description_string +=
new_e.to_s + ': ' +
pio_eval_prot_desc(
diff --git a/app/views/protocols/import_export/_import_json_protocol_p_desc.html.erb b/app/views/protocols/import_export/_import_json_protocol_p_desc.html.erb
index 1c35f1c2f..8b4e07ef1 100644
--- a/app/views/protocols/import_export/_import_json_protocol_p_desc.html.erb
+++ b/app/views/protocols/import_export/_import_json_protocol_p_desc.html.erb
@@ -32,9 +32,9 @@
publish_date: ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_SMALL,
link: ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_BIG,
vendor_link: ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_BIG } %>
- <% allowed_image_attributes = %w[
- ( description before_start warning guidelines manuscript_citation )
- ] %>
+ <% allowed_image_attributes = %w(
+ description before_start warning guidelines manuscript_citation
+ ) %>
<% protocol_attr_len_hash.each do |element, value|%>
<% element = element.to_s %>
@@ -51,9 +51,8 @@
<% prot_info_string += not_null(json_object[element]) if add_to_info_string_elements.include? element %>
<% translation_string = 'protocols.protocols_io_import.preview.' + element %>
<%= t(translation_string) %>
- <% image_tag = false %>
- <% image_tag = true if allowed_image_attributes.include? element %>
- <%= prepare_for_view(json_object[element],protocol_attr_len_hash[element.to_sym],'table',true).html_safe %>
+ <% image_tag = allowed_image_attributes.include?(element) ? true : false %>
+ <%= prepare_for_view(json_object[element],protocol_attr_len_hash[element.to_sym],'table',image_tag).html_safe %>
<% end %>
<% end %>