From d52400f7417354f03717ba180097dcbc18e2c83e Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Sat, 7 Oct 2017 17:58:23 +0200 Subject: [PATCH] Refactored code according to review --- ...mport_json_protocol_preview_modal.html.erb | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb index 66a2d923c..01a8c90d2 100644 --- a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb +++ b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb @@ -79,26 +79,26 @@ data-role="preview-container">
- <% if @json_object["before_start"]&&@json_object["before_start"]!="" %> + <% if @json_object["before_start"].present? %> <%= t("protocols.protocols_io_import.preview.b_s_p") %>
<%= (@json_object["before_start"]) %>
<% end %> - <% if @json_object["warning"]&&@json_object["warning"]!="" %> + <% if @json_object["warning"].present? %> <%= t("protocols.protocols_io_import.preview.warn") %>
<%= (@json_object["warning"]) %>
<% end %> - <% if @json_object["guidelines"]&&@json_object["guidelines"]!="" %> + <% if @json_object["guidelines"].present? %> <%= t("protocols.protocols_io_import.preview.guideln") %>
<%= (@json_object["guidelines"]) %>
<% end %> - <% if @json_object["link"]&&@json_object["link"]!="" %> + <% if @json_object["link"].present? %>
<%= t("protocols.protocols_io_import.preview.p_link") %>
<%= (@json_object["link"]) %> @@ -133,7 +133,7 @@ <% end %> <% if(key1["component_type_id"]=="6") %> - <% if(!key1["data"].nil? && key1["data"]!="") %> + <% if(key1["data"].present?) %> <% title ||=key1["data"] %> <% end %> <% end %> @@ -159,8 +159,8 @@ <% key=value %> <% end %> - <% if whitelist_simple.include?(key["component_type_id"]) && key["data"]!="" && - key["data"] %> + <% if whitelist_simple.include?(key["component_type_id"]) && + key["data"].present? %>
<% case key["component_type_id"] when "1" %> @@ -211,7 +211,7 @@
<%= t("protocols.protocols_io_import.preview.auth") %> <%= (key["source_data"]["full_name"]) %>
- <% if key["source_data"]["link"]&&key["source_data"]["link"]!="" %> + <% if key["source_data"]["link"].present? %> <%= t("protocols.protocols_io_import.preview.s_nobr_link") %> <%= (key["source_data"]["link"]) %> <% end %> @@ -258,37 +258,37 @@ <% end #step loop%> <% if - @json_object["manuscript_citation"]&&@json_object["manuscript_citation"]!="" %> + @json_object["manuscript_citation"].present? %>
<%= t("protocols.protocols_io_import.preview.manu_cit") %>
<%= (@json_object["manuscript_citation"]) %> <% end %> - <% if @json_object["publish_date"]&&@json_object["publish_date"]!="" %> + <% if @json_object["publish_date"].present? %>
<%= t("protocols.protocols_io_import.preview.pbl_date") %>
<%= (@json_object["publish_date"]) %> <% end %> - <% if @json_object["vendor_name"]&&@json_object["vendor_name"]!="" %> + <% if @json_object["vendor_name"].present? %>
<%= t("protocols.protocols_io_import.preview.vnd_name") %>
<%= (@json_object["vendor_name"]) %> <% end %> - <% if @json_object["vendor_link"]&&@json_object["vendor_link"]!="" %> + <% if @json_object["vendor_link"].present? %>
<%= t("protocols.protocols_io_import.preview.vnd_link") %>
<%= (@json_object["vendor_link"]) %> <% end %> - <% if @json_object["keywords"]&&@json_object["keywords"]!="" %> + <% if @json_object["keywords"].present? %>
<%= t("protocols.protocols_io_import.preview.key_wrd") %>
<%= (@json_object["keywords"]) %> <% end %> - <% if @json_object["tags"]&&@json_object["tags"]!="" %> + <% if @json_object["tags"].present? %>
<%= t("protocols.protocols_io_import.preview.tags") %>
<% @json_object["tags"].each do |tag| %>