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

Add title blocks. #6738

Merged
merged 1 commit into from
Feb 23, 2023
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('Change Secret') }}{% endblock %}

{% block body %}
<h1>{{ gettext('Change Secret') }}</h1>
<form method="post">
Expand Down
3 changes: 3 additions & 0 deletions securedrop/journalist_templates/account_new_two_factor.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('Enable FreeOTP') }}{% endblock %}

{% block body %}
{% if user.is_totp %}
<h1>{{ gettext('Enable FreeOTP') }}</h1>
Expand Down
3 changes: 3 additions & 0 deletions securedrop/journalist_templates/admin.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('Admin Interface') }}{% endblock %}

{% block body %}
<h1>{{ gettext('Admin Interface') }}</h1>

Expand Down
3 changes: 3 additions & 0 deletions securedrop/journalist_templates/admin_add_user.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('Add User') }}{% endblock %}

{% block body %}
<nav class="back" aria-labelledby="back-link">
<a id="back-link" href="/admin">{{ gettext('Back to admin interface') }}</a>
Expand Down
3 changes: 3 additions & 0 deletions securedrop/journalist_templates/admin_edit_hotp_secret.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('Change HOTP Secret')}}{% endblock %}

{% block body %}
<h1>{{ gettext('Change HOTP Secret')}}</h1>
<p>{{ gettext("Enter a new HOTP secret formatted as a 40-digit hexadecimal string. Spaces will be ignored:") }}</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('Enable FreeOTP') }}{% endblock %}

{% block body %}
{% if user.is_totp %}
<h1>{{ gettext('Enable FreeOTP') }}</h1>
Expand Down
2 changes: 1 addition & 1 deletion securedrop/journalist_templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ g.organization_name }}</title>
<title>{% block tab_title required %}{% endblock %} | {{ g.organization_name }}</title>

<link rel="stylesheet" href="/static/css/journalist.css">

Expand Down
3 changes: 3 additions & 0 deletions securedrop/journalist_templates/col.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ source.journalist_designation }}{% endblock %}

{% block body %}
<div id="content" class="journalist-view-single">

Expand Down
3 changes: 3 additions & 0 deletions securedrop/journalist_templates/config.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('Instance Configuration') }}{% endblock %}

{% block body %}
<nav class="back" aria-labelledby="back-link">
<a id="back-link" href="/admin">{{ gettext('Back to admin interface') }}</a>
Expand Down
9 changes: 9 additions & 0 deletions securedrop/journalist_templates/edit_account.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{% extends "base.html" %}

{% block tab_title %}
{% if user %}
{{ gettext('Edit user "{user}"').format(user=user.username) }}
{% else %}
{{ gettext('Edit your account') }}
{% endif %}
{% endblock %}

{% block body %}

{% if user %}
Expand Down
3 changes: 3 additions & 0 deletions securedrop/journalist_templates/error.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ error.name }}{% endblock %}

{% block body %}
<h1>{{ error.code }}: {{ error.name }}</h1>
{% if error.description %}
Expand Down
3 changes: 3 additions & 0 deletions securedrop/journalist_templates/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('All Sources') }}{% endblock %}

{% block body %}
<div id="content" class="journalist-view-all">
<h1 id="all-sources-heading" class="headline">{{ gettext('All Sources') }}</h1>
Expand Down
3 changes: 3 additions & 0 deletions securedrop/journalist_templates/login.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('Login to access the journalist interface') }}{% endblock %}

{% block body %}

<h1>{{ gettext('Login to access the journalist interface') }}</h1>
Expand Down
4 changes: 2 additions & 2 deletions securedrop/source_templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex,nofollow">
{% if g.organization_name == "SecureDrop" %}
<title>{{ g.organization_name }} | {{ gettext('Protecting Journalists and Sources') }}</title>
<title>{% block tab_title required %}{% endblock %} | {{ g.organization_name }} | {{ gettext('Protecting Journalists and Sources') }}</title>
{% else %}
<title>{{ g.organization_name }} | {{ gettext('SecureDrop') }}</title>
<title>{{ self.tab_title() }} | {{ g.organization_name }} | {{ gettext('SecureDrop') }}</title>
{% endif %}

<link rel="stylesheet" href="/static/css/source.css">
Expand Down
3 changes: 3 additions & 0 deletions securedrop/source_templates/error.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('Server error') }}{% endblock %}

{% block body %}
<h2>{{ gettext('Server error') }}</h2>

Expand Down
3 changes: 3 additions & 0 deletions securedrop/source_templates/generate.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('Get Your Codename') }}{% endblock %}

{% import 'utils.html' as utils %}

{% block body %}
Expand Down
4 changes: 2 additions & 2 deletions securedrop/source_templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

<head>
{% if g.organization_name == "SecureDrop" %}
<title>{{ g.organization_name }} | {{ gettext('Protecting Journalists and Sources') }}</title>
<title>{{ gettext('Welcome') }} | {{ g.organization_name }} | {{ gettext('Protecting Journalists and Sources') }}</title>
{% else %}
<title>{{ g.organization_name }} | {{ gettext('SecureDrop') }}</title>
<title>{{ gettext('Welcome') }} | {{ g.organization_name }} | {{ gettext('SecureDrop') }}</title>
{% endif %}

<link rel="stylesheet" href="/static/css/source.css">
Expand Down
3 changes: 3 additions & 0 deletions securedrop/source_templates/login.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('Login') }}{% endblock %}

{% block body %}

{% include 'flashed.html' %}
Expand Down
3 changes: 3 additions & 0 deletions securedrop/source_templates/logout.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('Additional Action Required') }}{% endblock %}

{% block body %}
<nav>
<a href="{{ url_for('main.login') }}" class="btn" aria-label="{{ gettext('Log In') }}">
Expand Down
8 changes: 8 additions & 0 deletions securedrop/source_templates/lookup.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{% extends "base.html" %}
{% import 'utils.html' as utils %}

{% block tab_title %}
{% if allow_document_uploads %}
{{ gettext('Submit Files or Messages') }}
{% else %}
{{ gettext('Submit Messages') }}
{% endif %}
{% endblock %}

{% block body %}
{% include 'flashed.html' %}

Expand Down
3 changes: 3 additions & 0 deletions securedrop/source_templates/notfound.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('Page not found') }}{% endblock %}

{% block body %}
<h2>{{ gettext('Page not found') }}</h2>

Expand Down
3 changes: 3 additions & 0 deletions securedrop/source_templates/tor2web-warning.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('WARNING: Proxy Service Detected') }}{% endblock %}

{% block body %}
<h2>{{ gettext('Proxy Service Detected') }}</h2>
<div class="center">
Expand Down
3 changes: 3 additions & 0 deletions securedrop/source_templates/use-tor-browser.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext('You Should Use Tor Browser') }}{% endblock %}

{% block body %}
<h2>{{ gettext('You Should Use Tor Browser') }}</h2>
<p>{{ gettext('If you are not using Tor Browser, you <strong>may not be anonymous</strong>.') }}</p>
Expand Down
3 changes: 3 additions & 0 deletions securedrop/source_templates/why-public-key.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "base.html" %}

{% block tab_title %}{{ gettext("Why download the team's public key?") }}{% endblock %}

{% block body %}
<h2>{{ gettext("Why download the team's public key?") }}</h2>
<p>{{ gettext("SecureDrop encrypts files and messages after they are submitted. Encrypting messages and files before submission can provide an extra layer of security before your data reaches the SecureDrop server.") }}
Expand Down
4 changes: 2 additions & 2 deletions securedrop/tests/functional/test_admin_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,15 @@ def test_orgname_is_changed(
journ_app_nav.admin_visits_system_config_page()

# When they update the organization's name
assert "SecureDrop" == journ_app_nav.driver.title
assert "SecureDrop" in journ_app_nav.driver.title
journ_app_nav.driver.find_element_by_id("organization_name").clear()
new_org_name = "Walden Inquirer"
journ_app_nav.nav_helper.safe_send_keys_by_id("organization_name", new_org_name)
journ_app_nav.nav_helper.safe_click_by_id("submit-update-org-name")
self._admin_submits_instance_settings_form(journ_app_nav)

# Then it succeeds
assert new_org_name == journ_app_nav.driver.title
assert new_org_name in journ_app_nav.driver.title

# And then, when a source user logs into the source app
source_app_nav = SourceAppNavigator(
Expand Down
5 changes: 4 additions & 1 deletion securedrop/tests/test_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ def verify_i18n(app):
assert 'hreflang="fr-FR"' in locales

c.get("/?l=ar")
base = render_template("base.html")
# We have to render a template that inherits from "base.html" so that "tab_title" will be
# set. But we're just checking that when a page is rendered in an RTL language the
# directionality is correct, so it doesn't matter which template we render.
base = render_template("error.html", error={})
skyvine marked this conversation as resolved.
Show resolved Hide resolved
assert 'dir="rtl"' in base


Expand Down