aboutsummaryrefslogtreecommitdiffstats
path: root/docs/docs.js
blob: a475b7b67e1cb47218d2c332685d7a5d8352cec6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
SyntaxHighlighter['defaults'].toolbar = false;

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() {
    $window.scroll(0,0);
    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();
});