app/views/drugs/show.html.haml
/ view for show action in drug controller
/ rendered in application layout by drug show action
/ similar to show.html.haml, as in it provides the scaffold for the tabs
/ - shared summary tab partial
/ - shared interactions tab partial
/ - shared claims tab partial
=content_for :title, "DGIdb - #@title Drug Record"
=content_for :header do
%h2
%span{id: "drug_name"}
=@title
%small
Drug Record
- cache @drug do
.container-fluid
.tabbable
%ul.nav.nav-tabs
%li.active
%a(href="#summary" data-toggle="tab") Summary
%li
%a(href="#interactions" data-toggle="tab") Interactions
%li
%a(href="#claims" data-toggle="tab") Claims
.tab-content{style: "margin-top: 12px;"}
.tab-pane.active#summary
.row-fluid#container
.span12
%ul(class="result-list" id="list-results")
%li.drug
=render partial: 'drugs/drug_summary_tab', locals: { drug: @drug }
.tab-pane.fade#interactions
.row-fluid#container
.span12
=render partial: 'shared/interactions_tab', locals: { drug: @drug }
.tab-pane.fade#claims
.row-fluid#container
.span12
=render partial: 'shared/claims_tab', locals: { drug: @drug }
:javascript
$(document).ready(function () {
console.log("ready")
var activeTab = $('#' + window.location.hash.substr(2));
if(activeTab.length) {
$('a[href="' + "#" + window.location.hash.substr(2) + '"]').trigger('click');
} else {
$('a[href="' + "#summary" + '"]').trigger('click');
}
});
window.addEventListener("popstate", function() {
console.log("popstate");
var activeTab = $('#' + window.location.hash.substr(2));
if (activeTab.length) {
$('a[href="' + "#" + window.location.hash.substr(2) + '"]').trigger('click');
} else {
$('a[href="' + "#summary" + '"]').trigger('click');
}
});
$(".tabbable li a").click(function () {
console.log("click");
window.location.hash = "_" + $(this).attr('href').substr(1);
return true;
});
=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"