From b467a50bc75b7f4c0d9bcee521387eda460337bf Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 15 Nov 2010 12:15:27 -0800 Subject: generate keyword for searches; improved layout of doc --- docs/docs.js | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'docs/docs.js') diff --git a/docs/docs.js b/docs/docs.js index 6f5c5034..96fba9cc 100644 --- a/docs/docs.js +++ b/docs/docs.js @@ -1,7 +1,34 @@ -function DocController($resource, $location){ - this.docs = $resource('documentation.json').get(); - this.getPartialDoc = function(){ - return encodeURIComponent($location.hashPath) + '.html'; +SyntaxHighlighter['defaults'].toolbar = false; + +DocsController.$inject = ['$location', '$browser']; +function DocsController($location, $browser) { + this.pages = NG_PAGES; + window.$root = this.$root; + + this.getUrl = function(page){ + return '#!' + encodeURIComponent(page.name); }; + + this.getCurrentPartial = function(){ + return './' + this.getTitle() + '.html'; + }; + + this.getTitle = function(){ + var hashPath = $location.hashPath || '!angular'; + if (hashPath.match(/^!angular/)) { + this.partialTitle = hashPath.substring(1); + } + return this.partialTitle; + }; + + this.getClass = function(page) { + var depth = page.name.split(/\./).length - 1; + return 'level-' + depth + + (page.name == this.getTitle() ? ' selected' : ''); + }; + } -DocController.$inject=['$resource', '$location']; \ No newline at end of file + +angular.filter('short', function(name){ + return (name||'').split(/\./).pop(); +}); \ No newline at end of file -- cgit v1.2.3