Skip to content

Commit

Permalink
move search from navigation bar to learn page
Browse files Browse the repository at this point in the history
  • Loading branch information
garbas committed Jun 15, 2020
1 parent 44d7ef8 commit b2fbf2f
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 53 deletions.
2 changes: 1 addition & 1 deletion guides/ad-hoc-developer-environments.tt
@@ -1,4 +1,4 @@
[% WRAPPER layout.tt title="Ad hoc developer environments" hideTitle=1 menu='nixos' %]
[% WRAPPER layout.tt title="Ad hoc developer environments" %]

<h1>Ad hoc developer environments</h1>

Expand Down
2 changes: 1 addition & 1 deletion guides/contributing.tt
@@ -1,4 +1,4 @@
[% WRAPPER layout.tt title="How to Contribute" hideTitle=1 menu='nixos' %]
[% WRAPPER layout.tt title="How to Contribute" %]

<h1>How to Contribute</h1>

Expand Down
2 changes: 1 addition & 1 deletion guides/install-nix.tt
@@ -1,4 +1,4 @@
[% WRAPPER layout.tt title="Install Nix" hideTitle=1 menu='nixos' %]
[% WRAPPER layout.tt title="Install Nix" %]

<h1>Install Nix</h1>

Expand Down
21 changes: 6 additions & 15 deletions js/nixos-site.js
@@ -1,26 +1,17 @@
$(document).ready(function () {
$(".nixos-popover").popover({});
$(".navbar-search a").click(function (event) {

$("#learn-options-search button, #options-search button").click(function (event) {
event.preventDefault();
var url = window.location.protocol + "//" + window.location.host + "/nixos";
if ($(this).hasClass("search-options")) {
url += "/options.html";
url += "#" + $("input", $(this).parents("form")).val()
} else {
url += "/packages.html"
url += "?query=" + $("input", $(this).parents("form")).val();
}
var url = window.location.protocol + "//" + window.location.host + "/nixos/options.html"
url += "#" + $("input", $(this).parents("form")).val()
window.location.href = url;
});
$("#packages-search button").click(function (event) {

$("#learn-packages-search button, #packages-search button").click(function (event) {
event.preventDefault();
var url = window.location.protocol + "//" + window.location.host + "/nixos/packages.html"
url += "?query=" + $("input", $(this).parents("form")).val();
window.location.href = url;
});
var qs = new URLSearchParams(window.location.search.substring(1));
var query = qs.get("query");
if (query !== null) {
$(".navbar-search input").val(query);
}
});
20 changes: 1 addition & 19 deletions layout.tt
Expand Up @@ -5,7 +5,7 @@
<html lang="en">

<head>
<title>[% title %]</title>
<title>NixOS - [% title %]</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<script type="text/javascript" src="[% root %]js/jquery.min.js"></script>
Expand Down Expand Up @@ -44,24 +44,6 @@
<li><a href="[%root%]governance.html">Governance</a></li>
<li><a href="[%root%]donate.html">Donate</a></li>
</ul>
[% IF !hideSearch %]
<form class="navbar-search pull-right">
<div class="input-append">
<input class="span2" id="appendedDropdownButton" placeholder="Search for packages or options"
type="text" />
<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown">
Search
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
<li><a href="#" class="search-packages">... for packages</a></li>
<li><a href="#" class="search-options">... for options</a></li>
</ul>
</div>
</div>
</form>
[% END %]
</div>
</div>
</div>
Expand Down
47 changes: 40 additions & 7 deletions learn.tt
Expand Up @@ -2,14 +2,46 @@

<h2>Guides</h2>

<ul>
<li><a href="[%root%]guides/install-nix.html">Install Nix</a></li>
<li><a href="[%root%]guides/ad-hoc-developer-environments.html">Ad hoc developer environments</a></li>
<li><a href="[%root%]guides/contributing.html">How to Contribute</a></li>
</ul>
<div class="row-fluid">
<div class="span12">
<ul>
<li><a href="[%root%]guides/install-nix.html">Install Nix</a></li>
<li><a href="[%root%]guides/ad-hoc-developer-environments.html">Ad hoc developer environments</a></li>
<li><a href="[%root%]guides/contributing.html">How to Contribute</a></li>
</ul>
</div>
</div>

<hr />

<div class="row-fluid">
<div class="span6">
<h2>Discover Nix packages</h2>
<form id="learn-packages-search">
<div class="input-append">
<input class="span10" placeholder="Search for Nix packages" type="text" />
<button class="btn dropdown-toggle" data-toggle="dropdown">
Search
</button>
</div>
</form>
</div>
<div class="span6">
<h2>Discover NixOS options</h2>
<form id="learn-options-search">
<div class="input-append">
<input class="span10" placeholder="Search for NixOS options" type="text" />
<button class="btn dropdown-toggle" data-toggle="dropdown">
Search
</button>
</div>
</form>
</div>
</div>

<hr />

<div class="row-fluid">
<div class="span4">
<h2>Learn Nix</h2>
<p>Nix is a package manager which comes in a form of many command line tools.
Expand Down Expand Up @@ -106,7 +138,7 @@
<li><a href="[%root%]nixpkgs/manual/#sec-emacs">Emacs</a></li>
<li><a href="[%root%]nixpkgs/manual/#sec-eclipse">Eclipse</a></li>
<li><a href="[%root%]nixpkgs/manual/#sec-kakoune">Kakoune</a></li>
<!-- TODO
<!-- TODO
<li><a href="[%root%]nixpkgs/manual/#">Visual Studio Code</a></li>
-->
<li>...</li>
Expand Down Expand Up @@ -158,7 +190,8 @@
<p>The <a href="[%root%]community.html">Community page</a> shows where the community meets.</p>

<h2>Get commercial support</h2>
<p>The <a href="[%root%]commercial-support.html">Commercial support page</a> provides a list of consulting companies.</p>
<p>The <a href="[%root%]commercial-support.html">Commercial support page</a> provides a list of consulting
companies.</p>
</div>

</div>
Expand Down
2 changes: 1 addition & 1 deletion nixos/options.tt
@@ -1,4 +1,4 @@
[% WRAPPER layout.tt title='Search NixOS options' menu='nixos' hideSearch=1 %]
[% WRAPPER layout.tt title='Search NixOS options' %]

<p>
<input name='query' type='text' class='search-query span3'
Expand Down
2 changes: 1 addition & 1 deletion nixos/packages.tt
@@ -1,4 +1,4 @@
[% WRAPPER layout.tt title="Search NixOS packages" menu="nixos" hideSearch=1 %]
[% WRAPPER layout.tt title="Search NixOS packages" %]

<div id="packages-explorer">
<div class="app">
Expand Down
2 changes: 1 addition & 1 deletion teams/discourse.tt
@@ -1,4 +1,4 @@
[% WRAPPER layout.tt hideTitle=1 title="Discourse Team" menu='nixos' %]
[% WRAPPER layout.tt title="Discourse Team" %]

<h1>Discourse Team</h1>

Expand Down
2 changes: 1 addition & 1 deletion teams/infrastructure.tt
@@ -1,4 +1,4 @@
[% WRAPPER layout.tt hideTitle=1 title="Infrastructure Team" menu='nixos' %]
[% WRAPPER layout.tt title="Infrastructure Team" %]

<h1>Infrastructure Team</h1>

Expand Down
2 changes: 1 addition & 1 deletion teams/marketing.tt
@@ -1,4 +1,4 @@
[% WRAPPER layout.tt hideTitle=1 title="Marketing team" menu='nixos' %]
[% WRAPPER layout.tt title="Marketing team" %]
[% PROCESS common.tt %]

<h1>Marketing team</h1>
Expand Down
2 changes: 1 addition & 1 deletion teams/nixcon.tt
@@ -1,4 +1,4 @@
[% WRAPPER layout.tt hideTitle=1 title="NixCon Team" menu='nixos' %]
[% WRAPPER layout.tt title="NixCon Team" %]

<h1>NixCon Team</h1>

Expand Down
2 changes: 1 addition & 1 deletion teams/nixos_release.tt
@@ -1,4 +1,4 @@
[% WRAPPER layout.tt hideTitle=1 title="NixOS Release Team" menu='nixos' %]
[% WRAPPER layout.tt title="NixOS Release Team" %]

<h1>NixOS Release Team</h1>

Expand Down
2 changes: 1 addition & 1 deletion teams/rfc-steering-committee.tt
@@ -1,4 +1,4 @@
[% WRAPPER layout.tt hideTitle=1 title="RFC Steering Committee" menu='nixos' %]
[% WRAPPER layout.tt title="RFC Steering Committee" %]
[% PROCESS common.tt %]

<h1>RFC Steering Committee</h1>
Expand Down
2 changes: 1 addition & 1 deletion teams/security.tt
@@ -1,4 +1,4 @@
[% WRAPPER layout.tt hideTitle=1 title="Security Team" menu='nixos' %]
[% WRAPPER layout.tt title="Security Team" %]
[% PROCESS common.tt %]

<h1>Security Team</h1>
Expand Down

0 comments on commit b2fbf2f

Please sign in to comment.