Fixed pr and small oversight

This commit is contained in:
Zanz2 2018-01-27 14:33:01 +01:00
parent 2a287193b7
commit 70a972c264
2 changed files with 7 additions and 11 deletions

View file

@ -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 += '<br>'
elsif json_hash[e].present?
new_e = '<strong>' + e.humanize + '</strong>'
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(

View file

@ -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 %>
<strong><%= t(translation_string) %></strong>
<% 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 %>
<br>
<% end %>