Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 6c20ec1

Browse files
committed
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.
1 parent 06557aa commit 6c20ec1

File tree

4 files changed

+31
-126
lines changed

4 files changed

+31
-126
lines changed

docs/src/templates/css/animations.css

-42
Original file line numberDiff line numberDiff line change
@@ -37,40 +37,6 @@
3737
opacity:1;
3838
}
3939

40-
.expand.ng-enter,
41-
.expand.ng-move,
42-
.expand.ng-leave {
43-
-webkit-transition:0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) all;
44-
-moz-transition:0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) all;
45-
-o-transition:0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) all;
46-
transition:0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) all;
47-
}
48-
.expand.ng-move,
49-
.expand.ng-enter {
50-
opacity:0;
51-
line-height:0;
52-
height:0!important;
53-
}
54-
.expand.ng-move.ng-move-active,
55-
.expand.ng-enter.ng-enter-active {
56-
opacity:1;
57-
line-height:20px;
58-
height:20px!important;
59-
}
60-
61-
.expand.ng-leave {
62-
opacity:1;
63-
height:20px;
64-
}
65-
.expand.ng-leave.ng-leave-active {
66-
opacity:0;
67-
height:0;
68-
}
69-
70-
.fade-in.ng-enter,
71-
.fade-in.ng-move,
72-
.fade-in.ng-hide-add,
73-
.fade-in.ng-hide-remove,
7440
.foldout.ng-enter,
7541
.foldout.ng-move,
7642
.foldout.ng-hide-add,
@@ -81,21 +47,13 @@
8147
transition:0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) all;
8248
}
8349

84-
.fade-in.ng-enter,
85-
.fade-in.ng-move,
86-
.fade-in.ng-hide-remove,
87-
.fade-in.ng-hide-add.ng-hide-active,
8850
.foldout.ng-hide-remove,
8951
.foldout.ng-hide-add.ng-hide-active,
9052
.foldout.ng-enter,
9153
.foldout.ng-move {
9254
opacity:0;
9355
}
9456

95-
.fade-in.ng-enter.ng-enter-active,
96-
.fade-in.ng-move.ng-move-active,
97-
.fade-in.ng-hide-remove.ng-hide-remove-active,
98-
.fade-in.ng-hide-add,
9957
.foldout.ng-move.ng-move-active,
10058
.foldout.ng-hide-remove.ng-hide-remove-active,
10159
.foldout.ng-hide-add,

docs/src/templates/css/docs.css

+12-12
Original file line numberDiff line numberDiff line change
@@ -45,62 +45,62 @@
4545

4646
/* =============================== */
4747

48-
.form-search .dropdown-menu {
48+
.side-navigation .dropdown-menu {
4949
margin-left: 10px;
5050
}
5151

52-
.form-search .code {
52+
.side-navigation .code {
5353
font-family: monospace;
5454
font-weight: bold;
5555
font-size: 13px;
5656
color: black;
5757
}
5858

59-
.form-search > ul.nav > li.module {
59+
.side-navigation > ul.nav > li.module {
6060
background-color: #d3d3d3;
6161
}
6262

63-
.form-search > ul.nav > li.section {
63+
.side-navigation > ul.nav > li.section {
6464
background-color: #ebebeb;
6565
min-height: 14px;
6666
}
6767

68-
.form-search > ul.nav > li.last {
68+
.side-navigation > ul.nav > li.last {
6969
padding-bottom: 1em;
7070
}
7171

72-
.form-search > ul.nav > li.last + li.api-list-item {
72+
.side-navigation > ul.nav > li.last + li.api-list-item {
7373
margin-top:-1em;
7474
padding-bottom: 1em;
7575
}
7676

77-
.form-search .well {
77+
.side-navigation .well {
7878
border-color: #d3d3d3;
7979
padding-top: 0;
8080
padding-bottom: 0;
8181
margin-bottom: 15px;
8282
}
8383

84-
.form-search .well .nav-header {
84+
.side-navigation .well .nav-header {
8585
text-transform: none;
8686
margin-top: 0;
8787
margin-left: -15px;
8888
margin-right: -15px;
8989
}
9090

91-
.form-search .well .nav-header a {
91+
.side-navigation .well .nav-header a {
9292
text-transform: none;
9393
color: black;
9494
}
95-
.form-search .well .nav-header a:hover {
95+
.side-navigation .well .nav-header a:hover {
9696
background-color: inherit;
9797
}
9898

99-
.form-search .well li {
99+
.side-navigation .well li {
100100
line-height: 14px;
101101
}
102102

103-
.form-search .well .guide {
103+
.side-navigation .well .guide {
104104
float: right;
105105
padding-top: 0;
106106
color: gray;

docs/src/templates/index.html

+11-25
Original file line numberDiff line numberDiff line change
@@ -256,38 +256,24 @@ <h4>{{ key }}</h4>
256256
class="docs-version-jump">
257257
</select>
258258
</div>
259-
<form class="form-search" ng-submit="submitForm()">
260-
<div class="dropdown search"
261-
ng-class="{open: focused && bestMatch.rank > 0 && bestMatch.page != currentPage}">
262-
<input type="text" ng-model="search" placeholder="search the docs"
263-
tabindex="1" accesskey="s" class="input-medium search-query" />
264-
<ul class="dropdown-menu">
265-
<li>
266-
<a href="{{bestMatch.page.url}}">{{bestMatch.page.shortName}}</a>
267-
</li>
268-
</ul>
269-
</div>
270-
271-
<div class="spacer"></div>
272-
<div ng-show="search">Filtered results:</div>
273-
259+
<div class="side-navigation">
274260
<ul class="nav nav-list" ng-hide="page">
275-
<li ng-repeat="page in pages track by page.url" ng-class="navClass(page)" class="expand api-list-item">
261+
<li ng-repeat="page in pages track by page.url" ng-class="navClass(page)" class="api-list-item">
276262
<a href="{{page.url}}" tabindex="2">{{page.shortName}}</a>
277263
</li>
278264
</ul>
279265

280-
<ul class="nav nav-list well api-list-item fade-in" ng-repeat="namespace in namespaces track by namespace.url">
266+
<ul class="nav nav-list well api-list-item" ng-repeat="namespace in namespaces track by namespace.url">
281267
<li class="nav-header module">
282268
<a class="code" href="{{namespace.url}}">{{namespace.name}}</a>
283269
</li>
284270

285-
<li ng-repeat="page in namespace.errors track by page.url" ng-class="navClass(page)" class="expand api-list-item">
271+
<li ng-repeat="page in namespace.errors track by page.url" ng-class="navClass(page)" class="api-list-item">
286272
<a href="{{page.url}}" tabindex="2">{{page.shortName}}</a>
287273
</li>
288274
</ul>
289275

290-
<ul class="nav nav-list well api-list-item fade-in" ng-repeat="module in modules track by module.url">
276+
<ul class="nav nav-list well api-list-item" ng-repeat="module in modules track by module.url">
291277
<li class="nav-header module">
292278
<a class="guide" href="{{URL.module}}">module</a>
293279
<a class="code" href="{{module.url}}">{{module.name}}</a>
@@ -296,43 +282,43 @@ <h4>{{ key }}</h4>
296282
<li class="nav-header section" ng-show="module.directives">
297283
<a href="{{URL.directive}}" class="guide">directive</a>
298284
</li>
299-
<li ng-repeat="page in module.directives track by page.url" ng-class="navClass(page)" class="expand api-list-item">
285+
<li ng-repeat="page in module.directives track by page.url" ng-class="navClass(page)" class="api-list-item">
300286
<a href="{{page.url}}" tabindex="2">{{page.shortName}}</a>
301287
</li>
302288

303289
<li class="nav-header section" ng-show="module.filters">
304290
<a href="{{URL.filter}}" class="guide">filter</a>
305291
</li>
306-
<li ng-repeat="page in module.filters track by page.url" ng-class="navClass(page)" class="expand api-list-item">
292+
<li ng-repeat="page in module.filters track by page.url" ng-class="navClass(page)" class="api-list-item">
307293
<a href="{{page.url}}" tabindex="2">{{page.shortName}}</a>
308294
</li>
309295

310296
<li class="nav-header section" ng-show="module.services">
311297
<a href="{{URL.service}}" class="guide">service</a>
312298
</li>
313-
<li ng-repeat="service in module.services track by service.instance.url" ng-class="navClass(service.instance, service.provider)" class="api-list-item expand">
299+
<li ng-repeat="service in module.services track by service.instance.url" ng-class="navClass(service.instance, service.provider)" class="api-list-item">
314300
<a ng-show="service.provider" class="pull-right" href="{{service.provider.url}}" tabindex="2"><i class="icon-cog"></i></a>
315301
<a href="{{service.instance.url}}" tabindex="2">{{service.name}}</a>
316302
</li>
317303

318304
<li class="nav-header section" ng-show="module.types">
319305
<a href="{{URL.type}}" class="guide">Types</a>
320306
</li>
321-
<li ng-repeat="page in module.types track by page.url" ng-class="navClass(page)" class="expand api-list-item">
307+
<li ng-repeat="page in module.types track by page.url" ng-class="navClass(page)" class="api-list-item">
322308
<a href="{{page.url}}" tabindex="2">{{page.shortName}}</a>
323309
</li>
324310

325311
<li class="nav-header section" ng-show="module.globals">
326312
<a href="{{URL.api}}" class="global guide">global APIs</a>
327313
&nbsp;
328314
</li>
329-
<li ng-repeat="page in module.globals track by page.url" ng-class="navClass(page)" class="expand api-list-item">
315+
<li ng-repeat="page in module.globals track by page.url" ng-class="navClass(page)" class="api-list-item">
330316
<a href="{{page.url}}" tabindex="2">{{page.id}}</a>
331317
</li>
332318

333319
</ul>
334320

335-
</form>
321+
</div>
336322
</div>
337323
</div>
338324
<div class="span9">

docs/src/templates/js/docs.js

+8-47
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,6 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie
622622
};
623623
};
624624

625-
$scope.submitForm = function() {
626-
$scope.bestMatch && $location.path($scope.bestMatch.page.url);
627-
};
628-
629625
$scope.afterPartialLoaded = function() {
630626
var currentPageId = $location.path();
631627
$scope.partialTitle = $scope.currentPage.shortName;
@@ -660,6 +656,9 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie
660656
cookbook: 'Examples',
661657
error: 'Error Reference'
662658
};
659+
660+
populateComponentsList();
661+
663662
$scope.$watch(function docsPathWatch() {return $location.path(); }, function docsPathWatchAction(path) {
664663
// ignore non-doc links which are used in examples
665664
if (DOCS_PATH.test(path)) {
@@ -675,9 +674,6 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie
675674
$scope.partialTitle = 'Error: Page Not Found!';
676675
}
677676

678-
updateSearch();
679-
680-
681677
// Update breadcrumbs
682678
var breadcrumb = $scope.breadcrumb = [],
683679
match;
@@ -717,10 +713,6 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie
717713
}
718714
});
719715

720-
$scope.$watch('search', updateSearch);
721-
722-
723-
724716
/**********************************
725717
Initialize
726718
***********************************/
@@ -752,27 +744,22 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie
752744
Private methods
753745
***********************************/
754746

755-
function updateSearch() {
747+
function populateComponentsList() {
748+
var area = $location.path().split('/')[1];
749+
area = /^index-\w/.test(area) ? 'api' : area;
756750
var moduleCache = {},
757751
namespaceCache = {},
758-
pages = sections[$location.path().split('/')[1]],
752+
pages = sections[area],
759753
modules = $scope.modules = [],
760754
namespaces = $scope.namespaces = [],
761755
globalErrors = $scope.globalErrors = [],
762756
otherPages = $scope.pages = [],
763-
search = $scope.search,
764-
bestMatch = {page: null, rank:0};
757+
search = $scope.search;
765758

766759
angular.forEach(pages, function(page) {
767760
var match,
768761
id = page.id;
769762

770-
if (!(match = rank(page, search))) return;
771-
772-
if (match.rank > bestMatch.rank) {
773-
bestMatch = match;
774-
}
775-
776763
if (page.id == 'index') {
777764
//skip
778765
} else if (page.section != 'api') {
@@ -808,10 +795,6 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie
808795

809796
});
810797

811-
$scope.bestMatch = bestMatch;
812-
813-
/*************/
814-
815798
function module(name) {
816799
var module = moduleCache[name];
817800

@@ -852,28 +835,6 @@ docsApp.controller.DocsController = function($scope, $location, $window, $cookie
852835
}
853836
return namespace;
854837
}
855-
856-
function rank(page, terms) {
857-
var ranking = {page: page, rank:0},
858-
keywords = page.keywords,
859-
title = page.shortName.toLowerCase();
860-
861-
terms && angular.forEach(terms.toLowerCase().split(' '), function(term) {
862-
var index;
863-
864-
if (ranking) {
865-
if (keywords.indexOf(term) == -1) {
866-
ranking = null;
867-
} else {
868-
ranking.rank ++; // one point for each term found
869-
if ((index = title.indexOf(term)) != -1) {
870-
ranking.rank += 20 - index; // ten points if you match title
871-
}
872-
}
873-
}
874-
});
875-
return ranking;
876-
}
877838
}
878839

879840

0 commit comments

Comments
 (0)