diff options
| author | Misko Hevery | 2010-12-23 00:44:27 +0100 | 
|---|---|---|
| committer | Misko Hevery | 2011-01-10 11:50:11 -0800 | 
| commit | 4f22d6866c052fb5b770ce4f377cecacacd9e6d8 (patch) | |
| tree | 6bdb1c5eb70cfd7e6bcf143c121c53025a0489a4 /docs/src/templates/docs.js | |
| parent | aab3df7aeaf79908e8b6212288b283adb42b1ce6 (diff) | |
| download | angular.js-4f22d6866c052fb5b770ce4f377cecacacd9e6d8.tar.bz2 | |
complete rewrite of documentation generation
- romeved mustache.js
- unified templates
- improved testability of the code
Diffstat (limited to 'docs/src/templates/docs.js')
| -rw-r--r-- | docs/src/templates/docs.js | 47 | 
1 files changed, 47 insertions, 0 deletions
| diff --git a/docs/src/templates/docs.js b/docs/src/templates/docs.js new file mode 100644 index 00000000..6bf86ed3 --- /dev/null +++ b/docs/src/templates/docs.js @@ -0,0 +1,47 @@ +DocsController.$inject = ['$location', '$browser', '$window']; +function DocsController($location, $browser, $window) { +  this.pages = NG_PAGES; +  window.$root = this.$root; +   +  this.getUrl = function(page){ +    return '#!' + 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, +        cssClass = 'level-' + depth + (page.name == this.getTitle() ? ' selected' : ''); + +    if (depth == 1 && page.type !== 'overview') cssClass += ' level-angular'; + +    return cssClass; +  }; + +  this.afterPartialLoaded = function() { +    SyntaxHighlighter.highlight(); +  }; + +  this.getFeedbackUrl = function() { +    return "mailto:angular@googlegroups.com?" + +           "subject=" + escape("Feedback on " + $location.href) + "&" + +           "body=" + escape("Hi there,\n\nI read " + $location.href + " and wanted to ask ...."); +  }; +   +} + +angular.filter('short', function(name){ +  return (name||'').split(/\./).pop(); +}); + +SyntaxHighlighter['defaults'].toolbar = false; | 
