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

Commit

Permalink
Merge pull request #1021 from matsluni/fix_#1015
Browse files Browse the repository at this point in the history
= site: fix for #1015
  • Loading branch information
sirthias committed Mar 17, 2015
2 parents e9956bb + 3390f74 commit 9757be6
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 591 deletions.
1 change: 1 addition & 0 deletions site/src/main/resources/theme/css/spray.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ table.footnote td { vertical-align: top; }

span.twitter-typeahead input[type=text] { width: 200px; margin: -5px 46px 0 0; }
.tt-suggestion { white-space: nowrap; }
.tt-empty-message { padding: 5px 10px; text-align: center; }

@media (max-width: 979px) {
#talk-link { display: none; }
Expand Down
6 changes: 3 additions & 3 deletions site/src/main/resources/theme/css/typeahead.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.twitter-typeahead .tt-query,
.twitter-typeahead .tt-input,
.twitter-typeahead .tt-hint {
margin-bottom: 0;
}
Expand Down Expand Up @@ -28,7 +28,7 @@
padding: 3px 20px;
}

.tt-suggestion.tt-is-under-cursor {
.tt-suggestion.tt-cursor {
color: #fff;
background-color: #0081c2;
background-image: -moz-linear-gradient(top, #0088cc, #0077b3);
Expand All @@ -40,7 +40,7 @@
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0)
}

.tt-suggestion.tt-is-under-cursor a {
.tt-suggestion.tt-cursor a {
color: #fff;
}

Expand Down
43 changes: 32 additions & 11 deletions site/src/main/resources/theme/js/highlight-directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,36 @@ $(function() {
});
}

$('.typeahead')
.typeahead({
name: "documentation",
remote: "/search/documentation/typeahead?terms=%QUERY",
engine: Hogan,
limit: 10,
template: "<div>{{extra.parent}}:&nbsp;<strong>{{name}}</strong></div>"
})
.bind("typeahead:selected", function(event, datum) {
window.location = datum.url;
});
var suggestionsEngine = new Bloodhound({
datumTokenizer: function(d) {
return Bloodhound.tokenizers.whitespace(d.num);
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
name: "documentation",
limit: 10,
remote: "/search/documentation/typeahead?terms=%QUERY"
});

suggestionsEngine.initialize();

$('.typeahead').typeahead(
{ minLength: 3 },
{
source: suggestionsEngine.ttAdapter(),
templates: {
empty: function(data) {
return [
'<span class="tt-empty-message">',
'Could not find results for: <strong>'+data.query+'</strong>',
'</span>'].join('\n')
},
suggestion: function(data) {
return '<div>'+data.extra.parent+':&nbsp;<strong>'+data.name+'</strong></div>'
}
}
}
)
.bind("typeahead:selected", function(event, datum) {
window.location = datum.url;
});
});

0 comments on commit 9757be6

Please sign in to comment.