Merge pull request #990 from Zanz2/code_formatting_sci1822

Commands in protocols io steps are now properly formatted like code [SCI-1822]
This commit is contained in:
Zanz2 2018-02-08 08:52:44 +01:00 committed by GitHub
commit 128f15f984
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -154,6 +154,7 @@ module ProtocolsIoHelper
attribute_text1, size, table = 'no_table', image_allowed = false attribute_text1, size, table = 'no_table', image_allowed = false
) )
image_tag = image_allowed ? Array('img') : Array(nil) image_tag = image_allowed ? Array('img') : Array(nil)
image_tag.push('br')
if table == 'no_table' if table == 'no_table'
attribute_text = sanitize_input(not_null(attribute_text1), image_tag) attribute_text = sanitize_input(not_null(attribute_text1), image_tag)
elsif table == 'table' elsif table == 'table'
@ -393,6 +394,10 @@ module ProtocolsIoHelper
pe_array = %w( pe_array = %w(
name description os_name os_version name description os_name os_version
) )
key['source_data']['name'] =
'<pre><code>' +
not_null(key['source_data']['name'].gsub(/\n/, '<br>')) +
'</code></pre>'
trans_text = 'protocols.protocols_io_import.comp_append.command.' trans_text = 'protocols.protocols_io_import.comp_append.command.'
newj[i.to_s]['description'] += pio_stp( newj[i.to_s]['description'] += pio_stp(
key['source_data'], pe_array, trans_text key['source_data'], pe_array, trans_text

View file

@ -87,7 +87,7 @@
<% step_info_string += not_null(key['source_data']['description']) %> <% step_info_string += not_null(key['source_data']['description']) %>
<br> <br>
<strong><%= key['name']+': ' %></strong> <strong><%= key['name']+': ' %></strong>
<%= prepare_for_view(key['source_data']['name'],ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_SMALL,'table').html_safe %> <%= prepare_for_view('<pre><code>'+key['source_data']['name'].gsub(/\n/, '<br>')+'</code></pre>',ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_SMALL,'table').html_safe %>
<br> <br>
<%= t('protocols.protocols_io_import.preview.s_desc') %> <%= t('protocols.protocols_io_import.preview.s_desc') %>
<%= prepare_for_view(key['source_data']['description'],ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_SMALL,'table').html_safe %> <%= prepare_for_view(key['source_data']['description'],ProtocolsIoHelper::PIO_ELEMENT_RESERVED_LENGTH_SMALL,'table').html_safe %>