From 6f56f829da916ea847f7639a8ca8fa085bc247b3 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Fri, 26 Jan 2018 10:49:38 +0100 Subject: [PATCH] Now protocols name from attached protocol is shortened based on title limit length (255 characters),also has same limitations as scinote title --- app/helpers/protocols_io_helper.rb | 10 +++++++--- .../_import_json_protocol_s_desc.html.erb | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/helpers/protocols_io_helper.rb b/app/helpers/protocols_io_helper.rb index e4eb5f70a..e826411d7 100644 --- a/app/helpers/protocols_io_helper.rb +++ b/app/helpers/protocols_io_helper.rb @@ -175,9 +175,13 @@ module ProtocolsIoHelper else ' , ' end - output_string += prepare_for_view( - attribute_text, ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_SMALL - ) + if attribute_name == 'protocol_name' + output_string += pio_eval_title_len(attribute_text) + else + output_string += prepare_for_view( + attribute_text, ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_SMALL + ) + end output_string end diff --git a/app/views/protocols/import_export/_import_json_protocol_s_desc.html.erb b/app/views/protocols/import_export/_import_json_protocol_s_desc.html.erb index 7c3c82092..1862c22ea 100644 --- a/app/views/protocols/import_export/_import_json_protocol_s_desc.html.erb +++ b/app/views/protocols/import_export/_import_json_protocol_s_desc.html.erb @@ -98,7 +98,7 @@ <% when '18'%>
<%= t('protocols.protocols_io_import.preview.sub_prot') %> - <%= prepare_for_view(key['source_data']['protocol_name'],ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_SMALL,'table').html_safe %> + <%= pio_eval_title_len(sanitize_input(key['source_data']['protocol_name'])).html_safe %>
<%= t('protocols.protocols_io_import.preview.auth') %> <%= prepare_for_view(key['source_data']['full_name'],ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_SMALL,'table').html_safe %>