mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-04 08:52:16 +02:00
Fix bug with info dialog appearing on the wrong page
This commit is contained in:
parent
58af877ca1
commit
7e8aad82f0
3 changed files with 17 additions and 22 deletions
|
@ -216,18 +216,13 @@ export function initPortfolioMemberPage() {
|
|||
// NOTE: This logic does not trigger when the user is the ONLY admin in the portfolio.
|
||||
// This is because info alerts are used rather than modals in this case.
|
||||
if (memberForm && editSelfWarningModal) {
|
||||
console.log("Test")
|
||||
// Only show the warning modal when the user is changing their ROLE.
|
||||
var canSubmit = document.querySelector(`input[name="role"]:checked`)?.value != "organization_member";
|
||||
console.log("can submit")
|
||||
console.log(canSubmit)
|
||||
let radioButtons = document.querySelectorAll(`input[name="role"]`);
|
||||
radioButtons.forEach(function (radioButton) {
|
||||
radioButton.addEventListener("change", function() {
|
||||
let selectedValue = radioButton.checked ? radioButton.value : null;
|
||||
canSubmit = selectedValue != "organization_member";
|
||||
console.log("selected value")
|
||||
console.log(selectedValue)
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ Organization member
|
|||
</address>
|
||||
|
||||
{% if portfolio_permission %}
|
||||
{% if is_only_admin %}
|
||||
{% if member and member.id == request.user.id and is_only_admin %}
|
||||
<div class="usa-alert usa-alert--info usa-alert--slim">
|
||||
<div class="usa-alert__body">
|
||||
<p class="usa-alert__text ">
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
<h2 class="margin-top-0">Member access</h2>
|
||||
</legend>
|
||||
|
||||
{% if is_only_admin %}
|
||||
{% if member and member.id == request.user.id and is_only_admin %}
|
||||
<div class="usa-alert usa-alert--info usa-alert--slim margin-top-1 margin-bottom-1">
|
||||
<div class="usa-alert__body">
|
||||
<p class="usa-alert__text ">
|
||||
|
@ -124,21 +124,21 @@
|
|||
</form>
|
||||
</div>
|
||||
|
||||
{% comment %} If an admin is trying to edit themselves, show a modal {% endcomment %}
|
||||
{% comment %} If an admin is trying to edit themselves, show a modal {% endcomment %}
|
||||
{% if member and member.id == request.user.id and not is_only_admin %}
|
||||
<a
|
||||
id="toggle-member-permissions-edit-self"
|
||||
href="#modal-member-permissions-edit-self"
|
||||
class="display-none"
|
||||
aria-controls="modal-member-permissions-edit-self"
|
||||
data-open-modal
|
||||
>Edit self</a>
|
||||
<div
|
||||
class="usa-modal"
|
||||
id="modal-member-permissions-edit-self"
|
||||
data-force-action
|
||||
>
|
||||
{% include 'includes/modal.html' with modal_heading="Are you sure you want to change your member access?" modal_description="You’ve selected basic access, which means you’ll no longer have the ability to manage user permissions. This action cannot be undone." modal_button_id="member-permissions-edit-self" modal_button_text="Yes, change my access" %}
|
||||
</div>
|
||||
<a
|
||||
id="toggle-member-permissions-edit-self"
|
||||
href="#modal-member-permissions-edit-self"
|
||||
class="display-none"
|
||||
aria-controls="modal-member-permissions-edit-self"
|
||||
data-open-modal
|
||||
>Edit self</a>
|
||||
<div
|
||||
class="usa-modal"
|
||||
id="modal-member-permissions-edit-self"
|
||||
data-force-action
|
||||
>
|
||||
{% include 'includes/modal.html' with modal_heading="Are you sure you want to change your member access?" modal_description="You’ve selected basic access, which means you’ll no longer have the ability to manage user permissions. This action cannot be undone." modal_button_id="member-permissions-edit-self" modal_button_text="Yes, change my access" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock portfolio_content%}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue