mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 01:44:34 +08:00
Addes steps, basic functionality is working, still need to style and fix bugs and upload to database etc
This commit is contained in:
parent
175aa16a7d
commit
d85e02730d
2 changed files with 196 additions and 47 deletions
|
@ -1270,8 +1270,35 @@ ul.content-module-activities {
|
|||
position: relative;
|
||||
top: -10px;
|
||||
}
|
||||
|
||||
}
|
||||
/* Import json protocols.io protocol modal */
|
||||
#modal-import-json-protocol-preview .modal-dialog {
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
.import-protocols-modal-preview-container-json {
|
||||
height: 300px;
|
||||
overflow-y: scroll;
|
||||
overflow-x: scroll;
|
||||
width: 100%;
|
||||
|
||||
.eln-table {
|
||||
text-align: center;
|
||||
height: 21px;
|
||||
}
|
||||
|
||||
.badge-preview {
|
||||
background-color: $color-silver;
|
||||
border-radius: 2em;
|
||||
float: left;
|
||||
font-size: 20px;
|
||||
padding: 5px 14px;
|
||||
position: relative;
|
||||
top: -10px;
|
||||
}
|
||||
|
||||
}
|
||||
/* Steps and Results */
|
||||
#steps {
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAABCAYAAACsXeyTAAAAIUlEQVQImWNgoD5gZGBgMILSjKRo/P//vwiSGQwMDAwMAEnaA0jgHoquAAAAAElFTkSuQmCC");
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
<b><%= t("protocols.import_export.import_modal.import_into_protocol_message") %></b>
|
||||
<br />
|
||||
</div>
|
||||
<% #puts json_object %>
|
||||
|
||||
|
||||
<!-- General protocol info -->
|
||||
|
@ -25,12 +24,12 @@
|
|||
<label for="protocol_authors">
|
||||
<span class="glyphicon glyphicon-user"></span> <%= t("protocols.import_export.import_modal.authors_label") %>
|
||||
</label>
|
||||
<%= f.text_field :authors, :value => json_object['username'], class: "form-control" %>
|
||||
<%= f.text_field :authors, :value => json_object['full_name'], class: "form-control" %>
|
||||
<!-- <input type="text" class="form-control" id="protocol_authors"> -->
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="import_protocol_description"><%= t("protocols.import_export.import_modal.description_label") %></label> -->
|
||||
<label for="import_protocol_description"><%= t("protocols.import_export.import_modal.description_label") %></label>
|
||||
<!-- <textarea class="form-control" id="import_protocol_description" rows="2"></textarea> -->
|
||||
<%= f.text_area :description, :value => json_object['description'], class: "form-control" %>
|
||||
</div>
|
||||
|
@ -39,12 +38,14 @@
|
|||
<div class="col-xs-4">
|
||||
<label for="protocol_created_at"><%= t("protocols.import_export.import_modal.created_at_label") %></label>
|
||||
<!-- <input type="text" class="form-control" id="protocol_created_at" disabled> -->
|
||||
<%= f.text_field :doesnt_exist, :value => json_object['created_on']+" (Protocols.io value)", class: "form-control" %>
|
||||
<% display_created_at=Time.at(json_object['created_on'].to_i) %>
|
||||
<%= f.text_field :doesnt_exist, :value => display_created_at.to_s+" (Protocols.io value)", class: "form-control" %>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label for="protocol_updated_at"><%= t("protocols.import_export.import_modal.updated_at_label") %></label>
|
||||
<!-- <input type="text" class="form-control" id="protocol_updated_at" disabled> -->
|
||||
<%= f.text_field :doesnt_exist, :value => json_object['last_modified']+" (Protocols.io value)", class: "form-control" %>
|
||||
<% display_last_modified=Time.at(json_object['last_modified'].to_i) %>
|
||||
<%= f.text_field :doesnt_exist, :value => display_last_modified.to_s+" (Protocols.io value)", class: "form-control" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -57,21 +58,55 @@
|
|||
|
||||
<!-- Preview scroller -->
|
||||
<div>
|
||||
<div class="import-protocols-modal-preview-container" data-role="preview-container">
|
||||
<div class="import-protocols-modal-preview-container-json" data-role="preview-container">
|
||||
<table>
|
||||
|
||||
<table border=1>
|
||||
<% if json_object["before_start"]&&json_object["before_start"]!="" %>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<h2>Before starting protocol information</h2>
|
||||
<%= strip_tags(json_object["before_start"].remove("\"")) %>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<% if json_object["warning"]&&json_object["warning"]!="" %>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<h2>Protocol warning</h2>
|
||||
<%= strip_tags(json_object["warning"].remove("\"")) %>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
<% if json_object["guidelines"]&&json_object["guidelines"]!="" %>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<h2>Guidelines</h2>
|
||||
<%= strip_tags(json_object["guidelines"].remove("\"")) %>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% counter=0
|
||||
whitelist_simple=["1","6","17"]
|
||||
whitelist_complex=["8","9","15","18","19","20"]%>
|
||||
<% #byebug %>
|
||||
|
||||
<% json_object["steps"].each do |step| %>
|
||||
|
||||
<tr>
|
||||
<td> Step <%= (counter+=1).to_s %> </td>
|
||||
<td> Step guid (Protocols.io) :<%= step["guid"] %>
|
||||
<td> <h3>Step <%= (counter+=1).to_s %> </h3><br>
|
||||
Step guid (Protocols.io) :<%= step["guid"] %>
|
||||
<% #byebug %>
|
||||
<% if counter>1 %>
|
||||
<br>Guid of previous step (Protocols.io) :<%= step["previous_guid"] %>
|
||||
|
@ -79,59 +114,66 @@
|
|||
<% step["components"].each do |key,value| %>
|
||||
<% #byebug %>
|
||||
|
||||
<% if counter>1 #nevem zaka ampak v vseh njihovih izvoženih jsonih ima prvi korak čudno strukturo
|
||||
#elementov, v kateri so shranjeni kot hash, katerega ključ je "0", vrednost pa komponenta, to zruši iteriranje v enem stavku
|
||||
#trenutno sem porabil {5} ur da bi našel rešitev, tako da bi ena zanka naredila oboje.
|
||||
# to je samo v prvem koraku, naprej so vsi shranjeni brez tega arraya, in se po njih da normalno iterirat
|
||||
<% 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
|
||||
%>
|
||||
<% #byebug %>
|
||||
<% #if false %>
|
||||
|
||||
<% if whitelist_simple.include?(key["component_type_id"]) && key["data"]!="" && key["name"] && key["data"]%>
|
||||
<br>
|
||||
<%= key["name"]+" : "+key["data"] %>
|
||||
<%= strip_tags(key["name"].remove("\""))+" : "+ strip_tags(key["data"].remove("\"")) %>
|
||||
<% #byebug
|
||||
#debug
|
||||
#comp[counter];counter;@json.file_contents["steps"][3]["components"][0]["name"]
|
||||
#@json.file_contents["steps"][0]["components"]
|
||||
%>
|
||||
|
||||
<% #end %>
|
||||
<% elsif key && whitelist_complex.include?(key["component_type_id"]) %>
|
||||
<% case key["component_type_id"]%>
|
||||
<% when "8"%>
|
||||
<br>
|
||||
<%= "-"+key["name"]+" : "+key["source_data"]["name"] %>
|
||||
<%= "-"+strip_tags(key["name"].remove("\""))+" : "+strip_tags(key["source_data"]["name"].remove("\"")) %>
|
||||
<br>
|
||||
Developer : <%= key["source_data"]["developer"] %>
|
||||
Developer : <%= strip_tags(key["source_data"]["developer"].remove("\"")) %>
|
||||
<br>
|
||||
Version : <%= key["source_data"]["version"] %>
|
||||
Version : <%= strip_tags(key["source_data"]["version"].remove("\"")) %>
|
||||
<br>
|
||||
Link : <%= key["source_data"]["link"] %>
|
||||
Link : <%= strip_tags(key["source_data"]["link"].remove("\"")) %>
|
||||
<br>
|
||||
Repository : <%= key["source_data"]["repository"] %>
|
||||
Repository : <%= strip_tags(key["source_data"]["repository"].remove("\"")) %>
|
||||
<br>
|
||||
OS name , OS version : <%= key["source_data"]["os_name"]+" , "+key["source_data"]["os_version"] %>
|
||||
OS name , OS version : <%= strip_tags(key["source_data"]["os_name"].remove("\""))+" , "+strip_tags(key["source_data"]["os_version"].remove("\"")) %>
|
||||
|
||||
<% when "9"%>
|
||||
<br>
|
||||
<%= "-"+key["name"]+" : "+key["source_data"]["name"] %>
|
||||
<%= "-"+strip_tags(key["name"].remove("\""))+" : "+strip_tags(key["source_data"]["name"].remove("\"")) %>
|
||||
<br>
|
||||
Link : <%= key["source_data"]["link"] %>
|
||||
Link : <%= strip_tags(key["source_data"]["link"].remove("\"")) %>
|
||||
|
||||
|
||||
<% when "15"%>
|
||||
<br>
|
||||
<%= "-"+key["name"]+" : "+key["source_data"]["name"] %>
|
||||
<%= "-"+strip_tags(key["name"].remove("\""))+" : "+strip_tags(key["source_data"]["name"].remove("\"")) %>
|
||||
<br>
|
||||
Description : <%= key["source_data"]["description"] %>
|
||||
Description : <%= strip_tags(key["source_data"]["description"].remove("\"")) %>
|
||||
<br>
|
||||
OS name , OS version : <%= key["source_data"]["os_name"]+" , "+key["source_data"]["os_version"] %>
|
||||
OS name , OS version : <%= strip_tags(key["source_data"]["os_name"].remove("\""))+" , "+strip_tags(key["source_data"]["os_version"].remove("\"")) %>
|
||||
|
||||
<% when "18"%>
|
||||
|
||||
<br>
|
||||
-This protocol also contains an attached sub-protocol: <%= strip_tags(key["source_data"]["protocol_name"].remove("\"")) %>
|
||||
<br>
|
||||
Author: <%= strip_tags(key["source_data"]["full_name"].remove("\"")) %>
|
||||
<br>
|
||||
<% if key["source_data"]["link"]&&key["source_data"]["link"]!="" %>
|
||||
Link: <%= strip_tags(key["source_data"]["link"].remove("\"")) %>
|
||||
<% end %>
|
||||
<% when "19"%>
|
||||
<br>
|
||||
<%= "-"+key["name"]+" : "+key["source_data"]["body"] %>
|
||||
<%= "-"+strip_tags(key["name"].remove("\""))+" : "+strip_tags(key["source_data"]["body"].remove("\"")) %>
|
||||
<br>
|
||||
Link : <%= key["source_data"]["link"] %>
|
||||
Link : <%= strip_tags(key["source_data"]["link"].remove("\"")) %>
|
||||
|
||||
|
||||
<% when "20"%>
|
||||
|
@ -141,6 +183,7 @@
|
|||
<% end %>
|
||||
|
||||
|
||||
|
||||
<% end #notranji if št 1%>
|
||||
|
||||
|
||||
|
@ -149,11 +192,11 @@
|
|||
<% unless value %>
|
||||
<% value=key #json format ima random arraye namest hashov, ta problem je opisan pri if counter > 1 stavku %>
|
||||
<% end %>
|
||||
<% #byebug %>
|
||||
|
||||
<% if whitelist_simple.include?(value["component_type_id"])&& value["data"]!="" && value["name"] && value["data"] %>
|
||||
<br>
|
||||
<%= value["name"]+" : "+value["data"] %>
|
||||
<% #byebug
|
||||
<%= strip_tags(value["name"].remove("\""))+" : "+strip_tags(value["data"].remove("\"")) %>
|
||||
<%
|
||||
#debug
|
||||
#comp[counter];counter;@json.file_contents["steps"][3]["components"][0]["name"]
|
||||
#@json.file_contents["steps"][0]["components"]
|
||||
|
@ -163,40 +206,48 @@
|
|||
<% case value["component_type_id"]%>
|
||||
<% when "8"%>
|
||||
<br>
|
||||
<%= "-"+value["name"]+" : "+value["source_data"]["name"] %>
|
||||
<%= "-"+strip_tags(value["name"].remove("\""))+" : "+strip_tags(value["source_data"]["name"].remove("\"")) %>
|
||||
<br>
|
||||
Developer : <%= value["source_data"]["developer"] %>
|
||||
Developer : <%= strip_tags(value["source_data"]["developer"].remove("\"")) %>
|
||||
<br>
|
||||
Version : <%= value["source_data"]["version"] %>
|
||||
Version : <%= strip_tags(value["source_data"]["version"].remove("\"")) %>
|
||||
<br>
|
||||
Link : <%= value["source_data"]["link"] %>
|
||||
Link : <%= strip_tags(value["source_data"]["link"].remove("\"")) %>
|
||||
<br>
|
||||
Repository : <%= value["source_data"]["repository"] %>
|
||||
Repository : <%= strip_tags(value["source_data"]["repository"].remove("\"")) %>
|
||||
<br>
|
||||
OS name , OS version : <%= value["source_data"]["os_name"]+" , "+value["source_data"]["os_version"] %>
|
||||
OS name , OS version : <%= strip_tags(value["source_data"]["os_name"].remove("\""))+" , "+strip_tags(value["source_data"]["os_version"].remove("\"")) %>
|
||||
|
||||
<% when "9"%>
|
||||
<br>
|
||||
<%= "-"+value["name"]+" : "+value["source_data"]["name"] %>
|
||||
<%= "-"+strip_tags(value["name"].remove("\""))+" : "+strip_tags(value["source_data"]["name"].remove("\"")) %>
|
||||
<br>
|
||||
Link : <%= value["source_data"]["link"] %>
|
||||
Link : <%= strip_tags(value["source_data"]["link"].remove("\"")) %>
|
||||
|
||||
|
||||
<% when "15"%>
|
||||
<br>
|
||||
<%= "-"+value["name"]+" : "+value["source_data"]["name"] %>
|
||||
<%= "-"+strip_tags(value["name"].remove("\""))+" : "+strip_tags(value["source_data"]["name"].remove("\"")) %>
|
||||
<br>
|
||||
Description : <%= value["source_data"]["description"] %>
|
||||
Description : <%= strip_tags(value["source_data"]["description"].remove("\"")) %>
|
||||
<br>
|
||||
OS name , OS version : <%= value["source_data"]["os_name"]+" , "+value["source_data"]["os_version"] %>
|
||||
OS name , OS version : <%= strip_tags(value["source_data"]["os_name"].remove("\""))+" , "+strip_tags(value["source_data"]["os_version"].remove("\"")) %>
|
||||
|
||||
<% when "18"%>
|
||||
<br>
|
||||
-This protocol also contains an attached sub-protocol: <%= strip_tags(value["source_data"]["protocol_name"].remove("\"")) %>
|
||||
<br>
|
||||
Author: <%= strip_tags(value["source_data"]["full_name"].remove("\"")) %>
|
||||
|
||||
<% if value["source_data"]["link"]&&value["source_data"]["link"]!="" %>
|
||||
<br>
|
||||
Link: <%= strip_tags(value["source_data"]["link"].remove("\"")) %>
|
||||
<% end %>
|
||||
<% when "19"%>
|
||||
<br>
|
||||
<%= "-"+value["name"]+" : "+value["source_data"]["body"] %>
|
||||
<%= "-"+strip_tags(value["name"])+" : "+strip_tags(value["source_data"]["body"].remove("\"")) %>
|
||||
<br>
|
||||
Link : <%= value["source_data"]["link"] %>
|
||||
Link : <%= strip_tags(value["source_data"]["link"].remove("\"")) %>
|
||||
|
||||
|
||||
<% when "20"%>
|
||||
|
@ -211,12 +262,83 @@
|
|||
|
||||
|
||||
<% end #komponente koraka %>
|
||||
|
||||
</td>
|
||||
<td> WIP</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<% end #posamezni koraki%>
|
||||
|
||||
|
||||
<% if json_object["manuscript_citation"]&&json_object["manuscript_citation"]!="" %>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<h4>Manuscript citation</h4>
|
||||
<%= strip_tags(json_object["manuscript_citation"].remove("\"")) %>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% if json_object["publish_date"]&&json_object["publish_date"]!="" %>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<h4>Publish date</h4>
|
||||
<%= strip_tags(json_object["publish_date"].remove("\"")) %>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% if json_object["vendor_name"]&&json_object["vendor_name"]!="" %>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<h4>Vendor name</h4>
|
||||
<%= strip_tags(json_object["vendor_name"].remove("\"")) %>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<% if json_object["vendor_link"]&&json_object["vendor_link"]!="" %>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<h4>Vendor link</h4>
|
||||
<%= strip_tags(json_object["vendor_link"].remove("\"")) %>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<% if json_object["keywords"]&&json_object["keywords"]!="" %>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<h4>Keywords</h4>
|
||||
<%= strip_tags(json_object["keywords"].remove("\"")) %>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<% if json_object["tags"]&&json_object["tags"]!="" %>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<h4>Tags</h4>
|
||||
<% json_object["tags"].each do |tag| %>
|
||||
<%= strip_tags(tag["tag_name"].remove("\""))+" , " %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue