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

surface search on narrow screens #1689

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion assets/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ $(document).ready(function() {
});
$('.tt-hint').addClass('form-control');
$('#search').submit(submitSearch);
$('#search2').submit(submitSearch);
$('#lookup-box').on('typeahead:selected', submitSearch);
$('#lookup-box').focus();

Expand Down Expand Up @@ -150,7 +151,7 @@ function fallbackCopyTextToClipboard(text) {
//search submit
function submitSearch(e) {
e.preventDefault();
var newLocation = $('#lookup-box').val().toLowerCase();
var newLocation = $(this).find('#lookup-box').val().toLowerCase();
document.location = '/' + encodeURIComponent((newLocation.length && newLocation[0] == '/') ? newLocation.slice(1) : newLocation);
}
//google analytics
Expand Down
12 changes: 11 additions & 1 deletion views/index.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ qPeople = oLeader.get();
<div class="container">
<h1>CFDocs</h1>
<p>UltraFast CFML Documentation Reference.</p>
<form class="hidden-md hidden-lg" id="search2">
<div class="form-group">
<div class="input-group">
<input type="text" style="width:100%" placeholder="Tag or Function..." id="lookup-box" class="form-control">
<div class="input-group-btn">
<button type="submit" class="btn btn-primary" style=" margin-top: -4px;">Go</button>
</div>
</div>
</div>
</form>
</div>
</div>

Expand Down Expand Up @@ -50,7 +60,7 @@ qPeople = oLeader.get();
</cfloop>
<!--- cache for 1 day --->
<cfset request.cacheControlMaxAge = 86400>

</cfoutput>
</div>
<cfelse>
Expand Down
7 changes: 3 additions & 4 deletions views/layout.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<meta property="og:image:alt" content="#EncodeForHTMLAttribute(request.description)#" />
<meta property="og:image:width" content="512" />
<meta property="og:image:height" content="256" />

<meta name="twitter:image:src" content="https://cfdocs.org/openimage.cfm?name=#EncodeForHTMLAttribute(lcase(request.ogname))#" />
<meta name="twitter:site" content="CF Docs" />
<meta name="twitter:card" content="summary_large_image" />
Expand Down Expand Up @@ -103,7 +103,7 @@
</li>
</cfoutput>
</ul>
<form class="navbar-form navbar-left hidden-sm" id="search">
<form class="navbar-form navbar-left hidden-sm hidden-xs" id="search">
<div class="form-group">
<div class="input-group">
<input type="text" style="width:100%" placeholder="Tag or Function..." id="lookup-box" class="form-control">
Expand All @@ -118,7 +118,6 @@
</div>
</nav>


<cfoutput>#request.content#</cfoutput>

<div class="jumbotron" id="cfbreak">
Expand All @@ -134,7 +133,7 @@
</div>
</form>
</div>
</div>
</div>


<footer>
Expand Down