genome/dgi-db

View on GitHub
app/views/genes/_gene_summary_tab.html.haml

Summary

Maintainability
Test Coverage
/ takes in variable for type of summary (gene or gene)
/ displays lists of aliases, gene/gene info, publications
/ figure out how to get "card" aesthetic

%div(class="item-title")
  %div(class="item-name")
    %h3(class="item-source")
      %span
        = gene.name
      %span{style: "font-size: 15px; color: grey; margin-right: 5px"}
        = gene.entrez_id
      %span{style: "float: right;"}
        = gene.flag_icons
%div(class="item-content")
  %div{class: "cell category", style: "float: right; width: 50%;"}
    %div{class: "item-panel"}
      %h4
        Alternate Names:
      %div{style: "height: 657px; overflow-y: scroll; margin-bottom: 5px;"}
        %table{class: "table table-condensed table-striped", id: "table_aliases"}
          %tbody
            -gene.gene_aliases.each do |alt_name| ######
              %tr
                %td
                  =alt_name.alias

  %div{class: "cell category", style: "float: left; width: 50%" }
    %div{class: "item-panel", style: "margin-bottom: 11px;"}
      %h4
        Gene Info:
      %div{style: "height: 200px; overflow-y: scroll; margin-bottom: 5px;"}  
        %table{class: "table table-condensed table-striped", id:"table_info"}
          %tbody
            -gene.gene_attributes.each do |attribute| #######
              %tr
                %td=attribute.name
                %td=attribute.value
      %div#linkouts
        - gene.gene_claims[0..3].each do |gc|
          %button{class: "button", type: "button", style:"background-color: #e7e7e7; border: none; margin-bottom: 4px", onclick:"location.href='#{gc.original_data_source_url}';"}
            = gc.source.source_db_name
        %a#more{style: "display: inline-block; margin-left: 5px; cursor: pointer"}
          - num_left = (gene.gene_claims.count - 4 > 0 ? gene.gene_claims.count - 4 : 0)
          = "(#{num_left} More Sources)"
    %div{class: "item-panel", style: "margin-bottom: 11px;"}
      %div{style: "height: 40px"}
        %h4
          Gene Categories:
          %a{class: ['btn', 'btn-success'], style: "float: right",  href: "/categories_search_results?genes=#{gene.name}"}
            =icon('search', class: 'icon-white')
            =" Category Details"
      %div{style: "height: 100px; overflow-y: scroll; margin-bottom: 5px;"}  
        %table{class: "table table-condensed table-striped", id:"table_info"}
          %tbody
            -gene.gene_categories.each do |category|
              %tr
                %td=category.name
    %div{class: "item-panel"}
      %h4
        Publications:
      %div{style: "height: 200px; overflow-y: scroll; margin-bottom: 5px;"}
        %table{class: "table table-condensed table-striped", id:"table_publications"}
          -gene.publications.each do |publication| ########
            %tr
              %td
                %a{href: PMID.pubmed_url(publication.pmid)}
                  = publication.citation
              
:javascript
  $("a#more").click(function () {
    $('a[href="' + "#" + "claims" + '"]').trigger('click');
    return true;
  }); 
  
:css
  
  .flag_icon {
    margin-right: 5px;
  }

  div button:hover {
      background-color: #330066!important;
      color: white;
  }