From c6dbdde6dc875c96a0b89bcdef669eb9171259e0 Mon Sep 17 00:00:00 2001
From: Igor Minar
Date: Mon, 6 Jun 2011 10:15:17 -0700
Subject: fix hashpath prefix for docs/sitemap/etc
---
docs/spec/sitemapSpec.js | 4 ++--
docs/src/SiteMap.js | 6 ++++--
docs/src/ngdoc.js | 4 ++--
docs/src/templates/docs.js | 10 +++++-----
docs/src/templates/index.html | 10 +++++-----
5 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/docs/spec/sitemapSpec.js b/docs/spec/sitemapSpec.js
index 034ff7e0..c66cfd16 100644
--- a/docs/spec/sitemapSpec.js
+++ b/docs/spec/sitemapSpec.js
@@ -12,10 +12,10 @@ describe('sitemap', function(){
});
it('should render ngdoc url', function(){
- var map = new SiteMap([new Doc({name: 'a.b.c<>\'"&'})]);
+ var map = new SiteMap([new Doc({section: 'foo', name: 'a.b.c<>\'"&'})]);
expect(map.render()).toContain([
' ',
- 'http://docs.angularjs.org/#!a.b.c<>'"&',
+ 'http://docs.angularjs.org/#!/foo/a.b.c<>'"&',
'weekly',
''].join(''));
diff --git a/docs/src/SiteMap.js b/docs/src/SiteMap.js
index c2b1ec92..7626cbfc 100644
--- a/docs/src/SiteMap.js
+++ b/docs/src/SiteMap.js
@@ -12,8 +12,10 @@ function SiteMap(docs){
map.push('');
map.push('');
docs.forEach(function(doc){
- map.push(' http://docs.angularjs.org/#!' +
- encode(doc.name) + 'weekly');
+ map.push(' http://docs.angularjs.org/#!/' +
+ encode(doc.section) + '/' +
+ encode(doc.name) +
+ 'weekly');
});
map.push('');
map.push('');
diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js
index 61ac6f78..be4efb6b 100644
--- a/docs/src/ngdoc.js
+++ b/docs/src/ngdoc.js
@@ -534,9 +534,9 @@ Doc.prototype = {
function scenarios(docs){
var specs = [];
docs.forEach(function(doc){
- specs.push('describe("' + doc.id + '", function(){');
+ specs.push('describe("' + doc.section + '/' + doc.id + '", function(){');
specs.push(' beforeEach(function(){');
- specs.push(' browser().navigateTo("index.html#!' + doc.id + '");');
+ specs.push(' browser().navigateTo("index.html#!/' + doc.section + '/' + doc.id + '");');
specs.push(' });');
specs.push('');
doc.scenarios.forEach(function(scenario){
diff --git a/docs/src/templates/docs.js b/docs/src/templates/docs.js
index e631d668..b6da7b97 100644
--- a/docs/src/templates/docs.js
+++ b/docs/src/templates/docs.js
@@ -6,21 +6,21 @@ function DocsController($location, $browser, $window) {
this.$location = $location;
if (!HAS_HASH.test($location.href)) {
- $location.hashPath = '!api/';
+ $location.hashPath = '!/api';
}
this.$watch('$location.hashPath', function(hashPath) {
if (hashPath.match(/^!/)) {
var parts = hashPath.substring(1).split('/');
- self.sectionId = parts[0];
- self.partialId = parts[1] || 'index';
+ self.sectionId = parts[1];
+ self.partialId = parts[2] || '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.section + '/' + page.id;
+ return '#!/' + page.section + '/' + page.id;
};
this.getCurrentPartial = function(){
@@ -48,7 +48,7 @@ function DocsController($location, $browser, $window) {
this.afterPartialLoaded = function() {
SyntaxHighlighter.highlight();
$window.scrollTo(0,0);
- $window._gaq.push(['_trackPageview', $location.hashPath.replace('!', '/')]);
+ $window._gaq.push(['_trackPageview', $location.hashPath.substr(1)]);
};
this.getFeedbackUrl = function() {
diff --git a/docs/src/templates/index.html b/docs/src/templates/index.html
index 6d21fab2..0f000bfa 100644
--- a/docs/src/templates/index.html
+++ b/docs/src/templates/index.html
@@ -51,11 +51,11 @@