-
Notifications
You must be signed in to change notification settings - Fork 167
Update contact modal #2657
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
base: main
Are you sure you want to change the base?
Update contact modal #2657
Changes from all commits
9345a4c
56b7fcd
316d9df
4ea8c78
7853fa8
e04c54e
2ec8bd9
481cec5
76e3aac
5c267b2
93d7c3c
507fa15
24d97fe
b4632f2
013b600
49c3235
4f21711
6ab887d
6287dd9
6a8d1b4
b945b30
01e7afd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -246,7 +246,7 @@ def test_contact_modal_escape(self): | |
| self.evaluation.save() | ||
| page = self.app.get(self.url, user=self.responsible, status=200) | ||
|
|
||
| self.assertIn("changeEvaluationRequestModalLabel", page) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before, this was the code
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but the "change evaluation" part changed too, I think this is the more interesting change
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I know why this is happening and the reason is a bit hilarious. Our test was (kinda) supposed to fail always. Before, we included the modals unconditionally and only showed the show-buttons conditionally. Now, we also show modals conditionally. Where before both modals lay in the DOM, now only the |
||
| self.assertIn("createContributorAccountRequestModalTitle", page) | ||
|
|
||
| self.assertNotIn("Adam & Eve", page) | ||
| self.assertIn("Adam & Eve", page) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,36 @@ | ||
| {% 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 id="contact-modal-form-{{ modal_id }}" method="POST" action="{% url 'evaluation:contact' %}"> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this ID is now unused -- can we remove it?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it is required for the test
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does not use |
||
| {% csrf_token %} | ||
| <input hidden name="title" value="{{ title }}"/> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before, we passed the title to a hidden input with
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before, we had custom logic to fire the http request, that passed the title value with key 'title' as body parameters. Because we now use html forms for this,
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But then let's just use one input instead of having two of them? I'd propose to remove this one here and juts add |
||
|
|
||
| <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"> | ||
| <span slot="title" id="{{ modal_id }}Title">{{ title }}</span> | ||
| <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"/> | ||
| <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 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> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. German text here and below, should be |
||
| <textarea autofocus class="form-control modal-textfield my-4" id="{{ modal_id }}MessageText" name="message" placeholder="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"> | ||
| <button type="button" class="{{ show_button_class }}" id="{{ modal_id }}ShowButton">{{ show_button_text }}</button> | ||
| </div> | ||
| </confirmation-modal> | ||
| </form> | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.