aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src/templates/docs.js
diff options
context:
space:
mode:
authorMisko Hevery2011-04-29 15:18:27 -0700
committerIgor Minar2011-06-06 22:28:38 -0700
commit11e9572b952e49b01035e956c412d6095533031a (patch)
tree04dbf96802f552693d44c541c0d825a2769e3d57 /docs/src/templates/docs.js
parentb6bc6c2ddf1ae1523ec7e4cb92db209cd6501181 (diff)
downloadangular.js-11e9572b952e49b01035e956c412d6095533031a.tar.bz2
Move documentation under individual headings
Diffstat (limited to 'docs/src/templates/docs.js')
-rw-r--r--docs/src/templates/docs.js20
1 files changed, 14 insertions, 6 deletions
diff --git a/docs/src/templates/docs.js b/docs/src/templates/docs.js
index 9483496e..47bb87a6 100644
--- a/docs/src/templates/docs.js
+++ b/docs/src/templates/docs.js
@@ -1,8 +1,8 @@
var HAS_HASH = /#/;
DocsController.$inject = ['$location', '$browser', '$window'];
function DocsController($location, $browser, $window) {
- this.pages = NG_PAGES;
window.$root = this.$root;
+ var self = this;
this.$location = $location;
if (!HAS_HASH.test($location.href)) {
@@ -11,28 +11,36 @@ function DocsController($location, $browser, $window) {
this.$watch('$location.hashPath', function(hashPath) {
if (hashPath.match(/^!/)) {
- this.partialId = hashPath.substring(1);
- this.partialTitle = (angular.Array.filter(NG_PAGES, {id:this.partialId})[0]||{}).name;
+ var parts = hashPath.substring(1).split('/');
+ self.sectionId = parts[0];
+ self.partialId = parts[1] || 'index';
+ self.pages = angular.Array.filter(NG_PAGES, {section:self.sectionId});
+ self.partialTitle = (angular.Array.filter(self.pages, function(doc){return doc.id == self.partialId;})[0]||{}).name;
}
});
this.getUrl = function(page){
- return '#!' + page.id;
+ return '#!' + page.section + '/' + page.id;
};
this.getCurrentPartial = function(){
- return './' + this.partialId + '.html';
+ return './' + this.sectionId + '/' + this.partialId + '.html';
};
this.getClass = function(page) {
var depth = page.depth,
cssClass = 'level-' + depth + (page.name == this.partialId ? ' selected' : '');
- if (depth == 1 && page.type !== 'overview') cssClass += ' level-angular';
+ if (page.section == 'api')
+ cssClass += ' monospace';
return cssClass;
};
+ this.selectedSection = function(section) {
+ return section == self.sectionId ? 'selected' : null;
+ };
+
this.afterPartialLoaded = function() {
SyntaxHighlighter.highlight();
};