mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-16 01:54:34 +08:00
most protocol attributes, and step description and step expected result now dont get cut tables when they are at max character limit
This commit is contained in:
parent
9b5ddc6789
commit
f9c6eafe49
1 changed files with 12 additions and 7 deletions
|
@ -175,7 +175,6 @@ module ProtocolsIoHelper
|
||||||
else
|
else
|
||||||
' , '
|
' , '
|
||||||
end
|
end
|
||||||
# intercept tables here, before they are shortened
|
|
||||||
if attribute_name == 'protocol_name'
|
if attribute_name == 'protocol_name'
|
||||||
output_string += pio_eval_title_len(attribute_text)
|
output_string += pio_eval_title_len(attribute_text)
|
||||||
else
|
else
|
||||||
|
@ -190,7 +189,7 @@ module ProtocolsIoHelper
|
||||||
def pio_stp_1(iterating_key) # protocols io description parser
|
def pio_stp_1(iterating_key) # protocols io description parser
|
||||||
br = '<br>'
|
br = '<br>'
|
||||||
append =
|
append =
|
||||||
if iterating_key.present? # intercept tables here before cutting
|
if iterating_key.present?
|
||||||
br +
|
br +
|
||||||
prepare_for_view(
|
prepare_for_view(
|
||||||
iterating_key,
|
iterating_key,
|
||||||
|
@ -214,7 +213,7 @@ module ProtocolsIoHelper
|
||||||
if iterating_key.present?
|
if iterating_key.present?
|
||||||
append =
|
append =
|
||||||
t('protocols.protocols_io_import.comp_append.expected_result') +
|
t('protocols.protocols_io_import.comp_append.expected_result') +
|
||||||
prepare_for_view( # intercept tables here, before cutting
|
prepare_for_view(
|
||||||
iterating_key, ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_SMALL
|
iterating_key, ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_SMALL
|
||||||
) +
|
) +
|
||||||
'<br>'
|
'<br>'
|
||||||
|
@ -229,7 +228,7 @@ module ProtocolsIoHelper
|
||||||
parse_elements_array.each do |element|
|
parse_elements_array.each do |element|
|
||||||
return '' unless iterating_key[element]
|
return '' unless iterating_key[element]
|
||||||
append += fill_attributes(
|
append += fill_attributes(
|
||||||
element, # intercept tables here, before cutting
|
element,
|
||||||
iterating_key[element],
|
iterating_key[element],
|
||||||
en_local_text
|
en_local_text
|
||||||
)
|
)
|
||||||
|
@ -250,7 +249,7 @@ module ProtocolsIoHelper
|
||||||
t('protocols.protocols_io_import.preview.description') +
|
t('protocols.protocols_io_import.preview.description') +
|
||||||
'</strong>' +
|
'</strong>' +
|
||||||
prepare_for_view(
|
prepare_for_view(
|
||||||
json_hash['description'], # intercept tables here, before they are cut
|
json_hash['description'],
|
||||||
ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_MEDIUM
|
ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_MEDIUM
|
||||||
).html_safe
|
).html_safe
|
||||||
else
|
else
|
||||||
|
@ -351,6 +350,7 @@ module ProtocolsIoHelper
|
||||||
newj[i.to_s]['position'] = i
|
newj[i.to_s]['position'] = i
|
||||||
newj[i.to_s]['description'] = '' unless newj[i.to_s].key?('description')
|
newj[i.to_s]['description'] = '' unless newj[i.to_s].key?('description')
|
||||||
newj[i.to_s]['name'] = '' unless newj[i.to_s].key?('name')
|
newj[i.to_s]['name'] = '' unless newj[i.to_s].key?('name')
|
||||||
|
unshortened_step_table_string = ''
|
||||||
step['components'].each do |key, value|
|
step['components'].each do |key, value|
|
||||||
# sometimes there are random index values as keys
|
# sometimes there are random index values as keys
|
||||||
# instead of hashes, this is a workaround to that buggy json format
|
# instead of hashes, this is a workaround to that buggy json format
|
||||||
|
@ -360,10 +360,12 @@ module ProtocolsIoHelper
|
||||||
case key['component_type_id']
|
case key['component_type_id']
|
||||||
# intercept tables in all of below before cutting
|
# intercept tables in all of below before cutting
|
||||||
when '1'
|
when '1'
|
||||||
|
unshortened_step_table_string += key['data']
|
||||||
newj[i.to_s]['description'] += pio_stp_1(key['data'])
|
newj[i.to_s]['description'] += pio_stp_1(key['data'])
|
||||||
when '6'
|
when '6'
|
||||||
newj[i.to_s]['name'] = pio_stp_6(key['data'])
|
newj[i.to_s]['name'] = pio_stp_6(key['data'])
|
||||||
when '17'
|
when '17'
|
||||||
|
unshortened_step_table_string += key['data']
|
||||||
newj[i.to_s]['description'] += pio_stp_17(key['data'])
|
newj[i.to_s]['description'] += pio_stp_17(key['data'])
|
||||||
when '8'
|
when '8'
|
||||||
pe_array = %w(
|
pe_array = %w(
|
||||||
|
@ -407,10 +409,13 @@ module ProtocolsIoHelper
|
||||||
)
|
)
|
||||||
end # case end
|
end # case end
|
||||||
end # finished looping over step components
|
end # finished looping over step components
|
||||||
newj[i.to_s]['tables'], table_str = protocolsio_string_to_table_element(
|
table_str = protocolsio_string_to_table_element(
|
||||||
newj[i.to_s]['description']
|
newj[i.to_s]['description']
|
||||||
)
|
)[1]
|
||||||
newj[i.to_s]['description'] = table_str
|
newj[i.to_s]['description'] = table_str
|
||||||
|
newj[i.to_s]['tables'] = protocolsio_string_to_table_element(
|
||||||
|
sanitize_input(unshortened_step_table_string).html_safe
|
||||||
|
)[0]
|
||||||
end # steps
|
end # steps
|
||||||
newj
|
newj
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue