aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src
diff options
context:
space:
mode:
authordandoyon2011-09-19 20:11:32 -0700
committerIgor Minar2011-10-30 22:27:25 -0700
commit28ed5ba46595a371bd734b92a6e4bb40d1013741 (patch)
treea5e37419b4316ff1dc6677e3d56ef3d9b78a4c7c /docs/src
parent02dc81bae0011b7ae4190363be5fdd5db420aca9 (diff)
downloadangular.js-28ed5ba46595a371bd734b92a6e4bb40d1013741.tar.bz2
feat(docs): disqus integration
- add style for disqus threads in css - add loadDisqus method to be called afterPartialLoaded - add div container for disqus threads
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/templates/docs.css11
-rw-r--r--docs/src/templates/docs.js24
-rw-r--r--docs/src/templates/index.html12
3 files changed, 40 insertions, 7 deletions
diff --git a/docs/src/templates/docs.css b/docs/src/templates/docs.css
index 4a2a7fb3..765c7e4a 100644
--- a/docs/src/templates/docs.css
+++ b/docs/src/templates/docs.css
@@ -268,7 +268,7 @@ li {
/*----- content styles -----*/
-#content-panel {
+.content-panel {
float: left;
margin-top: 4em;
margin-left: 3em;
@@ -286,7 +286,7 @@ li {
border-radius: 15px;
}
-#content-panel > h2 {
+.content-panel > h2 {
font-size: 2em;
font-weight: normal;
color: #fff;
@@ -294,8 +294,7 @@ li {
height: 1em;
}
-
-#content {
+.content-panel-content {
background-color: #fff;
display: block;
margin: 0.7em -1em -1em;
@@ -354,6 +353,10 @@ li {
padding-left: 0;
}
+#disqus #disqus_thread {
+ margin: 0.7em -1em -1em;
+}
+
/* subpages */
#fader {
diff --git a/docs/src/templates/docs.js b/docs/src/templates/docs.js
index 6ca6bdcf..f5696050 100644
--- a/docs/src/templates/docs.js
+++ b/docs/src/templates/docs.js
@@ -71,11 +71,13 @@ function DocsController($location, $window, $cookies) {
};
scope.afterPartialLoaded = function() {
+ var currentPageId = $location.path();
scope.loading--;
scope.partialTitle = scope.futurePartialTitle;
SyntaxHighlighter.highlight();
$window.scrollTo(0,0);
- $window._gaq.push(['_trackPageview', $location.path()]);
+ $window._gaq.push(['_trackPageview', currentPageId]);
+ loadDisqus(currentPageId);
};
scope.getFeedbackUrl = function() {
@@ -105,6 +107,26 @@ function DocsController($location, $window, $cookies) {
});
}
});
+
+ function loadDisqus(currentPageId) {
+ // http://docs.disqus.com/help/2/
+ window.disqus_shortname = 'angularjs';
+ window.disqus_identifier = currentPageId;
+
+ if ($location.host() == 'localhost') {
+ window.disqus_developer = 1;
+ }
+
+ // http://docs.disqus.com/developers/universal/
+ (function() {
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+ dsq.src = 'http://angularjs.disqus.com/embed.js';
+ (document.getElementsByTagName('head')[0] ||
+ document.getElementsByTagName('body')[0]).appendChild(dsq);
+ })();
+
+ angular.element(document.getElementById('disqus_thread')).html('');
+ }
}
// prevent compilation of code
diff --git a/docs/src/templates/index.html b/docs/src/templates/index.html
index 64513d58..f0c195f9 100644
--- a/docs/src/templates/index.html
+++ b/docs/src/templates/index.html
@@ -114,10 +114,18 @@
<div id="loading" ng:show="loading">Loading...</div>
- <div id="content-panel">
+ <div class="content-panel">
<h2 ng:bind="partialTitle"></h2>
<a id="feedback" ng:href="{{getFeedbackUrl()}}">Report an Issue or Ask a Question</a>
- <ng:include id="content" src="getCurrentPartial()" onload="afterPartialLoaded()"></ng:include>
+ <ng:include id="content"
+ class="content-panel-content"
+ src="getCurrentPartial()"
+ onload="afterPartialLoaded()"></ng:include>
+ </div>
+
+ <div id="disqus" class="content-panel">
+ <h2>Discussion</h2>
+ <div id="disqus_thread" class="content-panel-content"></div>
</div>
<div id="footer" ng:cloak>