From 11e9572b952e49b01035e956c412d6095533031a Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 29 Apr 2011 15:18:27 -0700 Subject: Move documentation under individual headings --- docs/src/templates/docs.css | 27 ++++++++++++++++++-------- docs/src/templates/docs.js | 20 ++++++++++++++------ docs/src/templates/index.html | 44 +++++++++++++++++++++++++++++++------------ 3 files changed, 65 insertions(+), 26 deletions(-) (limited to 'docs/src/templates') diff --git a/docs/src/templates/docs.css b/docs/src/templates/docs.css index f5b9275b..4f47367d 100644 --- a/docs/src/templates/docs.css +++ b/docs/src/templates/docs.css @@ -18,6 +18,24 @@ a { height: 3.5em; } +#header .navigation { + position: absolute; + text-align: center; + top: 0; + right: 0; + left: 0; + margin: 0; + padding: 0; +} +#header .navigation > li { + display: inline; + padding: 0 .5em; +} + +#header .navigation > li.selected { + font-weight: bold; +} + #sidebar, #main { position: absolute; @@ -191,12 +209,8 @@ a { margin-top: 0; } -#sidebar ul li.level-1.level-angular { +#sidebar ul li.monospace{ font-family: monospace; - font-weight: normal; - font-size: 1em; - margin-top: 0; - margin-bottom: 0; } #sidebar ul li.level-1 { @@ -208,17 +222,14 @@ a { #sidebar ul li.level-2 { margin-left: 2em; - font-family: monospace; } #sidebar ul li.level-3 { margin-left: 3em; - font-family: monospace; } #sidebar ul li.level-4 { margin-left: 4em; - font-family: monospace; } diff --git a/docs/src/templates/docs.js b/docs/src/templates/docs.js index 9483496e..47bb87a6 100644 --- a/docs/src/templates/docs.js +++ b/docs/src/templates/docs.js @@ -1,8 +1,8 @@ var HAS_HASH = /#/; DocsController.$inject = ['$location', '$browser', '$window']; function DocsController($location, $browser, $window) { - this.pages = NG_PAGES; window.$root = this.$root; + var self = this; this.$location = $location; if (!HAS_HASH.test($location.href)) { @@ -11,28 +11,36 @@ function DocsController($location, $browser, $window) { this.$watch('$location.hashPath', function(hashPath) { if (hashPath.match(/^!/)) { - this.partialId = hashPath.substring(1); - this.partialTitle = (angular.Array.filter(NG_PAGES, {id:this.partialId})[0]||{}).name; + var parts = hashPath.substring(1).split('/'); + self.sectionId = parts[0]; + self.partialId = parts[1] || 'index'; + self.pages = angular.Array.filter(NG_PAGES, {section:self.sectionId}); + self.partialTitle = (angular.Array.filter(self.pages, function(doc){return doc.id == self.partialId;})[0]||{}).name; } }); this.getUrl = function(page){ - return '#!' + page.id; + return '#!' + page.section + '/' + page.id; }; this.getCurrentPartial = function(){ - return './' + this.partialId + '.html'; + return './' + this.sectionId + '/' + this.partialId + '.html'; }; this.getClass = function(page) { var depth = page.depth, cssClass = 'level-' + depth + (page.name == this.partialId ? ' selected' : ''); - if (depth == 1 && page.type !== 'overview') cssClass += ' level-angular'; + if (page.section == 'api') + cssClass += ' monospace'; return cssClass; }; + this.selectedSection = function(section) { + return section == self.sectionId ? 'selected' : null; + }; + this.afterPartialLoaded = function() { SyntaxHighlighter.highlight(); }; diff --git a/docs/src/templates/index.html b/docs/src/templates/index.html index 63e8d871..1c3dd3a6 100644 --- a/docs/src/templates/index.html +++ b/docs/src/templates/index.html @@ -4,23 +4,36 @@ ng:controller="DocsController"> <angular/> - - - - - - - - - - - - +