bio-miga/miga-web

View on GitHub
app/views/projects/show_dataset.html.erb

Summary

Maintainability
Test Coverage
<% provide(:title, @dataset_miga.name.unmiga_name) %>
<% provide(:breadcrumb_1, link_to('Projects', projects_path)) %>
<% provide(:breadcrumb_2,
      link_to(truncate(@project.path_name, length: 15), @project)) %>
<% provide(:breadcrumb_3,
      link_to('References', project_reference_datasets_path(@project.id))) %>
<div class="row">
  <aside class="col-md-4">
    <section class='dataset-title'>
      <%= link_to @project.code, @project,
        class: "label label-primary pull-left project-code",
        title: @project.path_name,
        style: "background: #{@project.code_color};" %></a>
      <span class="name">
        <b><%= @dataset_miga.is_ref? ? '[Ref]' : '[Qry]' %>
          <% qi = @dataset_miga.metadata[:quality] %>
          <% unless qi.nil? %>
            <i class="glyphicon glyphicon-adjust small text-light-<%=
                { excellent: 'success', high: 'info',
                  intermediate: 'warning', low: 'danger' }[qi.to_sym]
            %>" rel="tooltip" title="<%= qi.capitalize %> quality genome"> </i>
          <% end %>
          <%= link_to_reference_dataset(@project, @dataset_miga.name) %></b>
      </span>
      <span class="timestamp">
        Updated
        <%= time_ago_in_words(@dataset_miga.metadata[:updated]) %> ago.
      </span>
    </section>
    <section class='dataset-item'>
      <%= render partial: 'datasets/dataset',
        object: @dataset_miga,
        locals: {project: @project, noname: true, expand_side: true} %>
    </section>
  </aside>
  <div class="col-md-8">
    <% if @dataset_miga.is_ref? && !@project.miga.metadata[:arcgis].nil? %>
      <% arcgis_obj_id = @dataset_miga.name %>
      <% unless @project.miga.is_clade? ||
              (clade_r = @project.miga.result(:clade_finding)).nil? ||
              (ani_clade_f = clade_r.file_path(:clades_ani95)).nil? ||
              (ani_clade = File.foreach(ani_clade_f).
                map { |i| i.chomp.split(',') }.
                find { |i| i.include? @dataset_miga.name }).nil? %>
          <% arcgis_obj_id = ani_clade.join(',') %>
      <% end %>
      <style>
        .embed-container {
          position: relative; padding-bottom: 80%; height: 0; max-width: 100%;}
        .embed-container iframe, .embed-container object, .embed-container iframe{
          position: absolute; top: 0; left: 0; width: 100%; height: 100%;}
        small{position: absolute; z-index: 40; bottom: 0; margin-bottom: -15px;}
      </style>
      <div class="embed-container"><iframe width="500" height="400"
        frameborder="0" scrolling="no" marginheight="0" marginwidth="0"
        title="ArcGIS Map + MiGA"
        src="https://arcgis.com/apps/opsdashboard/index.html#/<%=
          @project.miga.metadata[:arcgis] %>?MiGA_name=<%=
          arcgis_obj_id %>"></iframe></div>
    <% end %>
    <% results_to_load = [] %>
    <% MiGA::Dataset.RESULT_DIRS.keys.reverse_each do |k| %>
      <% if res = @dataset_miga.result(k) %>
        <div id="reference_dataset_result_<%= k %>_<%= @dataset_miga.name %>">
          <h3 class="result-title">
            <i class="glyphicon glyphicon-tasks"> </i>
            <%= image_tag("loading.gif") %>
            <%= k.to_s.unmiga_name.capitalize %>
          </h3>
        </div>
        <% results_to_load << k %>
      <% end %>
    <% end %>
    <script>
      <% results_to_load.each do |k| %>
        $.ajax(
          { url: "<%= project_result_partial_path(@project, k, r_ds: @dataset_miga.name) %>" }
        ).done(function(data){ $("#reference_dataset_result_<%= k %>_<%= @dataset_miga.name %>").html(data) });
      <% end %>
    </script>
  </div>
</div>