aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src
diff options
context:
space:
mode:
authorMatias Niemelä2013-10-16 22:48:32 -0400
committerMatias Niemelä2013-10-23 17:00:12 -0400
commita7e12b7959212f2fa88fe17d5a045cc9d8b22922 (patch)
tree3613ad9f20a92eb9e7a88402e34a078092663cba /docs/src
parent3f568b22f9bec09192588e3cae937db5c2e757f9 (diff)
downloadangular.js-a7e12b7959212f2fa88fe17d5a045cc9d8b22922.tar.bz2
feat(docs): provide index pages for each angular module
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/ngdoc.js19
-rw-r--r--docs/src/templates/css/docs.css23
-rw-r--r--docs/src/templates/js/docs.js42
3 files changed, 84 insertions, 0 deletions
diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js
index 24d1aa26..249f1802 100644
--- a/docs/src/ngdoc.js
+++ b/docs/src/ngdoc.js
@@ -213,6 +213,14 @@ Doc.prototype = {
return words.join(' ');
},
+ shortDescription : function() {
+ var text = this.description.split("\n")[0];
+ text = text.replace(/<.+?\/?>/g, '');
+ text = text.replace(/{/g,'&#123;');
+ text = text.replace(/}/g,'&#125;');
+ return text;
+ },
+
getMinerrNamespace: function () {
if (this.ngdoc !== 'error') {
throw new Error('Tried to get the minErr namespace, but @ngdoc ' +
@@ -471,11 +479,20 @@ Doc.prototype = {
(this.ngdoc === 'error' ? this.name : '') ||
(((this.file||'').match(/.*(\/|\\)([^(\/|\\)]*)\.ngdoc/)||{})[2]) || // try to extract it from file name
this.name; // default to name
+ this.moduleName = parseModuleName(this.id);
this.description = this.markdown(this.description);
this.example = this.markdown(this.example);
this['this'] = this.markdown(this['this']);
return this;
+ function parseModuleName(id) {
+ var module = id.split('.')[0];
+ if(module == 'angular') {
+ module = 'ng';
+ }
+ return module;
+ }
+
function flush() {
if (atName) {
var text = trim(atText.join('\n')), match;
@@ -1106,6 +1123,8 @@ function metadata(docs){
name: title(doc),
shortName: shortName,
type: doc.ngdoc,
+ moduleName: doc.moduleName,
+ shortDescription: doc.shortDescription(),
keywords:doc.keywords()
});
});
diff --git a/docs/src/templates/css/docs.css b/docs/src/templates/css/docs.css
index 430ff4c9..783f1d21 100644
--- a/docs/src/templates/css/docs.css
+++ b/docs/src/templates/css/docs.css
@@ -508,3 +508,26 @@ pre ol li {
font-size: 16px;
word-break: normal;
}
+
+.text-info {
+ color:#3a87ad;
+}
+
+.definition-table tr > td:first-child {
+ font-weight:bold;
+ width:30%;
+}
+
+.definition-table.spaced {
+ margin-bottom:30px;
+}
+
+.component-heading {
+ text-transform:capitalize;
+}
+
+.component-breakdown {
+ margin-bottom:30px;
+ padding-bottom:30px;
+ border-bottom:1px solid #aaa;
+}
diff --git a/docs/src/templates/js/docs.js b/docs/src/templates/js/docs.js
index fbabf193..2c5c56d2 100644
--- a/docs/src/templates/js/docs.js
+++ b/docs/src/templates/js/docs.js
@@ -207,6 +207,48 @@ docsApp.directive.sourceEdit = function(getEmbeddedTemplate) {
}
};
+docsApp.directive.docModuleComponents = ['sections', function(sections) {
+ return {
+ template: ' <div class="component-breakdown">' +
+ ' <h2>Module Components</h2>' +
+ ' <div ng-repeat="(key, section) in components">' +
+ ' <h3 class="component-heading" id="{{ section.type }}">{{ section.title }}</h3>' +
+ ' <table class="definition-table">' +
+ ' <tr>' +
+ ' <th>Name</th>' +
+ ' <th>Description</th>' +
+ ' </tr>' +
+ ' <tr ng-repeat="component in section.components">' +
+ ' <td><a ng-href="{{ component.url }}">{{ component.shortName }}</a></td>' +
+ ' <td>{{ component.shortDescription }}</td>' +
+ ' </tr>' +
+ ' </table>' +
+ ' </div>' +
+ ' </div>',
+ scope : {
+ module : '@docModuleComponents'
+ },
+ controller : ['$scope', function($scope) {
+ var validTypes = ['property','function','directive','service','object','filter'];
+ var components = {};
+ angular.forEach(sections.api, function(item) {
+ if(item.moduleName == $scope.module) {
+ var type = item.type;
+ if(type == 'object') type = 'service';
+ if(validTypes.indexOf(type) >= 0) {
+ components[type] = components[type] || {
+ title : type,
+ type : type,
+ components : []
+ };
+ components[type].components.push(item);
+ }
+ }
+ });
+ $scope.components = components;
+ }]
+ };
+}]
docsApp.directive.docTutorialNav = function(templateMerge) {
var pages = [