genome/dgi-db

View on GitHub
app/views/interactions/_interaction_summary.html.haml

Summary

Maintainability
Test Coverage
/summary panel to be used in lists for interaction tab

%div(class="item-title")
  %div(class="item-name")
    %h3(class="item-source")
      %a{href: "/drugs/#{interaction.drug.name}"} 
        =interaction.drug.name
      %span{class: "glyphicon glyphicon-play", "aria-hidden" => "true", style: "margin-left: 10px; margin-right: -8px"}
      &nbsp
      %a{href: "/genes/#{interaction.gene.name}"} 
        =interaction.gene.name 
  %div(class="interaction-score")
    Interaction Score:
    =interaction.interaction_score.round(2)

%div(class="item-content")
  %div(class="cell category")
    %div{class: "item-panel"}
      %h4{style: "display: inline-block;"}
        Interaction Types & Directionality:
        %table{class: "table table-condensed table-striped", style: "table-layout:fixed;"}
          -interaction.na_or_types.each do |interaction_type|
            %tr
              %td=interaction_type[:directionality].nil? ? interaction_type[:type] : "#{interaction_type[:type]} (#{interaction_type[:directionality]})"

  %div(class="cell category")
    %div{class: "item-panel"}
      %h4
        Interaction Info:
        %table{class: "table table-condensed table-striped", style: "table-layout:fixed;"}
          - info = interaction.interaction_attributes.reject{|attribute| attribute.name == 'PMID' || attribute.name == 'Interaction Type'}[0..2]
          - info.each do |attribute|
            %tr
              %td=attribute.name
              %td=attribute.value

  %div(class="cell category")
    %div{class: "item-panel"}
      %h4
        PMIDs:
        %br
        %span{style: "line-height: 30px"}
          - if (interaction.publications.size) > 0
            = interaction.publications.map{|pub| pubmed_link_blue(pub.pmid)}.join(" ").html_safe
          - else
            %i
              None found
    %br
    %div{class: "item-panel"}
      %h4
        Sources:
        %br
        %span{style: "line-height: 30px"}
          = interaction.sources.map{|source| source_link_green(source)}.join(" ").html_safe