diff --git a/static/scripts/search.js b/static/scripts/search.js index 73970737..c1bbcd39 100644 --- a/static/scripts/search.js +++ b/static/scripts/search.js @@ -1,4 +1,4 @@ - +var repoExpr = /.+\/.+/; var remoteRepos = new Bloodhound({ queryTokenizer: Bloodhound.tokenizers.whitespace, @@ -27,6 +27,36 @@ $('.typeahead').typeahead({ display: "full_name", source: reposWithDefaults, templates: { + empty: function(obj) { + if (obj.query.match(repoExpr) !== null) { + return [ + "
", + "
", + "

", + "No matches found for", + "", + obj.query, + "", + "

", + "

", + "This repository may not be indexed yet.", + "", + "Click here", + "", + "to visit this repository page directly.", + "

", + "
", + "
" + ].join("\n"); + } + return [ + "
", + "
", + "No matches found", + "
", + "
" + ].join("\n"); + }, suggestion: function(obj) { return "
"+ obj.full_name +"
"; } diff --git a/static/styles/search.sass b/static/styles/search.sass index 8d6807d2..0944287c 100644 --- a/static/styles/search.sass +++ b/static/styles/search.sass @@ -34,4 +34,23 @@ margin-left:1rem; div:last-child flex: 1 1 auto; - line-height:32px; \ No newline at end of file + line-height:32px; + +.no-matches-message + padding: 20px; + color: rgba(0,0,0,0.5); + font-style: italic; + +.not-indexed-message + padding: 20px; + padding-bottom:0px; + color: rgba(0,0,0,0.5); + font-style: italic; + em + color: #2b303b; + p:last-child + margin-top:20px; + font-size: 15px; + color: rgba(0, 0, 0, 0.4); + a + color: rgba(0, 0, 0, 0.8); \ No newline at end of file diff --git a/static/styles_gen/style.css b/static/styles_gen/style.css index 9209b18d..2e383ac9 100644 --- a/static/styles_gen/style.css +++ b/static/styles_gen/style.css @@ -431,6 +431,16 @@ body.login div.alert { position: fixed; top: 0px; left: 0px; right: 0px; line-he .tt-selectable div:last-child { flex: 1 1 auto; line-height: 32px; } +.no-matches-message { padding: 20px; color: rgba(0, 0, 0, 0.5); font-style: italic; } + +.not-indexed-message { padding: 20px; padding-bottom: 0px; color: rgba(0, 0, 0, 0.5); font-style: italic; } + +.not-indexed-message em { color: #2b303b; } + +.not-indexed-message p:last-child { margin-top: 20px; font-size: 15px; color: rgba(0, 0, 0, 0.4); } + +.not-indexed-message p:last-child a { color: rgba(0, 0, 0, 0.8); } + .hidden { display: none; } :focus { outline: none; }