2010-11-16 21:39:50 +00:00
|
|
|
DocsController.$inject = ['$location', '$browser', '$window'];
|
|
|
|
|
function DocsController($location, $browser, $window) {
|
2010-11-15 20:15:27 +00:00
|
|
|
this.pages = NG_PAGES;
|
|
|
|
|
window.$root = this.$root;
|
2011-01-19 23:42:11 +00:00
|
|
|
|
2010-11-15 20:15:27 +00:00
|
|
|
this.getUrl = function(page){
|
2011-01-26 05:55:11 +00:00
|
|
|
return '#!' + page.id;
|
2010-10-27 22:31:10 +00:00
|
|
|
};
|
2010-11-15 20:15:27 +00:00
|
|
|
|
|
|
|
|
this.getCurrentPartial = function(){
|
|
|
|
|
return './' + this.getTitle() + '.html';
|
|
|
|
|
};
|
2011-01-19 23:42:11 +00:00
|
|
|
|
2010-11-15 20:15:27 +00:00
|
|
|
this.getTitle = function(){
|
|
|
|
|
var hashPath = $location.hashPath || '!angular';
|
2011-01-26 05:55:11 +00:00
|
|
|
if (hashPath.match(/^!/)) {
|
2010-11-15 20:15:27 +00:00
|
|
|
this.partialTitle = hashPath.substring(1);
|
|
|
|
|
}
|
|
|
|
|
return this.partialTitle;
|
|
|
|
|
};
|
2011-01-19 23:42:11 +00:00
|
|
|
|
2010-11-15 20:15:27 +00:00
|
|
|
this.getClass = function(page) {
|
2011-01-26 05:55:11 +00:00
|
|
|
var depth = page.depth,
|
2010-11-17 19:33:30 +00:00
|
|
|
cssClass = 'level-' + depth + (page.name == this.getTitle() ? ' selected' : '');
|
|
|
|
|
|
|
|
|
|
if (depth == 1 && page.type !== 'overview') cssClass += ' level-angular';
|
|
|
|
|
|
|
|
|
|
return cssClass;
|
2010-11-15 20:15:27 +00:00
|
|
|
};
|
2010-11-16 21:39:50 +00:00
|
|
|
|
|
|
|
|
this.afterPartialLoaded = function() {
|
|
|
|
|
SyntaxHighlighter.highlight();
|
|
|
|
|
};
|
2010-11-19 00:53:11 +00:00
|
|
|
|
|
|
|
|
this.getFeedbackUrl = function() {
|
|
|
|
|
return "mailto:angular@googlegroups.com?" +
|
|
|
|
|
"subject=" + escape("Feedback on " + $location.href) + "&" +
|
|
|
|
|
"body=" + escape("Hi there,\n\nI read " + $location.href + " and wanted to ask ....");
|
2010-12-10 21:55:18 +00:00
|
|
|
};
|
2011-01-19 23:42:11 +00:00
|
|
|
|
2010-10-27 22:31:10 +00:00
|
|
|
}
|
2010-11-15 20:15:27 +00:00
|
|
|
|
2011-01-31 19:55:44 +00:00
|
|
|
// prevent compilation of code
|
|
|
|
|
angular.widget('code', function(element){
|
|
|
|
|
element.attr('ng:non-bindable', 'true');
|
|
|
|
|
});
|
|
|
|
|
|
2010-12-10 21:55:18 +00:00
|
|
|
SyntaxHighlighter['defaults'].toolbar = false;
|