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

More template cleanup and template fix #2604

Merged
merged 2 commits into from
Sep 16, 2024
Merged
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
1 change: 0 additions & 1 deletion templates/core/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
{%- endblock body_classes -%}

{%- block topbar -%}
{% set search_query = Some(String::new()) %}
{%- include "header/topbar.html" -%}
{%- endblock topbar -%}

Expand Down
1 change: 0 additions & 1 deletion templates/error.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ <h1 id="crate-title">{{ title }}</h1>
{%- endblock header -%}

{%- block topbar -%}
{% set search_query = Some(String::new()) %}
{%- include "header/topbar.html" -%}
{%- endblock topbar -%}
9 changes: 8 additions & 1 deletion templates/header/topbar_end.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@
{# If there is a search query, put it in the search bar #}
{# The tabindex="-1" is used to prevent it to be the first input focused on the page when using the browser shortcut #}
<input id="nav-search" name="query" type="text" aria-label="Find crate by search query" tabindex="-1"
placeholder="Find crate" {%- if let Some(query) = search_query %}{% if !query.is_empty() %} value="{{ query }}" {%- endif %}{% endif %}>
placeholder="Find crate"
{% if search_query is defined %}
{%- if let Some(query) = search_query %}
{%- if !query.is_empty() +%}
value="{{ query }}"
{%- endif %}
{%- endif %}
{%- endif %}>
</div>
</form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/releases/feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</updated>

{%- for release in recent_releases -%}
{% set link = String::new() %}
{%- set link -%}
{%- if release.rustdoc_status && release.target_name.is_some() -%}
{%- set link = "/{}/{}/{}/"|format(release.name, release.version, release.target_name.as_ref().unwrap()) -%}
{%- else -%}
Expand Down
1 change: 0 additions & 1 deletion templates/releases/releases.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
{%- endblock header -%}

{%- block topbar -%}
{% set search_query = Some(String::new()) %}
{%- include "header/topbar.html" -%}
{%- endblock topbar -%}

Expand Down
1 change: 0 additions & 1 deletion templates/rustdoc/topbar.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{# The url of the current release, `/crate/:name/:version` #}
{%- import "macros.html" as macros -%}

{% set search_query = Some(String::new()) %}
{%- include "header/topbar_begin.html" -%}
{%- set crate_url = "/crate/{}/{}"|format(metadata.name, metadata.req_version) -%}
{%- set rest_menu_url -%}
Expand Down
Loading