Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

Commit 1bbaf15

Browse files
committed
Added search to navbar
1 parent 4621c42 commit 1bbaf15

File tree

5 files changed

+44
-2
lines changed

5 files changed

+44
-2
lines changed

app/public/css/main.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/public/js/main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/views/templates/normal.jade

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ block body
1515
| SpringRoll Connect
1616
small.version.hidden-xs v#{version}
1717
.navbar-collapse.collapse
18+
if user && user.privilege >= privilege.editor
19+
form.navbar-form.search.hidden-sm.hidden-xs
20+
.input-group
21+
.input-group-addon
22+
span.glyphicon.glyphicon-search
23+
input.form-control#allGameSearch(
24+
type="text"
25+
placeholder="Search for games"
26+
data-search="/games/search"
27+
data-list="#allGameSearchDisplay"
28+
data-field="title"
29+
autofocus
30+
tabIndex=1
31+
autocomplete="off")
32+
.dropdown.search#allGameSearchDisplay
33+
ul.dropdown-menu
1834
ul.nav.navbar-nav.navbar-right
1935
if user
2036
if user.privilege >= privilege.editor

src/main.less

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,22 @@ h2, h3, h4 {
4545
}
4646
}
4747

48+
form.search {
49+
float:right;
50+
display:inline-block;
51+
padding-right:0;
52+
.search-item {
53+
color: #337ab7 !important;
54+
&:hover {
55+
color:#23527c !important;
56+
text-decoration: underline;
57+
}
58+
}
59+
.active .search-item {
60+
color:#fff !important;
61+
}
62+
}
63+
4864
.navbar-brand {
4965
.version {
5066
background: #333;

src/widgets/search-games-all.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(function()
2+
{
3+
// User searching add result
4+
var games = $("#games");
5+
var gameTemplate = $("#gameTemplate").html();
6+
$("#allGameSearch").on('search', function(e, game)
7+
{
8+
location.href = "/games/game/" + game.slug;
9+
});
10+
}());

0 commit comments

Comments
 (0)