Skip to content
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
5 changes: 3 additions & 2 deletions electionpage/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

from common.testUtils import TestHelpers
from electionpage.models import ElectionPage, ScrapableElectionPage, SingleSourceElectionPage
Expand Down Expand Up @@ -195,8 +196,8 @@ def submit_with_num_elections_and_get_error(num, expectReload):
self.browser.find_element(By.ID, "submit").click()

if expectReload:
self._ensure_eventually_asserts(
lambda: EC.staleness_of(bodyElement))
# Wait for the navigation: the old page's body goes stale
WebDriverWait(self.browser, timeout=10).until(EC.staleness_of(bodyElement))

try:
return self.browser.find_element(
Expand Down
5 changes: 3 additions & 2 deletions static/datatable/src/datatable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,9 @@ export default class RcvisDataTable {
this.toJson(this.table.getData()));
}

// Prepare the mock form
const form = document.getElementsByTagName('form')[0];
// Prepare the mock form: the upload form by id, since the page has other
// forms too (e.g. the logout form in the header)
const form = document.getElementById('form');
const data = $(form).serializeArray();

// AJAX to check if it would survive all serverside processing
Expand Down
25 changes: 25 additions & 0 deletions static/visualizer/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,31 @@ h1, h2, h3, h4, h5, h6 {
color: var(--rcv-brand);
}

.nav-logout-form {
display: inline;
margin: 0;
}

.nav-logout-button {
padding: 0;
border: 0;
background: none;
font: inherit;
color: var(--rcv-brand);
cursor: pointer;
}

.nav-logout-button:hover {
color: var(--rcv-brand-deep);
text-decoration: underline;
}

.nav-logout-button:focus-visible {
outline: 2px solid var(--rcv-brand);
outline-offset: 2px;
border-radius: 3px;
}

/* ------------------------------------------------------------------ */
/* Visualization tab bar (the /v/ page puts its tabs in the header) */
/* ------------------------------------------------------------------ */
Expand Down
10 changes: 7 additions & 3 deletions templates/visualizer/uploadFile.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
{% endblock %}

{% block navlinks %}
<p class="nav-userinfo">
<div class="nav-userinfo">
Logged in as <strong>{{ user.username }}</strong>.
<br/>
<a href="{% url 'logout' %}">Log out</a>?
</p>
{# Django 5 only accepts POST for logout, so this is a form styled as a link #}
<form method="post" action="{% url 'logout' %}" class="nav-logout-form">
{% csrf_token %}
<button type="submit" class="nav-logout-button">Log out</button>?
</form>
</div>
{% endblock %}

{% block maincontent %}
Expand Down
Loading