genome/dgi-db

View on GitHub
app/views/drugs/show.html.haml.old

Summary

Maintainability
Test Coverage
=content_for :title, "DGIdb - #@title Drug Record"
=content_for :header do
  %h2
    %span{id: "drug_name"}
      =@title
    %small
      data sources and alternate names 
      %a(href="/faq#defined")
        =icon('question-sign')

.container-fluid
  .tabbable
    %ul.nav.nav-tabs
      %li.active
        %a(href="#detailed_view" data-toggle="tab") Detailed View
      %li
        %a(href="#by_source" data-toggle="tab") By Source
    .tab-content
      .tab-pane.active#detailed_view
        .row-fluid#container
          %div(class="span2")
            %div(id="list-filter-tabs")

              %ul(class="nav nav-tabs nav-stacked")
                %li(class="active")
                  %a(href="#" data-category="all")
                    %i(class="icon-chevron-right")
                    All

          %div(class="span10")
            =render partial: 'drugs/drug', locals: { drug: @drug }

      .tab-pane.fade#by_source
        .row-fluid
          .span12
            =render partial: 'drugs/by_source_table', locals: {drug: @drug}

%br

  =javascript_include_tag "jquery.masonry.min"
  =javascript_include_tag "jquery.dataTables.min"
  =javascript_include_tag "pagination_bootstrap"
  =javascript_include_tag "gene_groups"
  =javascript_include_tag "gene-list-tabs"

:javascript
  // show more/fewer aliases
  $("table").find('tr:gt(4)').hide();
  $("button").show_all = 0;

  $("button").on("click", function() {
      $("#table_" + this.id).find('tr:gt(4)').toggle();
      this.show_all = !this.show_all;

      if (this.show_all) {
        $(this).html("Show Less");
      }
      else {
        $(this).html("Show All");
      }

  });