diff options
Diffstat (limited to 'docs/src/templates/docs.js')
| -rw-r--r-- | docs/src/templates/docs.js | 20 |
1 files changed, 14 insertions, 6 deletions
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(); }; |
