Skip to content
Open
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9a755dd
wip
styrix560 Feb 2, 2026
b9bd11b
wip
styrix560 Feb 16, 2026
3278548
wip
styrix560 Feb 23, 2026
0313622
wip
styrix560 Mar 2, 2026
99afb55
wip
styrix560 Mar 2, 2026
b6c1b3c
Change contact modals to new variant
styrix560 Mar 2, 2026
a335c30
Remove console.log
styrix560 Mar 2, 2026
4b34bfe
Remove unused code
styrix560 Mar 2, 2026
6e86616
Add success message
styrix560 Mar 16, 2026
a7f0776
Add whitespace
styrix560 Mar 16, 2026
fa99ecf
Fix tests
styrix560 Mar 16, 2026
59f37a1
Fix whitespace
styrix560 Mar 16, 2026
fc80c3a
More whitespace
styrix560 Mar 16, 2026
6a39445
Add label and placeholder to contact modal textarea
styrix560 Mar 16, 2026
814ac35
Fix text in profile contact_modal
styrix560 Mar 16, 2026
75ba230
stuff :)
styrix560 Mar 16, 2026
bdb7014
whitespace
styrix560 Mar 16, 2026
90c7ef3
Add modals block back in
styrix560 Apr 13, 2026
fad45cd
Fix ids
styrix560 Apr 13, 2026
77c2d59
Fix ids
styrix560 Apr 13, 2026
1f86019
Remove custom JS from contact modal
styrix560 Apr 13, 2026
b760cdf
Fix button UI
styrix560 Apr 13, 2026
3c00f37
Add code review suggestions
styrix560 May 4, 2026
73027da
Change modal in test
styrix560 May 4, 2026
2cccadb
Update test
styrix560 May 4, 2026
65214e4
Remove unecessary input
styrix560 May 4, 2026
3c9b7e3
Add changes
styrix560 May 4, 2026
0c58c48
Remove comment
styrix560 May 4, 2026
be73c7b
Apply suggestions from code review
styrix560 Jun 8, 2026
34293fb
Make forms external to the confirmation-modal
styrix560 Jul 20, 2026
a36aa27
Fix formatting
styrix560 Jul 20, 2026
e067e66
Make contact-modal scroll when there is not enough space
styrix560 Jul 20, 2026
cafc548
Merge branch 'main' into 2129-update-contact-modal
styrix560 Jul 20, 2026
25dd3c6
Fix formatting
styrix560 Jul 20, 2026
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
26 changes: 8 additions & 18 deletions evap/contributor/templates/contributor_evaluation_form.html
Comment thread
styrix560 marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,17 @@ <h5 class="card-title">{% translate 'Course data' %}</h5>
<h5 class="card-title me-auto">{% translate 'Evaluation data' %}</h5>
{% if evaluation.allow_editors_to_edit %}
<div>
<button type="button" class="btn btn-sm btn-light mb-3 createAccountRequestModalShowButton">
{% translate 'Request creation of new account' %}
</button>
{% blocktranslate asvar title with evaluation_name=evaluation.full_name %}Request account creation for {{ evaluation_name }}{% endblocktranslate %}
{% translate 'Please tell us which new account we should create. We need the name and email for all new accounts.' as teaser %}
{% translate 'Request creation of new account' as show_button_text %}
{% include 'contact_modal.html' with modal_id='createParticipantAccountRequestModal' user=request.user title=title teaser=teaser show_button_text=show_button_text show_button_class="btn btn-sm btn-light mb-3" %}
</div>
{% else %}
<div>
<button type="button" class="btn btn-sm btn-light changeEvaluationRequestModalShowButton">
{% translate 'Request changes' %}
</button>
{% blocktranslate asvar title with evaluation_name=evaluation.full_name %}Request evaluation changes for {{ evaluation_name }}{% endblocktranslate %}
{% translate 'Please tell us what changes to the evaluation we should make.' as teaser %}
{% translate 'Request changes' as show_button_text %}
{% include 'contact_modal.html' with modal_id='changeEvaluationRequestModal' user=request.user title=title teaser=teaser show_button_text=show_button_text show_button_class="btn btn-sm btn-light" %}
</div>
{% endif %}
</div>
Expand Down Expand Up @@ -130,18 +132,6 @@ <h5 class="modal-title" id="previewModalLabel">{% translate 'Preview' %}</h5>
{% endif %}
{% endblock %}

{% block modals %}
{{ block.super }}

{% blocktranslate asvar title with evaluation_name=evaluation.full_name %}Request account creation for {{ evaluation_name }}{% endblocktranslate %}
{% translate 'Please tell us which new account we should create. We need the name and email for all new accounts.' as teaser %}
{% include 'contact_modal.html' with modal_id='createAccountRequestModal' user=request.user title=title teaser=teaser %}

{% blocktranslate asvar title with evaluation_name=evaluation.full_name %}Request evaluation changes for {{ evaluation_name }}{% endblocktranslate %}
{% translate 'Please tell us what changes to the evaluation we should make.' as teaser %}
{% include 'contact_modal.html' with modal_id='changeEvaluationRequestModal' user=request.user title=title teaser=teaser %}
{% endblock %}

{% block additional_javascript %}
{% include 'evap_evaluation_edit_js.html' %}

Expand Down
3 changes: 2 additions & 1 deletion evap/contributor/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,11 @@ def test_contact_modal_escape(self):
Regression test for #1060
"""
self.evaluation.name_en = "Adam & Eve"
self.evaluation.allow_editors_to_edit = False
self.evaluation.save()
page = self.app.get(self.url, user=self.responsible, status=200)

self.assertIn("changeEvaluationRequestModalLabel", page)
Comment thread
styrix560 marked this conversation as resolved.
self.assertIn("changeEvaluationRequestModalSubject", page)

self.assertNotIn("Adam &amp;amp; Eve", page)
self.assertIn("Adam &amp; Eve", page)
Expand Down
5 changes: 0 additions & 5 deletions evap/evaluation/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
{% include "custom_elements.html" %}

{% block modals %}
Comment thread
styrix560 marked this conversation as resolved.
{% if user.is_authenticated %}
{% translate 'Feedback' as title %}
{% translate 'You are welcome to submit feedback regarding the evaluation platform or specific evaluations. Please let us know how we can improve your experience on EvaP.' as teaser %}
{% include 'contact_modal.html' with modal_id='feedbackModal' user=request.user title=title teaser=teaser %}
{% endif %}
{% endblock %}

<div class="sticky-top d-print-none z-over-fixed">
Expand Down
77 changes: 28 additions & 49 deletions evap/evaluation/templates/contact_modal.html
Original file line number Diff line number Diff line change
@@ -1,55 +1,34 @@
{% load static %}

<div class="modal fade" id="successMessageModal_{{ modal_id }}" tabindex="-1" role="dialog" aria-labelledby="successMessageModalLabel_{{ modal_id }}" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="successMessageModalLabel_{{ modal_id }}">{% translate 'Message sent' %}</h5>
</div>
<div class="modal-body">
{% translate 'Your message was successfully sent.' %}
</div>
</div>
</div>
</div>
<form reload-on-success method="POST" action="{% url 'evaluation:contact' %}">
{% csrf_token %}

<div class="modal fade" id="{{ modal_id }}" tabindex="-1" role="dialog" aria-labelledby="{{ modal_id }}Label" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="{{ modal_id }}Label">{{ title }}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form id="{{ modal_id }}Form">
<div class="modal-body">
{{ teaser }}
<div class="modal-grid">
<label for="{{ modal_id }}SenderName" class="control-label my-auto pe-4">{% translate 'Sender' %}</label>
{% if modal_id == "feedbackModal" and allow_anonymous_feedback_messages %}
<div class="btn-group text-wrap" role="group" aria-label="{{ modal_id }} Radio Group">
<input type="radio" class="btn-check" name="{{ modal_id }}RadioGroup" id="{{ modal_id }}SenderName" checked>
<label class="btn btn-sm btn-outline-primary text-break" for="{{ modal_id }}SenderName">{{ user.full_name }}</label>
<input type="radio" class="btn-check" name="{{ modal_id }}RadioGroup" id="{{ modal_id }}AnonymousName">
<label class="btn btn-sm btn-outline-primary text-break" for="{{ modal_id }}AnonymousName">{% translate 'Anonymous' %}</label>
</div>
{% else %}
<input type="text" class="form-control mx-auto text-break" id="{{ modal_id }}SenderName" disabled value="{{ user.full_name }}"/>
{% endif %}
<label for="{{ modal_id }}Subject" class="control-label my-auto pe-4 text-break">{% translate 'Subject' %}</label>
<input type="text" class="form-control mx-auto" id="{{ modal_id }}Subject" disabled value="{{ title }}"/>
</div>
<textarea autofocus class="form-control modal-textfield my-4" id="{{ modal_id }}MessageText"></textarea>
<div class="modal-submit-group">
<button type="button" class="btn btn-light me-1" data-bs-dismiss="modal">{% translate 'Cancel' %}</button>
<button type="submit" id="{{ modal_id }}ActionButton" class="btn btn-primary ms-1">{% translate 'Send Message' %}</button>
<confirmation-modal type="submit">
Comment thread
styrix560 marked this conversation as resolved.
Outdated
<span slot="question">{{ teaser }}</span>
<span slot="action-text">{% translate 'Send Message' %}</span>

<div slot="extra-inputs">
<div class="modal-grid">
<label for="{{ modal_id }}SenderName" class="control-label my-auto pe-4">{% translate 'Sender' %}</label>
{% if modal_id == "feedbackModal" and allow_anonymous_feedback_messages %}
<div class="btn-group text-wrap" role="group" aria-label="{{ modal_id }} Radio Group">
<input type="radio" class="btn-check" name="anonymous" value="false" id="{{ modal_id }}SenderName" checked />
<label class="btn btn-sm btn-outline-primary text-break" for="{{ modal_id }}SenderName">{{ user.full_name }}</label>
<input type="radio" class="btn-check" name="anonymous" value="true" id="{{ modal_id }}AnonymousName"/>
Comment thread
styrix560 marked this conversation as resolved.
Outdated
<label class="btn btn-sm btn-outline-primary text-break" for="{{ modal_id }}AnonymousName">{% translate 'Anonymous' %}</label>
</div>
</div>
</form>
{% else %}
<input type="text" class="form-control mx-auto text-break" id="{{ modal_id }}SenderName" disabled value="{{ user.full_name }}"/>
{% endif %}
<label for="{{ modal_id }}Subject" class="control-label my-auto pe-4 text-break">{% translate 'Subject' %}</label>
<input name="title" type="text" class="form-control mx-auto" id="{{ modal_id }}Subject" disabled value="{{ title }}"/>
</div>
<label for="{{ modal_id }}MessageText" class="d-none">Nachricht</label>
Comment thread
styrix560 marked this conversation as resolved.
Outdated
Comment thread
styrix560 marked this conversation as resolved.
Outdated
<textarea autofocus class="form-control modal-textfield my-4" id="{{ modal_id }}MessageText" name="message" placeholder="{% translate 'Nachricht' %}"></textarea>
</div>
</div>
</div>
<script type="module">
import { ContactModalLogic } from "{% static 'js/contact_modal.js' %}";

new ContactModalLogic("{{ modal_id }}", "{{ title|escapejs }}").attach();
</script>
<div class="{% if modal_id == "feedbackModal" %}feedback-button{% endif %}" slot="show-button">
Comment thread
styrix560 marked this conversation as resolved.
Outdated
<button type="button" class="{{ show_button_class }}" id="{{ modal_id }}ShowButton">{{ show_button_text }}</button>
</div>
</confirmation-modal>
</form>
7 changes: 4 additions & 3 deletions evap/evaluation/templates/contribution_formset.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
<h5 class="card-title me-auto">{% translate 'Contributors' %}</h5>
{% if not manager %}
<div>
<button type="button" class="btn btn-sm btn-light" id="createAccountRequestModalShowButton">
{% translate 'Request creation of new account' %}
</button>
{% blocktranslate asvar title with evaluation_name=evaluation.full_name %}Request account creation for {{ evaluation_name }}{% endblocktranslate %}
Comment thread
styrix560 marked this conversation as resolved.
Outdated
{% translate 'Please tell us which new account we should create. We need the name and email for all new accounts.' as teaser %}
{% translate 'Request creation of new account' as show_button_text %}
{% include 'contact_modal.html' with modal_id='createContributorAccountRequestModal' user=request.user title=title teaser=teaser show_button_text=show_button_text show_button_class="btn btn-sm btn-light mb-3"%}
Comment thread
richardebeling marked this conversation as resolved.
Outdated
</div>
{% endif %}
</div>
Expand Down
9 changes: 4 additions & 5 deletions evap/evaluation/templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@
</div>
<div class="navbar-nav justify-content-end feedback-button-placeholder">
{% if user.is_authenticated %}
<span class="feedback-button">
<button id="feedbackModalShowButton" type="button" class="btn btn-dark">
{% translate 'Problems/Feedback' %}
</button>
</span>
{% translate 'Feedback' as title %}
{% translate 'You are welcome to submit feedback regarding the evaluation platform or specific evaluations. Please let us know how we can improve your experience on EvaP.' as teaser %}
{% translate "Problems/Feedback" as show_button_text %}
{% include 'contact_modal.html' with modal_id='feedbackModal' user=request.user title=title teaser=teaser show_button_text=show_button_text show_button_class="btn btn-dark" %}
{% endif %}
</div>
</div>
Expand Down
32 changes: 12 additions & 20 deletions evap/evaluation/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,19 @@ <h4 class="card-title mb-4">{% translate 'Delegates and emails' %}</h4>
</div>
{% endif %}
</div>
</form>

<div class="row row-cols-1 {% if user.is_editor %}row-cols-md-1{% else %}row-cols-md-2{% endif %} g-4">
<div class="col">
<div class="card card-submit-area card-submit-area-2 text-center">
<div class="card-body tab-row">
<button type="submit" class="btn btn-primary">
{% translate 'Save' %}
</button>
<button type="button" class="btn btn-light" id="changeRequestModalShowButton">
{% translate 'Request changes' %}
</button>
</div>
</div>
<div class="row row-cols-1 {% if user.is_editor %}row-cols-md-1{% else %}row-cols-md-2{% endif %} g-4">
<div class="card card-submit-area card-submit-area-2">
<div class="card-body tab-row d-flex justify-content-center">
<button type="submit" class="btn btn-primary">
{% translate 'Save' %}
</button>
{% translate 'Request user setting changes' as title %}
{% translate 'Please tell us which of your settings we should change.' as teaser %}
{% translate "Request changes" as show_button_text %}
{% include 'contact_modal.html' with modal_id='requestChangesModal' user=request.user title=title teaser=teaser show_button_text=show_button_text show_button_class="btn btn-light"%}
</div>
</div>
</form>
{% endblock %}

{% block modals %}
{{ block.super }}
{% translate 'Request user setting changes' as title %}
{% translate 'Please tell us which of your settings we should change.' as teaser %}
{% include 'contact_modal.html' with modal_id='changeRequestModal' user=request.user title=title teaser=teaser %}
</div>
{% endblock %}
9 changes: 5 additions & 4 deletions evap/evaluation/tests/test_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
class ContactModalTests(LiveServerTest):
def test_contact_modal(self) -> None:
self.selenium.get(self.reverse("evaluation:index"))
self.wait_until_document_ready()
self.selenium.find_element(By.ID, "feedbackModalShowButton").click()
Comment thread
styrix560 marked this conversation as resolved.
self.wait.until(visibility_of_element_located((By.ID, "feedbackModalMessageText")))
self.selenium.find_element(By.ID, "feedbackModalMessageText").send_keys("Test message")
self.selenium.find_element(By.ID, "feedbackModalActionButton").click()
text_area = self.wait.until(visibility_of_element_located((By.ID, "feedbackModalMessageText")))
text_area.send_keys("Test message")
self.selenium.find_element(By.CSS_SELECTOR, "confirmation-modal > span[slot='action-text']").click()

self.wait.until(
text_to_be_present_in_element(
(By.CSS_SELECTOR, "#successMessageModal_feedbackModal .modal-body"),
(By.CSS_SELECTOR, ".alert-success"),
"Your message was successfully sent.",
)
)
Expand Down
4 changes: 4 additions & 0 deletions evap/evaluation/tests/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,10 @@ def wait_until_page_reloads(self):
yield
self.wait.until(staleness_of(html_element))

# wait for all javascript to fully execute, so our click handlers are registered
def wait_until_document_ready(self):
self.wait.until(lambda driver: driver.execute_script("return document.readyState") == "complete")

@classmethod
def setUpClass(cls) -> None:
super().setUpClass()
Expand Down
1 change: 1 addition & 0 deletions evap/evaluation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def contact(request):
try:
mail.send()
logger.info("Sent contact email: \n%s\n", mail.message())
messages.success(request, _("Your message was successfully sent."))
return HttpResponse()
except Exception:
logger.exception("An exception occurred when sending the following contact email:\n%s\n", mail.message())
Expand Down
69 changes: 0 additions & 69 deletions evap/static/ts/src/contact_modal.ts

This file was deleted.

3 changes: 1 addition & 2 deletions evap/student/tests/test_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ def test_resolving_submit_errors_clears_warning(self) -> None:
with self.wait_until_page_reloads():
self.selenium.find_element(By.ID, "vote-submit-btn").click()

# wait for all javascript to fully execute, so our click handlers are registered
self.wait.until(lambda driver: driver.execute_script("return document.readyState") == "complete")
self.wait_until_document_ready()

row = self.selenium.find_element(By.CSS_SELECTOR, "#student-vote-form .row:has(.btn-check)")
error_marked = row.find_elements(By.CSS_SELECTOR, ".choice-error")
Expand Down