diff options
| author | Ken Sheedlo | 2013-07-12 17:42:27 -0700 | 
|---|---|---|
| committer | Ken Sheedlo | 2013-07-24 10:42:20 -0700 | 
| commit | 4a7b6a4555a76b19dd217171fc0ddce6707bca95 (patch) | |
| tree | 4646989291c1be2116c1e59c006f1208cb76c16a /docs/src/templates | |
| parent | dca23173e25a32cb740245ca7f7b01a84805f43f (diff) | |
| download | angular.js-4a7b6a4555a76b19dd217171fc0ddce6707bca95.tar.bz2 | |
docs(minErr): Build minErr doc site
Diffstat (limited to 'docs/src/templates')
| -rw-r--r-- | docs/src/templates/css/docs.css | 9 | ||||
| -rw-r--r-- | docs/src/templates/index.html | 12 | ||||
| -rw-r--r-- | docs/src/templates/js/docs.js | 75 | 
3 files changed, 86 insertions, 10 deletions
| diff --git a/docs/src/templates/css/docs.css b/docs/src/templates/css/docs.css index f4a86ba5..6b1e6527 100644 --- a/docs/src/templates/css/docs.css +++ b/docs/src/templates/css/docs.css @@ -476,3 +476,12 @@ pre ol li {    width:180px;    margin-bottom:20px;  } + +.minerr-errmsg { +  clear: both; +  position: relative; +  top: 10px; +  font-size: 16px; +  word-break: normal; +  word-wrap: normal; +}
\ No newline at end of file diff --git a/docs/src/templates/index.html b/docs/src/templates/index.html index 4bf36838..65e26c99 100644 --- a/docs/src/templates/index.html +++ b/docs/src/templates/index.html @@ -18,7 +18,7 @@      // before the base attribute is added, causing 404 and terribly slow loading of the docs app.      (function() {        var indexFile = (location.pathname.match(/\/(index[^\.]*\.html)/) || ['', ''])[1], -          rUrl = /(#!\/|api|guide|misc|tutorial|cookbook|index[^\.]*\.html).*$/, +          rUrl = /(#!\/|api|guide|misc|tutorial|cookbook|error|index[^\.]*\.html).*$/,            baseUrl = location.href.replace(rUrl, indexFile),            jQuery = /index-jq[^\.]*\.html$/.test(baseUrl),            debug = /index[^\.]*-debug\.html$/.test(baseUrl), @@ -150,6 +150,7 @@                  <li><a href="./tutorial/">Tutorial</a></li>                  <li><a href="./guide/">Developer Guide</a></li>                  <li><a href="./api/">API Reference</a></li> +                <li><a href="./error/">Error Reference</a></li>                  <li><a href="http://docs.angularjs.org/misc/contribute">Contribute</a></li>                  <li><a href="http://code.angularjs.org/">Download</a></li>                </ul> @@ -263,7 +264,16 @@                </li>              </ul> +            <ul class="nav nav-list well api-list-item" ng-repeat="namespace in namespaces track by namespace.url"> +              <li class="nav-header module"> +                <a class="code" href="{{namespace.url}}">{{namespace.name}}</a> +              </li> +              <li ng-repeat="page in namespace.errors track by page.url" ng-class="navClass(page)" ng-animate="'expand'" class="api-list-item"> +                <a href="{{page.url}}" tabindex="2">{{page.shortName}}</a> +              </li> +            </ul> +                          <ul class="nav nav-list well api-list-item" ng-repeat="module in modules track by module.url">                <li class="nav-header module">                  <a class="guide" href="{{URL.module}}">module</a> diff --git a/docs/src/templates/js/docs.js b/docs/src/templates/js/docs.js index ddc0405f..a14237fa 100644 --- a/docs/src/templates/js/docs.js +++ b/docs/src/templates/js/docs.js @@ -299,6 +299,35 @@ docsApp.directive.docTutorialReset = function() {  }; +docsApp.directive.errorDisplay = ['$location', function ($location) { +  var interpolate = function (formatString) { +    var formatArgs = arguments; +    return formatString.replace(/\{\d+\}/g, function (match) { +      // Drop the braces and use the unary plus to convert to an integer. +      // The index will be off by one because of the formatString. +      var index = +match.slice(1, -1); +      if (index + 1 >= formatArgs.length) { +        return match; +      } +      return formatArgs[index+1]; +    }); +  }; + +  return { +    link: function (scope, element, attrs) { +      var search = $location.search(), +        formatArgs = [attrs.errorDisplay], +        i; + +      for (i = 0; search['p'+i]; i++) { +        formatArgs.push(search['p'+i]); +      } +      element.text(interpolate.apply(null, formatArgs)); +    } +  }; +}]; + +  docsApp.serviceFactory.angularUrls = function($document) {    var urls = {}; @@ -420,6 +449,7 @@ docsApp.serviceFactory.sections = ['NG_PAGES', function sections(NG_PAGES) {      tutorial: [],      misc: [],      cookbook: [], +    error: [],      getPage: function(sectionId, partialId) {        var pages = sections[sectionId]; @@ -463,9 +493,10 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie      }    };    var OFFLINE_COOKIE_NAME = 'ng-offline', -      DOCS_PATH = /^\/(api)|(guide)|(cookbook)|(misc)|(tutorial)/, +      DOCS_PATH = /^\/(api)|(guide)|(cookbook)|(misc)|(tutorial)|(error)/,        INDEX_PATH = /^(\/|\/index[^\.]*.html)$/,        GLOBALS = /^angular\.([^\.]+)$/, +      ERROR = /^([a-zA-Z0-9_$]+:)?([a-zA-Z0-9_$]+)$/,        MODULE = /^((?:(?!^angular\.)[^\.])+)$/,        MODULE_MOCK = /^angular\.mock\.([^\.]+)$/,        MODULE_DIRECTIVE = /^((?:(?!^angular\.)[^\.])+)\.directive:([^\.]+)$/, @@ -529,14 +560,15 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie      guide: 'Developer Guide',      misc: 'Miscellaneous',      tutorial: 'Tutorial', -    cookbook: 'Examples' +    cookbook: 'Examples', +    error: 'Error Reference'    };    $scope.$watch(function docsPathWatch() {return $location.path(); }, function docsPathWatchAction(path) {      // ignore non-doc links which are used in examples      if (DOCS_PATH.test(path)) {        var parts = path.split('/'),          sectionId = parts[1], -        partialId = parts[2], +        partialId = parts.slice(2).join('/'),          sectionName = SECTION_NAME[sectionId] || sectionId,          page = sections.getPage(sectionId, partialId); @@ -624,9 +656,12 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie     ***********************************/    function updateSearch() { -    var cache = {}, +    var moduleCache = {}, +        namespaceCache = {},          pages = sections[$location.path().split('/')[1]],          modules = $scope.modules = [], +        namespaces = $scope.namespaces = [], +        globalErrors = $scope.globalErrors = [],          otherPages = $scope.pages = [],          search = $scope.search,          bestMatch = {page: null, rank:0}; @@ -644,7 +679,14 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie        if (page.id == 'index') {          //skip        } else if (page.section != 'api') { -        otherPages.push(page); +        if (page.section === 'error') { +          match = id.match(ERROR); +          if (match[1] !== undefined) { +            namespace(match[1].replace(/:/g, '')).errors.push(page); +          } else { +            globalErrors.push(page); +          } +        }        } else if (id == 'angular.Module') {          module('ng').types.push(page);        } else if (match = id.match(GLOBALS)) { @@ -672,19 +714,20 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie      /*************/      function module(name) { -      var module = cache[name]; +      var module = moduleCache[name]; +        if (!module) { -        module = cache[name] = { +        module = moduleCache[name] = {            name: name,            url: 'api/' + name,            globals: [],            directives: [],            services: [],            service: function(name) { -            var service =  cache[this.name + ':' + name]; +            var service =  moduleCache[this.name + ':' + name];              if (!service) {                service = {name: name}; -              cache[this.name + ':' + name] = service; +              moduleCache[this.name + ':' + name] = service;                this.services.push(service);              }              return service; @@ -697,6 +740,20 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie        return module;      } +    function namespace(name) { +      var namespace = namespaceCache[name]; + +      if (!namespace) { +        namespace = namespaceCache[name] = { +          name: name, +          url: 'error/' + name, +          errors: [] +        }; +        namespaces.push(namespace); +      } +      return namespace; +    } +      function rank(page, terms) {        var ranking = {page: page, rank:0},          keywords = page.keywords, | 
