Skip to content

Commit a4c9c6b

Browse files
linyihaiGuillaumeGomez
authored andcommitted
move sort-by select box to right top corner of search result
1 parent 0ffdfd0 commit a4c9c6b

File tree

5 files changed

+30
-15
lines changed

5 files changed

+30
-15
lines changed

templates/header/topbar_end.html

-13
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,6 @@
6767
<input id="nav-search" name="query" type="text" aria-label="Find crate by search query" tabindex="-1"
6868
placeholder="Find crate" {%- if search_query %} value="{{ search_query }}" {%- endif %}>
6969
</div>
70-
{# The sort by select-box #}
71-
<div id="search-select-nav">
72-
<label for="nav-sort">
73-
{{ "list" | fas }}
74-
</label>
75-
<select name="sort" id="nav-sort" aria-label="Find crate by the sort by select-box" tabindex="-1">
76-
<option value="relevance" {%- if search_sort_by and search_sort_by == "relevance" %} selected="selected" {%- endif %}>Relevance</option>
77-
<option value="downloads" {%- if search_sort_by and search_sort_by == "downloads" %} selected="selected" {%- endif %}>All-Time Downloads</option>
78-
<option value="recent-downloads" {%- if search_sort_by and search_sort_by == "recent-downloads" %} selected="selected" {%- endif %}>Recent Downloads</option>
79-
<option value="recent-updates" {%- if search_sort_by and search_sort_by == "recent-updates" %} selected="selected" {%- endif %}>Recent Updates</option>
80-
<option value="new" {%- if search_sort_by and search_sort_by == "new" %} selected="selected" {%- endif %}>Newly Added</option>
81-
</select>
82-
</div>
8370
</form>
8471
</div>
8572
</div>

templates/releases/releases.html

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
{%- block body -%}
2323
<div class="container">
2424
<div class="recent-releases-container">
25+
{%- block sort_by %}{% endblock sort_by -%}
2526
<ul>
2627
{# TODO: If there are no releases, then display a message that says so #}
2728
{%- for release in releases -%}

templates/releases/search_results.html

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
{%- extends "releases/releases.html" -%}
22

3+
{% block sort_by %}
4+
<div id="search-select-nav">
5+
<div class="item-end">
6+
<span>Sort by</span>
7+
<label for="nav-sort">
8+
{{ "list" | fas }}
9+
</label>
10+
<select form="nav-search-form" name="sort" id="nav-sort" aria-label="Find crate by the sort by select-box" tabindex="-1">
11+
<option value="relevance" {%- if search_sort_by and search_sort_by == "relevance" %} selected="selected" {%- endif %}>Relevance</option>
12+
<option value="downloads" {%- if search_sort_by and search_sort_by == "downloads" %} selected="selected" {%- endif %}>All-Time Downloads</option>
13+
<option value="recent-downloads" {%- if search_sort_by and search_sort_by == "recent-downloads" %} selected="selected" {%- endif %}>Recent Downloads</option>
14+
<option value="recent-updates" {%- if search_sort_by and search_sort_by == "recent-updates" %} selected="selected" {%- endif %}>Recent Updates</option>
15+
<option value="new" {%- if search_sort_by and search_sort_by == "new" %} selected="selected" {%- endif %}>Newly Added</option>
16+
</select>
17+
</div>
18+
</div>
19+
{% endblock sort_by %}
20+
321
{% block pagination %}
422
{%- if previous_page_link -%}
523
<a class="pure-button pure-button-normal" href="{{ previous_page_link|safe }}">

templates/style/_navbar.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ div.nav-container {
9999
display: flex;
100100
flex-direction: row;
101101

102-
#search-input-nav, #search-select-nav {
102+
#search-input-nav {
103103
max-width: 150px;
104104
display: none;
105105
border-left: 1px solid var(--color-border);
@@ -130,7 +130,7 @@ div.nav-container {
130130
}
131131
}
132132

133-
input.search-input-nav:focus, select.search-select-nav:focus {
133+
input.search-input-nav:focus {
134134
outline: unset;
135135
}
136136

templates/style/style.scss

+9
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,15 @@ div.landing {
241241
}
242242
}
243243

244+
#search-select-nav {
245+
display: flex;
246+
flex-direction: column;
247+
248+
.item-end {
249+
align-self: flex-end
250+
}
251+
}
252+
244253
div.recent-releases-container {
245254
text-align: left;
246255
padding-bottom: 50px;

0 commit comments

Comments
 (0)