2016-03-04 20:56:41 -05:00
|
|
|
// Include this file ONLY when current.path[2] is defined
|
2016-03-05 02:31:29 -05:00
|
|
|
- var base = '/docs/' + current.path[1] + '/' + current.path[2] + '/';
|
|
|
|
- var dir = current.path[4] ? current.path[3] + '/' : '';
|
|
|
|
- var cur = current.path[4] || current.path[3];
|
|
|
|
- cur = cur === 'index' ? '' : cur + '.html';
|
|
|
|
- cur = base + dir + cur;
|
|
|
|
|
|
|
|
- var sections = function(dir, selector) {
|
2016-03-04 20:56:41 -05:00
|
|
|
- var secondaryPath = public.docs[current.path[1]][current.path[2]]
|
2016-03-05 02:31:29 -05:00
|
|
|
- var data = dir ? secondaryPath[dir] && secondaryPath[dir]._data : secondaryPath._data;
|
2016-03-04 20:56:41 -05:00
|
|
|
- if (!data) return [];
|
2016-02-06 02:27:06 -05:00
|
|
|
|
2016-03-05 02:31:29 -05:00
|
|
|
- var section = [];
|
2016-03-04 20:56:41 -05:00
|
|
|
- var selector = selector || function() { return true; };
|
2016-03-05 02:31:29 -05:00
|
|
|
- var prefix = base + (dir ? dir + '/' : '');
|
2016-03-04 20:56:41 -05:00
|
|
|
- for (prop in data) {
|
|
|
|
- var item = data[prop];
|
2016-03-05 02:31:29 -05:00
|
|
|
- item.slug = prop;
|
2016-03-04 20:56:41 -05:00
|
|
|
- if (prop[0] !== '_' && !item.hide && selector(item)) {
|
2016-03-08 11:45:44 -05:00
|
|
|
- var file = pro
|
|
|
|
- var ext = prop.lastIndexOf('/') === prop.length-1 ? '' : '.html';
|
|
|
|
- var file = prop === 'index' ? '' : prop + ext;
|
2016-03-05 02:31:29 -05:00
|
|
|
- var href = prefix + file;
|
|
|
|
- item.class = cur === href ? 'is-selected' : '';
|
2016-03-04 20:56:41 -05:00
|
|
|
- item.file = file;
|
2016-03-05 02:31:29 -05:00
|
|
|
- item.href = href;
|
2016-03-04 20:56:41 -05:00
|
|
|
- item.navTitle = item.navTitle || item.title;
|
2016-03-08 11:45:44 -05:00
|
|
|
- item.tooltip = item.description || item.intro || item.title || '';
|
2016-03-05 02:31:29 -05:00
|
|
|
- section.push(item);
|
2016-03-04 20:56:41 -05:00
|
|
|
- }
|
|
|
|
- }
|
2016-03-05 02:31:29 -05:00
|
|
|
- return section;
|
2016-03-04 20:56:41 -05:00
|
|
|
- }
|
|
|
|
|
2016-03-05 02:31:29 -05:00
|
|
|
- var tutorial = sections('tutorial');
|
|
|
|
- var cookbook = sections('cookbook');
|
|
|
|
- var basics = sections('guide', function(item) { return item.basics; });
|
|
|
|
- var guide = sections('guide', function(item) { return !item.basics; });
|
|
|
|
- var qs = sections('', function(item) { return item.slug === 'quickstart'; })[0] || {};
|
|
|
|
- var reference = sections('', function(item) { return item.reference; });
|
2016-02-06 02:27:06 -05:00
|
|
|
|
2016-03-04 20:56:41 -05:00
|
|
|
nav.side-nav.l-pinned-left.l-layer-4.l-offset-nav
|
2016-02-06 02:27:06 -05:00
|
|
|
// SEARCH BAR
|
|
|
|
header.side-nav-search.st-input-wrapper
|
|
|
|
form.st-input-inner
|
|
|
|
label(for="search-io" class="is-hidden") Search Docs
|
|
|
|
input(type="search" id="search-io" placeholder="SEARCH DOCS...")
|
|
|
|
button(class="mobile-trigger button" aria-label="View Docs Menu" ng-click="appCtrl.toggleDocsMenu($event)" md-button) Docs <span class="icon icon-arrow-drop-down"></span>
|
2016-03-05 02:31:29 -05:00
|
|
|
|
2016-02-06 02:27:06 -05:00
|
|
|
div(class="side-nav-secondary" ng-class="appCtrl.showDocsNav ? 'is-visible' : ''")
|
2016-03-04 20:56:41 -05:00
|
|
|
.nav-blocks
|
|
|
|
.nav-title Tutorial
|
2016-03-05 02:31:29 -05:00
|
|
|
.nav-primary-link(class="#{qs.class}")
|
2016-03-04 20:56:41 -05:00
|
|
|
a(href="#{qs.href}" title="#{qs.tooltip}") #{qs.navTitle}
|
|
|
|
.nav-sub-title Case Study: Tour of Heroes
|
|
|
|
.nav-ordered-lists
|
|
|
|
ol
|
|
|
|
each item in tutorial
|
2016-03-05 02:31:29 -05:00
|
|
|
li(class="#{item.class}"): a(href="#{item.href}" title="#{item.tooltip}") #{item.navTitle}
|
2016-03-04 20:56:41 -05:00
|
|
|
|
|
|
|
.nav-blocks
|
|
|
|
.nav-title Basics
|
|
|
|
.nav-ordered-lists
|
|
|
|
ol
|
|
|
|
each item in basics
|
2016-03-05 02:31:29 -05:00
|
|
|
li(class="#{item.class}"): a(href="#{item.href}" title="#{item.tooltip}") #{item.navTitle}
|
2016-03-04 20:56:41 -05:00
|
|
|
|
|
|
|
.nav-blocks
|
|
|
|
.nav-title Developer Guide
|
|
|
|
.nav-unordered-lists
|
|
|
|
ul
|
|
|
|
each item in guide
|
2016-03-05 02:31:29 -05:00
|
|
|
li(class="#{item.class}"): a(href="#{item.href}" title="#{item.tooltip}") #{item.navTitle}
|
2016-03-04 20:56:41 -05:00
|
|
|
|
|
|
|
.nav-blocks
|
|
|
|
.nav-title Cookbook
|
|
|
|
.nav-unordered-lists
|
|
|
|
ul
|
|
|
|
each item in cookbook
|
2016-03-05 02:31:29 -05:00
|
|
|
li(class="#{item.class}"): a(href="#{item.href}" title="#{item.tooltip}") #{item.navTitle}
|
2016-03-04 20:56:41 -05:00
|
|
|
|
|
|
|
.nav-blocks
|
|
|
|
.nav-title Reference
|
|
|
|
.nav-unordered-lists
|
|
|
|
ul
|
|
|
|
each item in reference
|
2016-03-05 02:31:29 -05:00
|
|
|
li(class="#{item.class}"): a(href="#{item.href}" title="#{item.tooltip}") #{item.navTitle}
|
2016-02-06 02:27:06 -05:00
|
|
|
|
|
|
|
script.
|
|
|
|
// Could put in appCtrl but only needed here and clear here
|
2016-03-05 02:31:29 -05:00
|
|
|
(function scrollToSelectedLink() {
|
|
|
|
var sideNav = document.getElementsByClassName('side-nav')[0];
|
|
|
|
var link = sideNav.getElementsByClassName('is-selected')[0];
|
|
|
|
if(link && link.offsetTop > window.innerHeight){
|
|
|
|
sideNav.scrollTop = link.offsetTop - (window.innerHeight/2);
|
|
|
|
//alert("offsetTop: " + link.offsetTop + " side-nav top is " + sideNav.scrollTop);
|
|
|
|
}
|
2016-03-04 20:56:41 -05:00
|
|
|
})()
|