mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-08 21:06:24 +08:00
Put the two blocks of code into seperate partials
This commit is contained in:
parent
67b09adaeb
commit
ae9ac46472
3 changed files with 190 additions and 187 deletions
|
@ -0,0 +1,66 @@
|
||||||
|
|
||||||
|
<div style="display: block;">
|
||||||
|
<hr>
|
||||||
|
<td>
|
||||||
|
<div class="badge-num">
|
||||||
|
<span class="badge-preview bg-primary size-digit-1">
|
||||||
|
<b data-val="position"><%= 1 %></b>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span class="step-panel-collapse-link" data-toggle="collapse">
|
||||||
|
<span class="glyphicon collapse-step-icon glyphicon-collapse-up"></span>
|
||||||
|
<strong data-val="name"><%= 'Protocol info' %></strong>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
<div class="tab-pane active" role="tabpanel">
|
||||||
|
<div data-val="description" class="ql-editor">
|
||||||
|
<br>
|
||||||
|
<% if json_object['before_start'].present? %>
|
||||||
|
<strong><%= t('protocols.protocols_io_import.preview.b_s_p') %></strong>
|
||||||
|
<%= sanitize_input(json_object['before_start'].html_safe) %><br>
|
||||||
|
<% end %>
|
||||||
|
<% if json_object['warning'].present? %>
|
||||||
|
<strong><%= t('protocols.protocols_io_import.preview.warn') %></strong>
|
||||||
|
<%= sanitize_input(json_object['warning'].html_safe) %><br>
|
||||||
|
<% end %>
|
||||||
|
<% if json_object['guidelines'].present? %>
|
||||||
|
<strong><%= t('protocols.protocols_io_import.preview.guideln') %></strong>
|
||||||
|
<%= sanitize_input(json_object['guidelines'].html_safe) %><br>
|
||||||
|
<% end %>
|
||||||
|
<% if json_object['link'].present? %>
|
||||||
|
<strong><%= t('protocols.protocols_io_import.preview.p_link') %></strong>
|
||||||
|
<%= sanitize_input(json_object['link'].html_safe) %><br>
|
||||||
|
<% end %>
|
||||||
|
<% if json_object['manuscript_citation'].present? %>
|
||||||
|
<strong><%= t('protocols.protocols_io_import.preview.manu_cit') %></strong>
|
||||||
|
<%= sanitize_input(json_object['manuscript_citation'].html_safe) %><br>
|
||||||
|
<% end %>
|
||||||
|
<% if json_object['publish_date'].present? %>
|
||||||
|
<strong><%= t('protocols.protocols_io_import.preview.pbl_date') %></strong>
|
||||||
|
<%= sanitize_input(json_object['publish_date']) %><br>
|
||||||
|
<% end %>
|
||||||
|
<% if json_object['vendor_name'].present? %>
|
||||||
|
<strong><%= t('protocols.protocols_io_import.preview.vnd_name') %></strong>
|
||||||
|
<%= sanitize_input(json_object['vendor_name']) %><br>
|
||||||
|
<% end %>
|
||||||
|
<% if json_object['vendor_link'].present? %>
|
||||||
|
<strong><%= t('protocols.protocols_io_import.preview.vnd_link') %></strong>
|
||||||
|
<%= sanitize_input(json_object['vendor_link'].html_safe) %><br>
|
||||||
|
<% end %>
|
||||||
|
<% if json_object['keywords'].present? %>
|
||||||
|
<strong><%= t('protocols.protocols_io_import.preview.key_wrd') %></strong>
|
||||||
|
<%= sanitize_input(json_object['keywords']) %><br>
|
||||||
|
<% end %>
|
||||||
|
<% if json_object['tags'].present? %>
|
||||||
|
<strong><%= t('protocols.protocols_io_import.preview.tags') %></strong>
|
||||||
|
<% json_object['tags'].each do |tag| %>
|
||||||
|
<%= sanitize_input(tag['tag_name'])+' , ' %><br>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -75,198 +75,14 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Preview scroller -->
|
<!-- Preview scroller -->
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="import-protocols-modal-preview-container-json"
|
class="import-protocols-modal-preview-container-json"
|
||||||
data-role="preview-container">
|
data-role="preview-container">
|
||||||
<div style="display: block;">
|
|
||||||
<hr>
|
|
||||||
<td>
|
|
||||||
<div class="badge-num">
|
|
||||||
<span class="badge-preview bg-primary size-digit-1">
|
|
||||||
<b data-val="position"><%= 1 %></b>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span class="step-panel-collapse-link" data-toggle="collapse">
|
|
||||||
<span class="glyphicon collapse-step-icon glyphicon-collapse-up"></span>
|
|
||||||
<strong data-val="name"><%= 'Protocol info' %></strong>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<div class="tab-content">
|
<!-- Partial -->
|
||||||
<div class="tab-pane active" role="tabpanel">
|
<%= render partial: "protocols/import_export/import_json_protocol_p_desc.html.erb", locals: {json_object: @json_object} %>
|
||||||
<div data-val="description" class="ql-editor">
|
<%= render partial: "protocols/import_export/import_json_protocol_s_desc.html.erb", locals: {json_object: @json_object} %>
|
||||||
<br>
|
|
||||||
<% if @json_object['before_start'].present? %>
|
|
||||||
<strong><%= t('protocols.protocols_io_import.preview.b_s_p') %></strong>
|
|
||||||
<%= sanitize_input(@json_object['before_start'].html_safe) %><br>
|
|
||||||
<% end %>
|
|
||||||
<% if @json_object['warning'].present? %>
|
|
||||||
<strong><%= t('protocols.protocols_io_import.preview.warn') %></strong>
|
|
||||||
<%= sanitize_input(@json_object['warning'].html_safe) %><br>
|
|
||||||
<% end %>
|
|
||||||
<% if @json_object['guidelines'].present? %>
|
|
||||||
<strong><%= t('protocols.protocols_io_import.preview.guideln') %></strong>
|
|
||||||
<%= sanitize_input(@json_object['guidelines'].html_safe) %><br>
|
|
||||||
<% end %>
|
|
||||||
<% if @json_object['link'].present? %>
|
|
||||||
<strong><%= t('protocols.protocols_io_import.preview.p_link') %></strong>
|
|
||||||
<%= sanitize_input(@json_object['link'].html_safe) %><br>
|
|
||||||
<% end %>
|
|
||||||
<% if @json_object['manuscript_citation'].present? %>
|
|
||||||
<strong><%= t('protocols.protocols_io_import.preview.manu_cit') %></strong>
|
|
||||||
<%= sanitize_input(@json_object['manuscript_citation'].html_safe) %><br>
|
|
||||||
<% end %>
|
|
||||||
<% if @json_object['publish_date'].present? %>
|
|
||||||
<strong><%= t('protocols.protocols_io_import.preview.pbl_date') %></strong>
|
|
||||||
<%= sanitize_input(@json_object['publish_date']) %><br>
|
|
||||||
<% end %>
|
|
||||||
<% if @json_object['vendor_name'].present? %>
|
|
||||||
<strong><%= t('protocols.protocols_io_import.preview.vnd_name') %></strong>
|
|
||||||
<%= sanitize_input(@json_object['vendor_name']) %><br>
|
|
||||||
<% end %>
|
|
||||||
<% if @json_object['vendor_link'].present? %>
|
|
||||||
<strong><%= t('protocols.protocols_io_import.preview.vnd_link') %></strong>
|
|
||||||
<%= sanitize_input(@json_object['vendor_link'].html_safe) %><br>
|
|
||||||
<% end %>
|
|
||||||
<% if @json_object['keywords'].present? %>
|
|
||||||
<strong><%= t('protocols.protocols_io_import.preview.key_wrd') %></strong>
|
|
||||||
<%= sanitize_input(@json_object['keywords']) %><br>
|
|
||||||
<% end %>
|
|
||||||
<% if @json_object['tags'].present? %>
|
|
||||||
<strong><%= t('protocols.protocols_io_import.preview.tags') %></strong>
|
|
||||||
<% @json_object['tags'].each do |tag| %>
|
|
||||||
<%= sanitize_input(tag['tag_name'])+' , ' %><br>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% whitelist_simple=['1','6','17'] %>
|
|
||||||
<% whitelist_complex=['8','9','15','18','19','20']%>
|
|
||||||
<% @json_object['steps'].each_with_index do |step,counter_orig| %>
|
|
||||||
<% counter = counter_orig + 1 %>
|
|
||||||
<div style="display: block;">
|
|
||||||
<hr>
|
|
||||||
<td>
|
|
||||||
<div class="badge-num">
|
|
||||||
<span class="badge-preview bg-primary size-digit-1">
|
|
||||||
<b data-val="position"><%= (counter+1) %></b>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span class="step-panel-collapse-link" data-toggle="collapse">
|
|
||||||
<span class="glyphicon collapse-step-icon glyphicon-collapse-up"></span>
|
|
||||||
|
|
||||||
<% title = nil %>
|
|
||||||
<% step['components'].each do |key1,value1| #finding section (title of step) %>
|
|
||||||
<% key1 = value1 if value1.class == Hash %>
|
|
||||||
<% if(key1['component_type_id']=='6') %>
|
|
||||||
<% title = sanitize_input(key1["data"]) if key1["data"].present? %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<% title ||=t('protocols.protocols_io_import.comp_append.missing_step') %>
|
|
||||||
<strong data-val="name"><%= title %></strong>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<div class="tab-content">
|
|
||||||
<div class="tab-pane active" role="tabpanel">
|
|
||||||
<div data-val="description" class="ql-editor">
|
|
||||||
|
|
||||||
<% step['components'].each do |key,value| %>
|
|
||||||
<%#here i made an if to distinguish the first step from the
|
|
||||||
others, because the first step #sometimes has index values as keys instead of
|
|
||||||
hashes, you might see this elsewhere %>
|
|
||||||
<% key = value if value.class == Hash %>
|
|
||||||
|
|
||||||
<% if whitelist_simple.include?(key['component_type_id']) &&
|
|
||||||
key['data'].present? %>
|
|
||||||
<br>
|
|
||||||
<% case key['component_type_id']
|
|
||||||
when '1' %>
|
|
||||||
<br><strong><%= t('protocols.protocols_io_import.preview.strng_s_desc') %></strong>
|
|
||||||
<%=sanitize_input(key['data'].html_safe)%><br>
|
|
||||||
<% when '17' %>
|
|
||||||
<br><strong><%= t('protocols.protocols_io_import.preview.s_exp_res') %></strong>
|
|
||||||
<%=sanitize_input(key['data'].html_safe)%>
|
|
||||||
<br>
|
|
||||||
<% end %>
|
|
||||||
<% elsif key && whitelist_complex.include?(key['component_type_id']) %>
|
|
||||||
|
|
||||||
<% case key['component_type_id']
|
|
||||||
when '8'%>
|
|
||||||
<br>
|
|
||||||
<strong><%= key['name']+': ' %></strong>
|
|
||||||
<%= sanitize_input(key['source_data']['name'].html_safe) %>
|
|
||||||
<br><%= t('protocols.protocols_io_import.preview.dev') %>
|
|
||||||
<%= sanitize_input(key['source_data']['developer'].html_safe) %>
|
|
||||||
<br><%= t('protocols.protocols_io_import.preview.vers') %>
|
|
||||||
<%= sanitize_input(key['source_data']['version'].html_safe) %>
|
|
||||||
<br><%= t('protocols.protocols_io_import.preview.s_link') %>
|
|
||||||
<%= sanitize_input(key['source_data']['link'].html_safe) %>
|
|
||||||
<br><%= t('protocols.protocols_io_import.preview.repo') %>
|
|
||||||
<%= sanitize_input(key['source_data']['repository'].html_safe) %>
|
|
||||||
<br><%= t('protocols.protocols_io_import.preview.os') %>
|
|
||||||
<%= sanitize_input(key['source_data']['os_name'].html_safe)+
|
|
||||||
' , '+sanitize_input(key['source_data']['os_version'].html_safe) %>
|
|
||||||
|
|
||||||
<% when '9'%>
|
|
||||||
<br>
|
|
||||||
<strong><%= key['name']+': ' %></strong>
|
|
||||||
<%= sanitize_input(key['source_data']['name'].html_safe) %>
|
|
||||||
<br><%= t('protocols.protocols_io_import.preview.s_link') %>
|
|
||||||
<%= sanitize_input(key['source_data']['link'].html_safe) %>
|
|
||||||
|
|
||||||
<% when '15'%>
|
|
||||||
<br>
|
|
||||||
<strong><%= key['name']+': ' %></strong>
|
|
||||||
<%= sanitize_input(key['source_data']['name'].html_safe) %>
|
|
||||||
<br><%= t('protocols.protocols_io_import.preview.s_desc') %>
|
|
||||||
<%= sanitize_input(key['source_data']['description'].html_safe) %>
|
|
||||||
<br><%= t('protocols.protocols_io_import.preview.os') %>
|
|
||||||
<%= sanitize_input(key['source_data']['os_name'].html_safe)+
|
|
||||||
' , '+sanitize_input(key['source_data']['os_version'].html_safe) %>
|
|
||||||
|
|
||||||
<% when '18'%>
|
|
||||||
<br><strong><%= t('protocols.protocols_io_import.preview.sub_prot') %></strong>
|
|
||||||
<%= sanitize_input(key['source_data']['protocol_name'].html_safe) %>
|
|
||||||
<br><%= t('protocols.protocols_io_import.preview.auth') %>
|
|
||||||
<%= sanitize_input(key['source_data']['full_name'].html_safe) %>
|
|
||||||
<br>
|
|
||||||
<% if key['source_data']['link'].present? %>
|
|
||||||
<%= t('protocols.protocols_io_import.preview.s_nobr_link') %>
|
|
||||||
<%= sanitize_input(key['source_data']['link'].html_safe) %>
|
|
||||||
<% end %>
|
|
||||||
<% when '19'%>
|
|
||||||
<br>
|
|
||||||
<strong><%= key['name']+': ' %></strong>
|
|
||||||
<%= sanitize_input(key['source_data']['body'].html_safe) %>
|
|
||||||
<br><%= t('protocols.protocols_io_import.preview.s_link') %>
|
|
||||||
<%= sanitize_input(key['source_data']['link'].html_safe) %>
|
|
||||||
|
|
||||||
<% when '20'%>
|
|
||||||
|
|
||||||
<% else %>
|
|
||||||
|
|
||||||
<% end #case if%>
|
|
||||||
|
|
||||||
<% end #inner if%>
|
|
||||||
<% end #step component loop %>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% end #step loop%>
|
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal"><%= t('general.cancel') %></button>
|
<button type="button" class="btn btn-default" data-dismiss="modal"><%= t('general.cancel') %></button>
|
||||||
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
<% whitelist_simple=['1','6','17'] %>
|
||||||
|
<% whitelist_complex=['8','9','15','18','19','20']%>
|
||||||
|
<% json_object['steps'].each_with_index do |step,counter_orig| %>
|
||||||
|
<% counter = counter_orig + 1 %>
|
||||||
|
<div style="display: block;">
|
||||||
|
<hr>
|
||||||
|
<td>
|
||||||
|
<div class="badge-num">
|
||||||
|
<span class="badge-preview bg-primary size-digit-1">
|
||||||
|
<b data-val="position"><%= (counter+1) %></b>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span class="step-panel-collapse-link" data-toggle="collapse">
|
||||||
|
<span class="glyphicon collapse-step-icon glyphicon-collapse-up"></span>
|
||||||
|
|
||||||
|
<% title = nil %>
|
||||||
|
<% step['components'].each do |key1,value1| #finding section (title of step) %>
|
||||||
|
<% key1 = value1 if value1.class == Hash %>
|
||||||
|
<% if(key1['component_type_id']=='6') %>
|
||||||
|
<% title = sanitize_input(key1["data"]) if key1["data"].present? %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% title ||=t('protocols.protocols_io_import.comp_append.missing_step') %>
|
||||||
|
<strong data-val="name"><%= title %></strong>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
<div class="tab-pane active" role="tabpanel">
|
||||||
|
<div data-val="description" class="ql-editor">
|
||||||
|
|
||||||
|
<% step['components'].each do |key,value| %>
|
||||||
|
<%#here i made an if to distinguish the first step from the
|
||||||
|
others, because the first step #sometimes has index values as keys instead of
|
||||||
|
hashes, you might see this elsewhere %>
|
||||||
|
<% key = value if value.class == Hash %>
|
||||||
|
|
||||||
|
<% if whitelist_simple.include?(key['component_type_id']) &&
|
||||||
|
key['data'].present? %>
|
||||||
|
<br>
|
||||||
|
<% case key['component_type_id']
|
||||||
|
when '1' %>
|
||||||
|
<br><strong><%= t('protocols.protocols_io_import.preview.strng_s_desc') %></strong>
|
||||||
|
<%=sanitize_input(key['data'].html_safe)%><br>
|
||||||
|
<% when '17' %>
|
||||||
|
<br><strong><%= t('protocols.protocols_io_import.preview.s_exp_res') %></strong>
|
||||||
|
<%=sanitize_input(key['data'].html_safe)%>
|
||||||
|
<br>
|
||||||
|
<% end %>
|
||||||
|
<% elsif key && whitelist_complex.include?(key['component_type_id']) %>
|
||||||
|
|
||||||
|
<% case key['component_type_id']
|
||||||
|
when '8'%>
|
||||||
|
<br>
|
||||||
|
<strong><%= key['name']+': ' %></strong>
|
||||||
|
<%= sanitize_input(key['source_data']['name'].html_safe) %>
|
||||||
|
<br><%= t('protocols.protocols_io_import.preview.dev') %>
|
||||||
|
<%= sanitize_input(key['source_data']['developer'].html_safe) %>
|
||||||
|
<br><%= t('protocols.protocols_io_import.preview.vers') %>
|
||||||
|
<%= sanitize_input(key['source_data']['version'].html_safe) %>
|
||||||
|
<br><%= t('protocols.protocols_io_import.preview.s_link') %>
|
||||||
|
<%= sanitize_input(key['source_data']['link'].html_safe) %>
|
||||||
|
<br><%= t('protocols.protocols_io_import.preview.repo') %>
|
||||||
|
<%= sanitize_input(key['source_data']['repository'].html_safe) %>
|
||||||
|
<br><%= t('protocols.protocols_io_import.preview.os') %>
|
||||||
|
<%= sanitize_input(key['source_data']['os_name'].html_safe)+
|
||||||
|
' , '+sanitize_input(key['source_data']['os_version'].html_safe) %>
|
||||||
|
|
||||||
|
<% when '9'%>
|
||||||
|
<br>
|
||||||
|
<strong><%= key['name']+': ' %></strong>
|
||||||
|
<%= sanitize_input(key['source_data']['name'].html_safe) %>
|
||||||
|
<br><%= t('protocols.protocols_io_import.preview.s_link') %>
|
||||||
|
<%= sanitize_input(key['source_data']['link'].html_safe) %>
|
||||||
|
|
||||||
|
<% when '15'%>
|
||||||
|
<br>
|
||||||
|
<strong><%= key['name']+': ' %></strong>
|
||||||
|
<%= sanitize_input(key['source_data']['name'].html_safe) %>
|
||||||
|
<br><%= t('protocols.protocols_io_import.preview.s_desc') %>
|
||||||
|
<%= sanitize_input(key['source_data']['description'].html_safe) %>
|
||||||
|
<br><%= t('protocols.protocols_io_import.preview.os') %>
|
||||||
|
<%= sanitize_input(key['source_data']['os_name'].html_safe)+
|
||||||
|
' , '+sanitize_input(key['source_data']['os_version'].html_safe) %>
|
||||||
|
|
||||||
|
<% when '18'%>
|
||||||
|
<br><strong><%= t('protocols.protocols_io_import.preview.sub_prot') %></strong>
|
||||||
|
<%= sanitize_input(key['source_data']['protocol_name'].html_safe) %>
|
||||||
|
<br><%= t('protocols.protocols_io_import.preview.auth') %>
|
||||||
|
<%= sanitize_input(key['source_data']['full_name'].html_safe) %>
|
||||||
|
<br>
|
||||||
|
<% if key['source_data']['link'].present? %>
|
||||||
|
<%= t('protocols.protocols_io_import.preview.s_nobr_link') %>
|
||||||
|
<%= sanitize_input(key['source_data']['link'].html_safe) %>
|
||||||
|
<% end %>
|
||||||
|
<% when '19'%>
|
||||||
|
<br>
|
||||||
|
<strong><%= key['name']+': ' %></strong>
|
||||||
|
<%= sanitize_input(key['source_data']['body'].html_safe) %>
|
||||||
|
<br><%= t('protocols.protocols_io_import.preview.s_link') %>
|
||||||
|
<%= sanitize_input(key['source_data']['link'].html_safe) %>
|
||||||
|
|
||||||
|
<% when '20'%>
|
||||||
|
|
||||||
|
<% else %>
|
||||||
|
|
||||||
|
<% end #case if%>
|
||||||
|
|
||||||
|
<% end #inner if%>
|
||||||
|
<% end #step component loop %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% end #step loop%>
|
||||||
|
<br>
|
Loading…
Add table
Reference in a new issue