mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 12:08:40 +02:00
Remove field
This commit is contained in:
parent
305bad2575
commit
9da96b06c7
4 changed files with 25 additions and 37 deletions
|
@ -1485,7 +1485,6 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
"status",
|
||||
"rejection_reason",
|
||||
"action_needed_reason",
|
||||
"action_needed_reason_email",
|
||||
"investigator",
|
||||
"creator",
|
||||
"submitter",
|
||||
|
|
|
@ -546,25 +546,17 @@ function initializeWidgetOnList(list, parentId) {
|
|||
(function () {
|
||||
let statusDropdown = document.getElementById("id_status");
|
||||
let actionNeededReasonDropdown = document.getElementById("id_action_needed_reason");
|
||||
let actionNeededEmail = document.getElementById("id_action_needed_reason_email")
|
||||
let reasonFormRow = actionNeededEmail.closest(".form-row");
|
||||
|
||||
if(actionNeededReasonDropdown && actionNeededEmail && reasonFormRow) {
|
||||
statusDropdown.addEventListener('change', function() {
|
||||
if (statusDropdown.value != "action needed") {
|
||||
// Hide the email field by default
|
||||
hideElement(reasonFormRow)
|
||||
}else {
|
||||
showElement(reasonFormRow)
|
||||
}
|
||||
});
|
||||
// If you need to account for the non-readonly version as well, you will need to check
|
||||
// for both of these things seperately.
|
||||
let actionNeededEmail = document.querySelector("#action_needed_reason_email_view_more")
|
||||
|
||||
if(actionNeededReasonDropdown && actionNeededEmail) {
|
||||
if (statusDropdown.value == "action needed")
|
||||
handleChangeActionNeededEmail(actionNeededReasonDropdown, actionNeededEmail, reasonFormRow);
|
||||
handleChangeActionNeededEmail(actionNeededReasonDropdown, actionNeededEmail);
|
||||
}
|
||||
|
||||
// TODO fix edge case where nothing is selected
|
||||
function handleChangeActionNeededEmail(actionNeededReasonDropdown, actionNeededEmail, reasonFormRow) {
|
||||
function handleChangeActionNeededEmail(actionNeededReasonDropdown, actionNeededEmail) {
|
||||
actionNeededReasonDropdown.addEventListener('change', function() {
|
||||
// TODO on change if not actionneeded on status, hide show email button
|
||||
const pk = document.querySelector("#domain_request_id").value
|
||||
|
@ -603,8 +595,6 @@ function initializeWidgetOnList(list, parentId) {
|
|||
// Show the message
|
||||
showElement(noEmailMessage);
|
||||
}
|
||||
|
||||
showElement(reasonFormRow)
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -786,3 +786,12 @@ div.dja__model-description{
|
|||
.usa-button--dja-link-color {
|
||||
color: var(--link-fg);
|
||||
}
|
||||
|
||||
// If the dja textarea is set as readonly, display this on hover
|
||||
textarea.vLargeTextField[readonly]:hover {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.max-full {
|
||||
width: 100% !important;
|
||||
}
|
|
@ -105,34 +105,24 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if original_object.action_needed_reason_email %}
|
||||
<div class="dja-textarea-container padding-1 margin-top-2">
|
||||
<label class="max-full" for="action_needed_reason_email_view_more">Action needed reason email</label>
|
||||
<textarea id="action_needed_reason_email_view_more" cols="40" rows="20" class="vLargeTextField {% if original_object.status != "action needed" %} display-none {% endif %}" readonly>
|
||||
{{ original_object.action_needed_reason_email }}
|
||||
</textarea>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
<button type="button" class="collapse-toggle--dgsimple usa-button usa-button--unstyled margin-top-2 margin-bottom-1 margin-left-1">
|
||||
<span>Show details</span>
|
||||
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
||||
<use xlink:href="/public/img/sprite.svg#expand_more"></use>
|
||||
</svg>
|
||||
</button>
|
||||
{% comment %}
|
||||
<div class="usa-button-group">
|
||||
<li class="usa-button-group__item">
|
||||
<button type="button" class="collapse-toggle--dgsimple usa-button usa-button--unstyled margin-top-2 margin-bottom-1 margin-left-1">
|
||||
<span>Show details</span>
|
||||
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
||||
<use xlink:href="/public/img/sprite.svg#expand_more"></use>
|
||||
</svg>
|
||||
</button>
|
||||
</li>
|
||||
<li class="usa-button-group__item">
|
||||
<button id="show_action_needed_email" domain-request-id="{{original_object.id}}" type="button" class="{% if field.field.value != "action needed" %}display-none{% endif %} collapse-toggle--dgsimple usa-button usa-button--unstyled margin-top-2 margin-bottom-1 margin-left-1">
|
||||
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
||||
<use xlink:href="/public/img/sprite.svg#mail"></use>
|
||||
</svg>
|
||||
<span>Show email</span>
|
||||
</button>
|
||||
</li>
|
||||
</div>
|
||||
{% endcomment %}
|
||||
</div>
|
||||
</div>
|
||||
{% elif field.field.name == "creator" %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue