mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-16 06:24:12 +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.
|
// 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.
|
// This is because info alerts are used rather than modals in this case.
|
||||||
if (memberForm && editSelfWarningModal) {
|
if (memberForm && editSelfWarningModal) {
|
||||||
console.log("Test")
|
|
||||||
// Only show the warning modal when the user is changing their ROLE.
|
// Only show the warning modal when the user is changing their ROLE.
|
||||||
var canSubmit = document.querySelector(`input[name="role"]:checked`)?.value != "organization_member";
|
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"]`);
|
let radioButtons = document.querySelectorAll(`input[name="role"]`);
|
||||||
radioButtons.forEach(function (radioButton) {
|
radioButtons.forEach(function (radioButton) {
|
||||||
radioButton.addEventListener("change", function() {
|
radioButton.addEventListener("change", function() {
|
||||||
let selectedValue = radioButton.checked ? radioButton.value : null;
|
let selectedValue = radioButton.checked ? radioButton.value : null;
|
||||||
canSubmit = selectedValue != "organization_member";
|
canSubmit = selectedValue != "organization_member";
|
||||||
console.log("selected value")
|
|
||||||
console.log(selectedValue)
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ Organization member
|
||||||
</address>
|
</address>
|
||||||
|
|
||||||
{% if portfolio_permission %}
|
{% 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 usa-alert--info usa-alert--slim">
|
||||||
<div class="usa-alert__body">
|
<div class="usa-alert__body">
|
||||||
<p class="usa-alert__text ">
|
<p class="usa-alert__text ">
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
<h2 class="margin-top-0">Member access</h2>
|
<h2 class="margin-top-0">Member access</h2>
|
||||||
</legend>
|
</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 usa-alert--info usa-alert--slim margin-top-1 margin-bottom-1">
|
||||||
<div class="usa-alert__body">
|
<div class="usa-alert__body">
|
||||||
<p class="usa-alert__text ">
|
<p class="usa-alert__text ">
|
||||||
|
@ -124,21 +124,21 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</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 %}
|
{% if member and member.id == request.user.id and not is_only_admin %}
|
||||||
<a
|
<a
|
||||||
id="toggle-member-permissions-edit-self"
|
id="toggle-member-permissions-edit-self"
|
||||||
href="#modal-member-permissions-edit-self"
|
href="#modal-member-permissions-edit-self"
|
||||||
class="display-none"
|
class="display-none"
|
||||||
aria-controls="modal-member-permissions-edit-self"
|
aria-controls="modal-member-permissions-edit-self"
|
||||||
data-open-modal
|
data-open-modal
|
||||||
>Edit self</a>
|
>Edit self</a>
|
||||||
<div
|
<div
|
||||||
class="usa-modal"
|
class="usa-modal"
|
||||||
id="modal-member-permissions-edit-self"
|
id="modal-member-permissions-edit-self"
|
||||||
data-force-action
|
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" %}
|
{% 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>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock portfolio_content%}
|
{% endblock portfolio_content%}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue