aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src/templates/js/docs.js
diff options
context:
space:
mode:
authorMatias Niemelä2013-10-22 00:14:39 -0400
committerMatias Niemelä2013-10-22 21:23:59 -0400
commit6c20ec193f11aa647be1b2ad2ac5b3e7c2894bd7 (patch)
treeb7a2121c589b673462fdcbdd877d7477ac423fb2 /docs/src/templates/js/docs.js
parent06557aab44860baf3f121f3db424c5ede0764bf4 (diff)
downloadangular.js-6c20ec193f11aa647be1b2ad2ac5b3e7c2894bd7.tar.bz2
fix(ngdocs): remove the side search bar
BREAKING CHANGE The side search bar on the docs page has been removed in favor of the top search bar.
Diffstat (limited to 'docs/src/templates/js/docs.js')
-rw-r--r--docs/src/templates/js/docs.js55
1 files changed, 8 insertions, 47 deletions
diff --git a/docs/src/templates/js/docs.js b/docs/src/templates/js/docs.js
index fb095090..beec604b 100644
--- a/docs/src/templates/js/docs.js
+++ b/docs/src/templates/js/docs.js
@@ -622,10 +622,6 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie
};
};
- $scope.submitForm = function() {
- $scope.bestMatch && $location.path($scope.bestMatch.page.url);
- };
-
$scope.afterPartialLoaded = function() {
var currentPageId = $location.path();
$scope.partialTitle = $scope.currentPage.shortName;
@@ -660,6 +656,9 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie
cookbook: 'Examples',
error: 'Error Reference'
};
+
+ populateComponentsList();
+
$scope.$watch(function docsPathWatch() {return $location.path(); }, function docsPathWatchAction(path) {
// ignore non-doc links which are used in examples
if (DOCS_PATH.test(path)) {
@@ -675,9 +674,6 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie
$scope.partialTitle = 'Error: Page Not Found!';
}
- updateSearch();
-
-
// Update breadcrumbs
var breadcrumb = $scope.breadcrumb = [],
match;
@@ -717,10 +713,6 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie
}
});
- $scope.$watch('search', updateSearch);
-
-
-
/**********************************
Initialize
***********************************/
@@ -752,27 +744,22 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie
Private methods
***********************************/
- function updateSearch() {
+ function populateComponentsList() {
+ var area = $location.path().split('/')[1];
+ area = /^index-\w/.test(area) ? 'api' : area;
var moduleCache = {},
namespaceCache = {},
- pages = sections[$location.path().split('/')[1]],
+ pages = sections[area],
modules = $scope.modules = [],
namespaces = $scope.namespaces = [],
globalErrors = $scope.globalErrors = [],
otherPages = $scope.pages = [],
- search = $scope.search,
- bestMatch = {page: null, rank:0};
+ search = $scope.search;
angular.forEach(pages, function(page) {
var match,
id = page.id;
- if (!(match = rank(page, search))) return;
-
- if (match.rank > bestMatch.rank) {
- bestMatch = match;
- }
-
if (page.id == 'index') {
//skip
} else if (page.section != 'api') {
@@ -808,10 +795,6 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie
});
- $scope.bestMatch = bestMatch;
-
- /*************/
-
function module(name) {
var module = moduleCache[name];
@@ -852,28 +835,6 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie
}
return namespace;
}
-
- function rank(page, terms) {
- var ranking = {page: page, rank:0},
- keywords = page.keywords,
- title = page.shortName.toLowerCase();
-
- terms && angular.forEach(terms.toLowerCase().split(' '), function(term) {
- var index;
-
- if (ranking) {
- if (keywords.indexOf(term) == -1) {
- ranking = null;
- } else {
- ranking.rank ++; // one point for each term found
- if ((index = title.indexOf(term)) != -1) {
- ranking.rank += 20 - index; // ten points if you match title
- }
- }
- }
- });
- return ranking;
- }
}