diff options
Diffstat (limited to 'docs/src/templates')
| -rw-r--r-- | docs/src/templates/doc_widgets.js | 27 | ||||
| -rw-r--r-- | docs/src/templates/docs.js | 21 | ||||
| -rw-r--r-- | docs/src/templates/index.html | 4 | 
3 files changed, 29 insertions, 23 deletions
diff --git a/docs/src/templates/doc_widgets.js b/docs/src/templates/doc_widgets.js index bfa8e5d0..75cea1be 100644 --- a/docs/src/templates/doc_widgets.js +++ b/docs/src/templates/doc_widgets.js @@ -29,17 +29,22 @@          scenario = element.find('doc\\:scenario').eq(0);      var code = indent(exampleSrc); -    var tabs = angular.element( -        '<ul class="doc-example">' + -          '<li class="doc-example-heading"><h3>Source</h3></li>' + -          '<li class="doc-example-source" ng:non-bindable>' + -            '<pre class="brush: js; html-script: true; highlight: [' + -            code.hilite + ']; toolbar: false;"></pre></li>' + -          '<li class="doc-example-heading"><h3>Live Preview</h3></li>' + -          '<li class="doc-example-live">' + exampleSrc +'</li>' + -          '<li class="doc-example-heading"><h3>Scenario Test</h3></li>' + -          '<li class="doc-example-scenario"><pre class="brush: js">' + scenario.text() + '</pre></li>' + -        '</ul>'); +    var tabHtml = +      '<ul class="doc-example">' + +        '<li class="doc-example-heading"><h3>Source</h3></li>' + +        '<li class="doc-example-source" ng:non-bindable>' + +          '<pre class="brush: js; html-script: true; highlight: [' + +          code.hilite + ']; toolbar: false;"></pre></li>' + +        '<li class="doc-example-heading"><h3>Live Preview</h3></li>' + +        '<li class="doc-example-live">' + exampleSrc +'</li>'; +    if (scenario.text()) { +      tabHtml += +        '<li class="doc-example-heading"><h3>Scenario Test</h3></li>' + +        '<li class="doc-example-scenario"><pre class="brush: js">' + scenario.text() + '</pre></li>'; +    } +    tabHtml += +      '</ul>'; +    var tabs = angular.element(tabHtml);      tabs.find('li.doc-example-source > pre').text(HTML_TEMPLATE.replace('_HTML_SOURCE_', code.html)); diff --git a/docs/src/templates/docs.js b/docs/src/templates/docs.js index ab96a699..e244bc7e 100644 --- a/docs/src/templates/docs.js +++ b/docs/src/templates/docs.js @@ -2,26 +2,27 @@ DocsController.$inject = ['$location', '$browser', '$window'];  function DocsController($location, $browser, $window) {    this.pages = NG_PAGES;    window.$root = this.$root; +  this.$location = $location; + +  this.$watch('$location.hashPath', function(hashPath){ +    hashPath = hashPath || '!angular'; +    if (hashPath.match(/^!/)) { +      this.partialId = hashPath.substring(1); +      this.partialTitle = (angular.Array.filter(NG_PAGES, {id:this.partialId})[0]||{}).name; +    } +  });    this.getUrl = function(page){      return '#!' + page.id;    };    this.getCurrentPartial = function(){ -    return './' + this.getTitle() + '.html'; -  }; - -  this.getTitle = function(){ -    var hashPath = $location.hashPath || '!angular'; -    if (hashPath.match(/^!/)) { -      this.partialTitle = hashPath.substring(1); -    } -    return this.partialTitle; +    return './' + this.partialId + '.html';    };    this.getClass = function(page) {      var depth = page.depth, -        cssClass = 'level-' + depth + (page.name == this.getTitle() ? ' selected' : ''); +        cssClass = 'level-' + depth + (page.name == this.partialId ? ' selected' : '');      if (depth == 1 && page.type !== 'overview') cssClass += ' level-angular'; diff --git a/docs/src/templates/index.html b/docs/src/templates/index.html index 538be297..63e8d871 100644 --- a/docs/src/templates/index.html +++ b/docs/src/templates/index.html @@ -3,7 +3,7 @@        xmlns:doc="http://docs.angularjs.org/"        ng:controller="DocsController">  <head> -  <title ng:bind-template="<angular/>: {{getTitle()}}"><angular/></title> +  <title ng:bind-template="<angular/>: {{partialTitle}}"><angular/></title>    <meta name="fragment" content="!"> @@ -25,7 +25,7 @@  <body style="display:none;" ng:show="true">    <div id="header">      <h1> -      <span class="main-title">{{getTitle()}}</span> +      <span class="main-title">{{partialTitle}}</span>        <a href="#" tabindex="0"><span class="angular"><angular/></span> Docs</a>      </h1>    </div>  | 
