Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
41 changes: 19 additions & 22 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 @@ -69,15 +69,19 @@ <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 form_id="create-participant-account-form" modal_id='createParticipantAccountRequestModal' form_id='create-participant-account-form' 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 form_id="change-evaluation-form" modal_id='changeEvaluationRequestModal' form_id='change-evaluation-form' 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 @@ -150,22 +154,15 @@ <h5 class="modal-title" id="previewModalLabel">{% translate 'Preview' %}</h5>
</div>
</div>
{% endif %}
{% endblock %}

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

{% blocktranslate trimmed 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 trimmed 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 %}
<form reload-on-success id="create-contributor-account-form" method="POST" action="{% url 'evaluation:contact' %}">
{% csrf_token %}
</form>
<form reload-on-success id="create-participant-account-form" method="POST" action="{% url 'evaluation:contact' %}">
{% csrf_token %}
</form>
<form reload-on-success id="change-evaluation-form" method="POST" action="{% url 'evaluation:contact' %}">
{% csrf_token %}
</form>
{% endblock %}

{% block additional_javascript %}
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 @@ -29,11 +29,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
179 changes: 74 additions & 105 deletions evap/evaluation/templates/contact_modal.html
Original file line number Diff line number Diff line change
@@ -1,112 +1,81 @@
{% 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>
<confirmation-modal type="submit" form="{{ form_id }}" dialog-extra-class="overflow-scroll">
<span slot="title">{{ title }}</span>
<span slot="question">{{ teaser }}</span>
<span slot="action-text">{% translate 'Send Message' %}</span>

<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>
</div>
<div slot="extra-inputs">
<div class="modal-grid">
<label for="{{ modal_id }}SenderName" class="control-label my-auto pe-4">{% translate 'Sender' %}</label>
{% if anonymous_mode_enabled %}
<div class="btn-group text-wrap" role="group" aria-label="{{ modal_id }} Radio Group">
<input
type="radio"
class="btn-check"
form="{{ form_id }}"
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"
form="{{ form_id }}"
name="anonymous"
value="true"
id="{{ modal_id }}AnonymousName"
/>
<label
class="btn btn-sm btn-outline-primary text-break"
for="{{ modal_id }}AnonymousName"
>{% translate 'Anonymous' %}</label>
</div>
</form>
{% else %}
<input
type="text"
class="form-control mx-auto text-break"
form="{{ form_id }}"
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"
form="{{ form_id }}"
id="{{ modal_id }}Subject"
disabled
value="{{ title }}"
size="70"
/>
</div>
<label for="{{ modal_id }}MessageText" class="d-none">{% translate 'Message' %}</label>
<textarea
autofocus
required
class="form-control modal-textfield my-4"
form="{{ form_id }}"
id="{{ modal_id }}MessageText"
name="message"
placeholder="{% translate 'Message' %}"
></textarea>
</div>
</div>
<script type="module">
import { ContactModalLogic } from "{% static 'js/contact_modal.js' %}";

new ContactModalLogic("{{ modal_id }}", "{{ title|escapejs }}").attach();
</script>
<div slot="show-button">
<button type="button" class="{{ show_button_class }}" id="{{ modal_id }}ShowButton">
{{ show_button_text }}
</button>
</div>
</confirmation-modal>
8 changes: 5 additions & 3 deletions evap/evaluation/templates/contribution_formset.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
<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 %}
{% 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 form_id='create-contributor-account-form' 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" %}
</div>
{% endif %}
</div>
Expand Down
12 changes: 7 additions & 5 deletions evap/evaluation/templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@
</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>
<form reload-on-success method="POST" id="feedback-form" action="{% url 'evaluation:contact' %}">
{% csrf_token %}
</form>
{% 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 form_id="feedback-form" modal_id='feedbackModal' user=request.user title=title teaser=teaser show_button_text=show_button_text show_button_class="btn btn-dark" anonymous_mode_enabled=allow_anonymous_feedback_messages %}
{% endif %}
</div>
</div>
Expand Down
35 changes: 15 additions & 20 deletions evap/evaluation/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,22 @@ <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>
<form reload-on-success method="POST" id="request-changes-form" action="{% url 'evaluation:contact' %}">
{% csrf_token %}
</form>
{% 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 form_id="request-changes-form" 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 @@ -186,6 +186,7 @@ def contact(request: HttpRequest) -> HttpResponse:
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
Loading