i have application using bootstrap nag-tabs content interrelated. trying make when hot reload comes along last selected tab re-selected. trying make last selected tab reselected when user comes page after navigating away. here template:
<template name='admin'> <ul id='admintabs' class='nav nav-tabs'> {{#if isinrole 'admin'}} <li class='active'><a href='#districtstab' data-toggle='tab'>districts</a></li> {{/if}} {{#if isinrole 'admin, manage-users'}} <li><a href='#usertab' data-toggle='tab'>users</a></li> {{/if}} {{#if isinrole 'admin, manage-schools'}} <li><a href='#schoolstab' data-toggle='tab'>schools</a></li> {{/if}} {{#if isinrole 'admin, manage-classes'}} <li><a href='#classestab' data-toggle='tab'>classes</a></li> {{/if}} {{#if isinrole 'admin, manage-lessons'}} <li><a href='#lessonstab' data-toggle='tab'>lessons</a></li> {{/if}} {{>onlineuserstab}} </ul> <div class='tab-content'> {{#if isinrole 'admin'}} {{#isolate}} <div class='tab-pane active' id='districtstab'> {{>districts}} </div> {{/isolate}} {{/if}} {{#if isinrole 'admin, manage-users'}} {{#isolate}} <div class='tab-pane' id='usertab'> {{>users}} </div> {{/isolate}} {{/if}} {{#if isinrole 'admin, manage-schools'}} {{#isolate}} <div class='tab-pane' id='schoolstab'> {{>schools}} </div> {{/isolate}} {{/if}} {{#if isinrole 'admin, manage-classes'}} {{#isolate}} <div class='tab-pane' id='classestab'> {{>classestemplate}} </div> {{/isolate}} {{/if}} {{#if isinrole 'admin, manage-lessons'}} {{#isolate}} <div class='tab-pane' id='lessonstab'> {{>lessons}} </div> {{/isolate}} {{/if}} <div class='tab-pane' id='onlinetab'> {{#isolate}} {{>onlineusers}} {{/isolate}} </div> </div> </template>
how can accomplish after easily?
assuming hashes getting used, , have url /#classestab
, check hash in url on template render , select relevant tab:
template.admin.rendered = function() { if (window.location.hash) $('a[href="' + window.location.hash + '"]').tab('show'); }
Comments
Post a Comment