mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-22 18:56:15 +02:00
Remove success dialog
This commit is contained in:
parent
95f9860bd9
commit
d9b70cf044
5 changed files with 51 additions and 188 deletions
|
@ -162,50 +162,14 @@ function openInNewTab(el, removeAttribute = false){
|
||||||
// Append the new icon reference
|
// Append the new icon reference
|
||||||
buttonIcon.setAttribute('xlink:href', baseHref + '#check');
|
buttonIcon.setAttribute('xlink:href', baseHref + '#check');
|
||||||
|
|
||||||
// Find the nearest .admin-icon-group__success-dialog and update its classes
|
// Change the button text
|
||||||
let parentFlexContainer = null
|
nearestSpan = button.querySelector("span")
|
||||||
let brElement = null
|
nearestSpan.innerText = "Copied to clipboard"
|
||||||
let successDialog = null
|
|
||||||
if (userId) {
|
|
||||||
successDialog = document.querySelector(`#email-clipboard__success-dialog-${userId}`);
|
|
||||||
}else {
|
|
||||||
successDialog = document.querySelector("#email-clipboard__success-dialog");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (successDialog) {
|
|
||||||
if (!userId) {
|
|
||||||
parentFlexContainer = successDialog.closest('.flex-container');
|
|
||||||
// Flex container overrides display-none
|
|
||||||
parentFlexContainer.classList.remove('dja-important__display-none');
|
|
||||||
}
|
|
||||||
successDialog.classList.remove('display-none');
|
|
||||||
// Find the associated BR if it exists
|
|
||||||
brElement = successDialog.nextElementSibling
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the element directly below the success dialog is a br, hide it.
|
|
||||||
// This is for dynamic styling reasons
|
|
||||||
if (brElement && brElement.tagName === 'BR' && brElement.classList.contains('admin-icon-group__br')) {
|
|
||||||
brElement.classList.add('display-none');
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
// Change back to the copy icon
|
// Change back to the copy icon
|
||||||
buttonIcon.setAttribute('xlink:href', currentHref);
|
buttonIcon.setAttribute('xlink:href', currentHref);
|
||||||
|
nearestSpan.innerText = "Copy"
|
||||||
// Hide the success dialog
|
|
||||||
if (successDialog){
|
|
||||||
successDialog.classList.add("display-none");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show the regular br
|
|
||||||
if (brElement) {
|
|
||||||
brElement.classList.remove("display-none");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parentFlexContainer) {
|
|
||||||
parentFlexContainer.classList.add("dja-important__display-none");
|
|
||||||
}
|
|
||||||
}, 1500);
|
}, 1500);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -540,15 +540,9 @@ address.dja-address-contact-list {
|
||||||
// Make the clipboard button "float" inside of the input box
|
// Make the clipboard button "float" inside of the input box
|
||||||
.admin-icon-group {
|
.admin-icon-group {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: inline;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.usa-button__icon {
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
input {
|
||||||
// Allow for padding around the copy button
|
// Allow for padding around the copy button
|
||||||
padding-right: 35px !important;
|
padding-right: 35px !important;
|
||||||
|
@ -557,7 +551,21 @@ address.dja-address-contact-list {
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
line-height: 15px;
|
line-height: 14px;
|
||||||
|
width: max-content;
|
||||||
|
font-size: unset;
|
||||||
|
text-decoration: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1000px) {
|
||||||
|
button {
|
||||||
|
display: block;
|
||||||
|
padding-top: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
padding-left: 0.1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -566,6 +574,7 @@ address.dja-address-contact-list {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline;
|
display: inline;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
|
|
||||||
.usa-button__icon {
|
.usa-button__icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -579,53 +588,12 @@ address.dja-address-contact-list {
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
line-height: 14px;
|
line-height: 14px;
|
||||||
color: var(--link-fg);
|
color: var(--link-fg);
|
||||||
}
|
width: max-content;
|
||||||
}
|
font-size: unset;
|
||||||
|
text-decoration: none !important;
|
||||||
.usa-alert--slim.usa-alert--slim--dja-admin {
|
|
||||||
.usa-alert__body:before {
|
|
||||||
top: 0.4rem;
|
|
||||||
left: 10px
|
|
||||||
}
|
|
||||||
.usa-alert__body {
|
|
||||||
padding-left: 2.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-icon-group__success-dialog--input {
|
|
||||||
.usa-alert__body {
|
|
||||||
padding-right: 53px !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
.usa-alert--success.usa-alert--slim--dja-admin {
|
|
||||||
border-left-color: var(--accent);
|
|
||||||
.usa-alert__body {
|
|
||||||
background-color: var(--darkened-bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.usa-alert__body:before {
|
|
||||||
background-color: var(--body-quiet-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
color: var(--body-quiet-color);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-outline-on-click:focus {
|
.no-outline-on-click:focus {
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
svg.no-pointer-events {
|
|
||||||
use {
|
|
||||||
// USWDS has weird interactions with SVGs regarding tooltips,
|
|
||||||
// and other components. In this event, we need to disable pointer interactions.
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.dja-important__display-none {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
|
@ -4,20 +4,36 @@
|
||||||
Template for an input field with a clipboard
|
Template for an input field with a clipboard
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
|
{% if not invisible_input_field %}
|
||||||
<div class="admin-icon-group">
|
<div class="admin-icon-group">
|
||||||
{{ field }}
|
{{ field }}
|
||||||
<button
|
<button
|
||||||
class="usa-button usa-button--unstyled padding-right-1 usa-button__icon usa-button__clipboard"
|
class="usa-button usa-button--unstyled padding-left-1 usa-button__icon usa-button__clipboard"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<div class="no-outline-on-click">
|
||||||
|
<svg
|
||||||
|
class="usa-icon"
|
||||||
|
>
|
||||||
|
<use aria-hidden="true" xlink:href="{%static 'img/sprite.svg'%}#content_copy"></use>
|
||||||
|
</svg>
|
||||||
|
<span>Copy</span>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="admin-icon-group admin-icon-group__clipboard-link">
|
||||||
|
<input aria-hidden="true" class="display-none" value="{{ field.email }}" />
|
||||||
|
<button
|
||||||
|
class="usa-button usa-button--unstyled padding-right-1 usa-button__icon usa-button__clipboard text-no-underline"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
<div class="usa-tooltip no-outline-on-click"
|
|
||||||
data-position="right"
|
|
||||||
title="Copy email">
|
|
||||||
<svg
|
<svg
|
||||||
class="usa-icon no-pointer-events"
|
class="usa-icon"
|
||||||
>
|
>
|
||||||
<use aria-hidden="true" xlink:href="{%static 'img/sprite.svg'%}#content_copy"></use>
|
<use aria-hidden="true" xlink:href="{%static 'img/sprite.svg'%}#content_copy"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
<span class="padding-left-05">Copy</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
|
@ -25,71 +25,11 @@
|
||||||
{# Email #}
|
{# Email #}
|
||||||
{% if user.email or user.contact.email %}
|
{% if user.email or user.contact.email %}
|
||||||
{% if user.contact.email %}
|
{% if user.contact.email %}
|
||||||
{{ user.contact.email }} |
|
{{ user.contact.email }}
|
||||||
<div class="admin-icon-group admin-icon-group__clipboard-link">
|
{% include "admin/input_with_clipboard.html" with field=user invisible_input_field=True %}
|
||||||
<input user-id="{{ user.contact.id }}" aria-hidden="true" class="display-none" value="{{ user.contact.email }}" />
|
|
||||||
<button
|
|
||||||
class="usa-button usa-button--unstyled padding-right-1 usa-button__icon usa-button__clipboard text-no-underline"
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
class="usa-icon"
|
|
||||||
>
|
|
||||||
<use aria-hidden="true" xlink:href="{%static 'img/sprite.svg'%}#content_copy"></use>
|
|
||||||
</svg>
|
|
||||||
Copy
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
id="email-clipboard__success-dialog-{{ user.contact.id }}"
|
|
||||||
class="admin-icon-group__success-dialog
|
|
||||||
display-none
|
|
||||||
usa-alert
|
|
||||||
usa-alert--success
|
|
||||||
usa-alert--slim
|
|
||||||
usa-alert--slim--dja-admin
|
|
||||||
margin-top-1
|
|
||||||
margin-bottom-1"
|
|
||||||
>
|
|
||||||
<div class="usa-alert__body">
|
|
||||||
<p class="usa-alert__text">
|
|
||||||
Email copied to clipboard.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ user.email }} |
|
{{ user.email }}
|
||||||
<div class="admin-icon-group admin-icon-group__clipboard-link">
|
{% include "admin/input_with_clipboard.html" with field=user invisible_input_field=True %}
|
||||||
<input user-id="{{ user.id }}" aria-hidden="true" class="display-none" value="{{ user.email }}" />
|
|
||||||
<button
|
|
||||||
class="usa-button usa-button--unstyled padding-right-1 usa-button__icon usa-button__clipboard text-no-underline"
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
class="usa-icon"
|
|
||||||
>
|
|
||||||
<use aria-hidden="true" xlink:href="{%static 'img/sprite.svg'%}#content_copy"></use>
|
|
||||||
</svg>
|
|
||||||
Copy
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
id="email-clipboard__success-dialog-{{ user.id }}"
|
|
||||||
class="admin-icon-group__success-dialog
|
|
||||||
display-none
|
|
||||||
usa-alert
|
|
||||||
usa-alert--success
|
|
||||||
usa-alert--slim
|
|
||||||
usa-alert--slim--dja-admin
|
|
||||||
margin-top-1
|
|
||||||
margin-bottom-1"
|
|
||||||
>
|
|
||||||
<div class="usa-alert__body">
|
|
||||||
<p class="usa-alert__text">
|
|
||||||
Email copied to clipboard.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<br class="admin-icon-group__br">
|
<br class="admin-icon-group__br">
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -11,28 +11,3 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock field_other %}
|
{% endblock field_other %}
|
||||||
|
|
||||||
{% block after_help_text %}
|
|
||||||
{% if field.field.name == "email" %}
|
|
||||||
<div class="flex-container dja-important__display-none">
|
|
||||||
<label aria-label="Clipboard"></label>
|
|
||||||
<div
|
|
||||||
id="email-clipboard__success-dialog"
|
|
||||||
class="admin-icon-group__success-dialog
|
|
||||||
admin-icon-group__success-dialog--input
|
|
||||||
display-none
|
|
||||||
usa-alert
|
|
||||||
usa-alert--success
|
|
||||||
usa-alert--slim
|
|
||||||
usa-alert--slim--dja-admin
|
|
||||||
margin-top-1"
|
|
||||||
>
|
|
||||||
<div class="usa-alert__body">
|
|
||||||
<p class="usa-alert__text">
|
|
||||||
Email copied to clipboard.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
Loading…
Add table
Add a link
Reference in a new issue