mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-06 23:15:34 +08:00
vastly improved protocol preview styling to look more like documentation specifications
This commit is contained in:
parent
8da72eb64a
commit
df8cbc2741
1 changed files with 146 additions and 91 deletions
|
@ -63,62 +63,111 @@
|
||||||
|
|
||||||
<!-- Preview scroller -->
|
<!-- Preview scroller -->
|
||||||
|
|
||||||
<div>
|
|
||||||
<div class="import-protocols-modal-preview-container-json" data-role="preview-container">
|
<div class="import-protocols-modal-preview-container-json" data-role="preview-container">
|
||||||
<table>
|
|
||||||
|
|
||||||
<% if @json_object["before_start"]&&@json_object["before_start"]!="" %>
|
<% if @json_object["before_start"]&&@json_object["before_start"]!="" %>
|
||||||
<tr>
|
|
||||||
<td>
|
<br><strong>Before starting protocol information:</strong><br>
|
||||||
<h2>Before starting protocol information</h2>
|
|
||||||
<%= (@json_object["before_start"]) %>
|
<%= (@json_object["before_start"]) %>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @json_object["warning"]&&@json_object["warning"]!="" %>
|
<% if @json_object["warning"]&&@json_object["warning"]!="" %>
|
||||||
<tr>
|
|
||||||
<td>
|
<br><strong>Protocol warning:</strong><br>
|
||||||
<h2>Protocol warning</h2>
|
|
||||||
<%= (@json_object["warning"]) %>
|
<%= (@json_object["warning"]) %>
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @json_object["guidelines"]&&@json_object["guidelines"]!="" %>
|
<% if @json_object["guidelines"]&&@json_object["guidelines"]!="" %>
|
||||||
<tr>
|
|
||||||
<td>
|
<br><strong>Guidelines:</strong><br>
|
||||||
<h2>Guidelines</h2>
|
|
||||||
<%= (@json_object["guidelines"]) %>
|
<%= (@json_object["guidelines"]) %>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<tr><td><br><br><div style="border-bottom-style:solid">
|
|
||||||
</div></td></tr>
|
|
||||||
<% counter=0 %>
|
<% counter=0 %>
|
||||||
<% whitelist_simple=["1","6","17"] %>
|
<% whitelist_simple=["1","6","17"] %>
|
||||||
<% whitelist_complex=["8","9","15","18","19","20"]%>
|
<% whitelist_complex=["8","9","15","18","19","20"]%>
|
||||||
<% @json_object["steps"].each do |step| %>
|
<% @json_object["steps"].each do |step| %>
|
||||||
<tr>
|
<div style="display: block;">
|
||||||
<td> <h3>Step <%= (counter+=1).to_s %> </h3><br>
|
<hr>
|
||||||
Step guid (Protocols.io) :<%= step["guid"] %>
|
<td>
|
||||||
<% if counter>1 #only steps after the first one have previous step guid field valid%>
|
<div class="badge-num">
|
||||||
<br>Guid of previous step (Protocols.io) :<%= step["previous_guid"] %>
|
<span class="badge-preview bg-primary size-digit-1">
|
||||||
<% end %>
|
<b data-val="position"><%= (counter+=1) %></b>
|
||||||
<% step["components"].each do |key,value| %>
|
</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="step-panel-collapse-link" data-toggle="collapse">
|
||||||
|
<span class="glyphicon collapse-step-icon glyphicon-collapse-up"></span>
|
||||||
|
|
||||||
|
|
||||||
|
<%#= Step guid (Protocols.io) :%><%#= step["guid"] %>
|
||||||
|
<%# if counter>1 #only steps after the first one have previous step guid field valid%>
|
||||||
|
<%#=Guid of previous step (Protocols.io) :%><%#= step["previous_guid"] %>
|
||||||
|
<%# end %>
|
||||||
|
<% title=nil %>
|
||||||
|
<% step["components"].each do |key1,value1| #finding section (title of step) %>
|
||||||
|
|
||||||
|
<% if counter >1 %>
|
||||||
|
<% if(key1["component_type_id"]=="6") %>
|
||||||
|
<% if(!key1["data"].nil? && key1["data"]!="") %>
|
||||||
|
<%# byebug %>
|
||||||
|
<% title ||=key1["data"] %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<% unless value1 %>
|
||||||
|
<% value1=key1 %>
|
||||||
|
<% end %>
|
||||||
|
<% if(value1["component_type_id"]=="6") %>
|
||||||
|
<% if(!value1["data"].nil? && value1["data"]!="") %>
|
||||||
|
<% #byebug %>
|
||||||
|
<% title ||=value1["data"] %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% if title.nil? %>
|
||||||
|
<%# byebug %>
|
||||||
|
<% title ="Protocols.io" %>
|
||||||
|
<% end %>
|
||||||
|
<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| %>
|
||||||
|
|
||||||
<% if counter>1 #here i made an if to distinguish the first step from the others, because the first step
|
<% if counter>1 #here i made an if to distinguish the first step from the others, because the first step
|
||||||
#sometimes has weird nesting that makes the below outputs not work
|
#sometimes has weird nesting that makes the below outputs not work
|
||||||
%>
|
%>
|
||||||
<% if whitelist_simple.include?(key["component_type_id"]) && key["data"]!="" && key["name"] && key["data"]%>
|
<% #byebug %>
|
||||||
<br>
|
<% if whitelist_simple.include?(key["component_type_id"]) && key["data"]!="" && key["data"] %>
|
||||||
<%= (key["name"])+" : "+ (key["data"]) %>
|
<br>
|
||||||
|
<% case key["component_type_id"]%>
|
||||||
|
<% when "6" %>
|
||||||
|
|
||||||
|
<% when "1" %>
|
||||||
|
<br><strong>Description: </strong> <%=key["data"]%><br>
|
||||||
|
<% when "17" %>
|
||||||
|
<br><strong>Expected result: </strong> <%=key["data"]%><br>
|
||||||
|
<% else %>
|
||||||
|
<% end %>
|
||||||
<% elsif key && whitelist_complex.include?(key["component_type_id"]) %>
|
<% elsif key && whitelist_complex.include?(key["component_type_id"]) %>
|
||||||
|
|
||||||
<% case key["component_type_id"]%>
|
<% case key["component_type_id"]%>
|
||||||
<% when "8"%>
|
<% when "8"%>
|
||||||
<br>
|
<br>
|
||||||
<%= "-"+(key["name"])+" : "+(key["source_data"]["name"]) %>
|
<strong><%= key["name"]+": " %></strong> <%= (key["source_data"]["name"]) %>
|
||||||
<br>
|
<br>
|
||||||
Developer : <%= (key["source_data"]["developer"]) %>
|
Developer : <%= (key["source_data"]["developer"]) %>
|
||||||
<br>
|
<br>
|
||||||
|
@ -132,14 +181,14 @@
|
||||||
|
|
||||||
<% when "9"%>
|
<% when "9"%>
|
||||||
<br>
|
<br>
|
||||||
<%= "-"+(key["name"])+" : "+(key["source_data"]["name"]) %>
|
<strong><%= key["name"]+": " %></strong> <%= key["source_data"]["name"] %>
|
||||||
<br>
|
<br>
|
||||||
Link : <%= (key["source_data"]["link"]) %>
|
Link : <%= (key["source_data"]["link"]) %>
|
||||||
|
|
||||||
|
|
||||||
<% when "15"%>
|
<% when "15"%>
|
||||||
<br>
|
<br>
|
||||||
<%= "-"+(key["name"])+" : "+(key["source_data"]["name"]) %>
|
<strong><%= key["name"]+": " %></strong> <%= key["source_data"]["name"] %>
|
||||||
<br>
|
<br>
|
||||||
Description : <%= (key["source_data"]["description"]) %>
|
Description : <%= (key["source_data"]["description"]) %>
|
||||||
<br>
|
<br>
|
||||||
|
@ -147,7 +196,7 @@
|
||||||
|
|
||||||
<% when "18"%>
|
<% when "18"%>
|
||||||
<br>
|
<br>
|
||||||
-This protocol also contains an attached sub-protocol: <%= (key["source_data"]["protocol_name"]) %>
|
<strong>This protocol also contains an attached sub-protocol: </strong> <%= (key["source_data"]["protocol_name"]) %>
|
||||||
<br>
|
<br>
|
||||||
Author: <%= (key["source_data"]["full_name"]) %>
|
Author: <%= (key["source_data"]["full_name"]) %>
|
||||||
<br>
|
<br>
|
||||||
|
@ -156,7 +205,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% when "19"%>
|
<% when "19"%>
|
||||||
<br>
|
<br>
|
||||||
<%= "-"+(key["name"])+" : "+(key["source_data"]["body"]) %>
|
<strong><%= key["name"]+": " %></strong> <%= key["source_data"]["body"] %>
|
||||||
<br>
|
<br>
|
||||||
Link : <%= (key["source_data"]["link"]) %>
|
Link : <%= (key["source_data"]["link"]) %>
|
||||||
|
|
||||||
|
@ -167,31 +216,31 @@
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<% end #notranji if št 1%>
|
<% end #notranji if št 1%>
|
||||||
|
|
||||||
|
<% else #if first step %>
|
||||||
<% else #če ni prvi korak %>
|
|
||||||
|
|
||||||
<% unless value %>
|
<% unless value %>
|
||||||
<% value=key #json format ima random arraye namest hashov, ta problem je opisan pri if counter > 1 stavku %>
|
<% value=key #protocols io first step json formating is sometimes broken, this is a workaround%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% #byebug %>
|
||||||
|
<% if whitelist_simple.include?(value["component_type_id"]) && value["data"] && value["data"]!="" %>
|
||||||
|
<br>
|
||||||
|
<% case value["component_type_id"]%>
|
||||||
|
<% when "6" %>
|
||||||
|
|
||||||
<% if whitelist_simple.include?(value["component_type_id"])&& value["data"]!="" && value["name"] && value["data"] %>
|
<% when "1" %>
|
||||||
<br>
|
<br><strong>Description: </strong> <%=value["data"]%><br>
|
||||||
<%= (value["name"])+" : "+(value["data"]) %>
|
<% when "17" %>
|
||||||
<%
|
<br><strong>Expected result: </strong> <%=value["data"]%><br>
|
||||||
#debug
|
<% else %>
|
||||||
#comp[counter];counter;@json.file_contents["steps"][3]["components"][0]["name"]
|
<% end %>
|
||||||
#@json.file_contents["steps"][0]["components"]
|
|
||||||
%>
|
|
||||||
|
|
||||||
<% elsif value && whitelist_complex.include?(value["component_type_id"]) %>
|
<% elsif value && whitelist_complex.include?(value["component_type_id"]) %>
|
||||||
<% case value["component_type_id"]%>
|
<% case value["component_type_id"]%>
|
||||||
<% when "8"%>
|
<% when "8"%>
|
||||||
<br>
|
<br>
|
||||||
<%= "-"+(value["name"])+" : "+(value["source_data"]["name"]) %>
|
<strong><%= value["name"]+": " %></strong> <%= (value["source_data"]["name"]) %>
|
||||||
<br>
|
<br>
|
||||||
Developer : <%= (value["source_data"]["developer"]) %>
|
Developer : <%= (value["source_data"]["developer"]) %>
|
||||||
<br>
|
<br>
|
||||||
|
@ -205,14 +254,14 @@
|
||||||
|
|
||||||
<% when "9"%>
|
<% when "9"%>
|
||||||
<br>
|
<br>
|
||||||
<%= "-"+(value["name"])+" : "+(value["source_data"]["name"]) %>
|
<strong><%= value["name"]+": " %></strong> <%= value["source_data"]["name"] %>
|
||||||
<br>
|
<br>
|
||||||
Link : <%= (value["source_data"]["link"]) %>
|
Link : <%= (value["source_data"]["link"]) %>
|
||||||
|
|
||||||
|
|
||||||
<% when "15"%>
|
<% when "15"%>
|
||||||
<br>
|
<br>
|
||||||
<%= "-"+(value["name"])+" : "+(value["source_data"]["name"]) %>
|
<strong><%= value["name"]+": " %></strong> <%= value["source_data"]["name"] %>
|
||||||
<br>
|
<br>
|
||||||
Description : <%= (value["source_data"]["description"]) %>
|
Description : <%= (value["source_data"]["description"]) %>
|
||||||
<br>
|
<br>
|
||||||
|
@ -220,17 +269,16 @@
|
||||||
|
|
||||||
<% when "18"%>
|
<% when "18"%>
|
||||||
<br>
|
<br>
|
||||||
-This protocol also contains an attached sub-protocol: <%= (value["source_data"]["protocol_name"]) %>
|
<strong>This protocol also contains an attached sub-protocol: </strong> <%= (value["source_data"]["protocol_name"]) %>
|
||||||
<br>
|
<br>
|
||||||
Author: <%= (value["source_data"]["full_name"]) %>
|
Author: <%= (value["source_data"]["full_name"]) %>
|
||||||
|
|
||||||
<% if value["source_data"]["link"]&&value["source_data"]["link"]!="" %>
|
|
||||||
<br>
|
<br>
|
||||||
|
<% if value["source_data"]["link"]&&value["source_data"]["link"]!="" %>
|
||||||
Link: <%= (value["source_data"]["link"]) %>
|
Link: <%= (value["source_data"]["link"]) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% when "19"%>
|
<% when "19"%>
|
||||||
<br>
|
<br>
|
||||||
<%= "-"+(value["name"])+" : "+(value["source_data"]["body"]) %>
|
<strong><%= value["name"]+": " %></strong> <%= value["source_data"]["body"] %>
|
||||||
<br>
|
<br>
|
||||||
Link : <%= (value["source_data"]["link"]) %>
|
Link : <%= (value["source_data"]["link"]) %>
|
||||||
|
|
||||||
|
@ -244,64 +292,71 @@
|
||||||
<% end #inner whitelist if%>
|
<% end #inner whitelist if%>
|
||||||
<% end #first step if %>
|
<% end #first step if %>
|
||||||
<% end #step component loop %>
|
<% end #step component loop %>
|
||||||
</td>
|
|
||||||
</tr>
|
</div>
|
||||||
|
<hr>
|
||||||
|
<!-- <div class="row">
|
||||||
|
<div data-toggle="tables" class="col-xs-12" style="display: none;">
|
||||||
|
<div data-hold="tables"> </div>
|
||||||
|
</div>
|
||||||
|
<div data-toggle="assets" class="col-xs-12" style="display: none;">
|
||||||
|
<strong>Files</strong>
|
||||||
|
<ul data-hold="assets">
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div data-hold="checklists"></div>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div> <%# div od blocka %>
|
||||||
<% end #step loop%>
|
<% end #step loop%>
|
||||||
<tr><td><br><br><div style="border-bottom-style:solid">
|
|
||||||
</div></td></tr>
|
|
||||||
|
|
||||||
<% if @json_object["manuscript_citation"]&&@json_object["manuscript_citation"]!="" %>
|
<% if @json_object["manuscript_citation"]&&@json_object["manuscript_citation"]!="" %>
|
||||||
<tr>
|
|
||||||
<td>
|
<br><strong>Manuscript citation</strong><br>
|
||||||
<h4>Manuscript citation</h4>
|
|
||||||
<%= (@json_object["manuscript_citation"]) %>
|
<%= (@json_object["manuscript_citation"]) %>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @json_object["publish_date"]&&@json_object["publish_date"]!="" %>
|
<% if @json_object["publish_date"]&&@json_object["publish_date"]!="" %>
|
||||||
<tr>
|
|
||||||
<td>
|
<br><strong>Publish date</strong><br>
|
||||||
<h4>Publish date</h4>
|
|
||||||
<%= (@json_object["publish_date"]) %>
|
<%= (@json_object["publish_date"]) %>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @json_object["vendor_name"]&&@json_object["vendor_name"]!="" %>
|
<% if @json_object["vendor_name"]&&@json_object["vendor_name"]!="" %>
|
||||||
<tr>
|
|
||||||
<td>
|
<br><strong>Vendor name</strong><br>
|
||||||
<h4>Vendor name</h4>
|
|
||||||
<%= (@json_object["vendor_name"]) %>
|
<%= (@json_object["vendor_name"]) %>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @json_object["vendor_link"]&&@json_object["vendor_link"]!="" %>
|
<% if @json_object["vendor_link"]&&@json_object["vendor_link"]!="" %>
|
||||||
<tr>
|
|
||||||
<td>
|
<br><strong>Vendor link</strong><br>
|
||||||
<h4>Vendor link</h4>
|
|
||||||
<%= (@json_object["vendor_link"]) %>
|
<%= (@json_object["vendor_link"]) %>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @json_object["keywords"]&&@json_object["keywords"]!="" %>
|
<% if @json_object["keywords"]&&@json_object["keywords"]!="" %>
|
||||||
<tr>
|
|
||||||
<td>
|
<br><strong>Keywords</strong><br>
|
||||||
<h4>Keywords</h4>
|
|
||||||
<%= (@json_object["keywords"]) %>
|
<%= (@json_object["keywords"]) %>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @json_object["tags"]&&@json_object["tags"]!="" %>
|
<% if @json_object["tags"]&&@json_object["tags"]!="" %>
|
||||||
<tr>
|
|
||||||
<td>
|
<br><strong>Tags</strong><br>
|
||||||
<h4>Tags</h4>
|
|
||||||
<% @json_object["tags"].each do |tag| %>
|
<% @json_object["tags"].each do |tag| %>
|
||||||
<%= (tag["tag_name"])+" , " %>
|
<%= (tag["tag_name"])+" , " %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|
Loading…
Reference in a new issue