Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #1683 by making expanding search opt-in #1706

Merged
merged 1 commit into from
Nov 4, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/NuGetGallery/Scripts/nugetgallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
/// <reference path="jquery-1.6.4.js" />
(function (window, $, undefined) {
function attachSearchBoxBehavior($input, $menu) {
if ($input.length == 0 || $menu.length == 0) {
// If we were given nothing, just return.
return;
}

// Remember the previous state in order to perform smooth animation transforms
var prevstate = false;
function popit(assumeFocused) {
Expand Down Expand Up @@ -72,7 +77,7 @@
// Get the service status
checkServiceStatus();

attachSearchBoxBehavior($('#searchBoxInput'), $('#menu'));
attachSearchBoxBehavior($('#searchBoxInput.expanding-search'), $('#menu.expanding-search'));
});

// Add validator that ensures provided value is NOT equal to a specified value.
Expand Down
4 changes: 2 additions & 2 deletions src/NuGetGallery/Views/Shared/Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@Html.Partial(MVC.Shared.Views.UserDisplay)
</header>
<nav class="main">
<ul id="menu">
<ul id="menu" class="expanding-search">
@{
var homeClass = ViewBag.Tab == "Home" ? "current" : "";
var packagesClass = ViewBag.Tab == "Packages" ? "current" : "";
Expand All @@ -45,7 +45,7 @@
</ul>
<div id="searchBox" role="search">
<form action="@Url.PackageList()" method="get">
<input name="q" id="searchBoxInput" placeholder="Search Packages" value="@(String.IsNullOrEmpty(ViewBag.SearchTerm) ? "" : ViewBag.SearchTerm)" />
<input name="q" id="searchBoxInput" class="expanding-search" placeholder="Search Packages" value="@(String.IsNullOrEmpty(ViewBag.SearchTerm) ? "" : ViewBag.SearchTerm)" />
<input id="searchBoxSubmit" type="submit" value=" " />
</form>
</div>
Expand Down