mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-12 20:49:41 +02:00
Cleanup
This commit is contained in:
parent
7aea3de7dc
commit
1293f189a7
4 changed files with 47 additions and 19 deletions
|
@ -97,7 +97,7 @@ function openInNewTab(el, removeAttribute = false){
|
||||||
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);
|
||||||
}, 2000);
|
}, 1500);
|
||||||
}
|
}
|
||||||
|
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
|
@ -109,7 +109,24 @@ function openInNewTab(el, removeAttribute = false){
|
||||||
function handleClipboardButtons() {
|
function handleClipboardButtons() {
|
||||||
clipboardButtons = document.querySelectorAll(".usa-button__clipboard")
|
clipboardButtons = document.querySelectorAll(".usa-button__clipboard")
|
||||||
clipboardButtons.forEach((button) => {
|
clipboardButtons.forEach((button) => {
|
||||||
button.addEventListener("click", ()=>{copyToClipboardAndChangeIcon(button)});
|
|
||||||
|
// Handle copying the text to your clipboard,
|
||||||
|
// and changing the icon.
|
||||||
|
button.addEventListener("click", ()=>{
|
||||||
|
copyToClipboardAndChangeIcon(button);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add a class that removes the outline style on click
|
||||||
|
button.addEventListener("mousedown", function() {
|
||||||
|
this.classList.remove("no-outline-on-click");
|
||||||
|
});
|
||||||
|
|
||||||
|
// But add it back in after the user clicked,
|
||||||
|
// for accessibility reasons (so we can still tab, etc)
|
||||||
|
button.addEventListener("blur", function() {
|
||||||
|
this.classList.remove("no-outline-on-click");
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,16 +308,18 @@ input.admin-confirm-button {
|
||||||
.usa-button__icon {
|
.usa-button__icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border: none;
|
|
||||||
background: transparent;
|
|
||||||
padding: 0 1rem;
|
|
||||||
margin: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
padding-right: 45px;
|
// Allow for padding around the copy button
|
||||||
|
padding-right: 35px;
|
||||||
|
// Match the height of other inputs
|
||||||
|
min-height: 2.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-outline-on-click:focus {
|
||||||
|
outline: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
19
src/registrar/templates/admin/input_with_clipboard.html
Normal file
19
src/registrar/templates/admin/input_with_clipboard.html
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{% load i18n static %}
|
||||||
|
|
||||||
|
{% comment %}
|
||||||
|
Template for an input field with a clipboard
|
||||||
|
{% endcomment %}
|
||||||
|
|
||||||
|
<div class="admin-icon-group">
|
||||||
|
{{ field }}
|
||||||
|
<button
|
||||||
|
class="usa-button usa-button--unstyled padding-right-1 usa-button__icon usa-button__clipboard"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
class="usa-icon"
|
||||||
|
>
|
||||||
|
<use aria-hidden="true" xlink:href="{%static 'img/sprite.svg'%}#content_copy"></use>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
|
@ -1,5 +1,4 @@
|
||||||
{% extends "admin/fieldset.html" %}
|
{% extends "admin/fieldset.html" %}
|
||||||
{% load i18n static %}
|
|
||||||
|
|
||||||
{% comment %}
|
{% comment %}
|
||||||
This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
||||||
|
@ -19,16 +18,7 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
||||||
{% if field.is_readonly %}
|
{% if field.is_readonly %}
|
||||||
<div class="readonly">{{ field.contents }}</div>
|
<div class="readonly">{{ field.contents }}</div>
|
||||||
{% elif field.field.name == "email" %}
|
{% elif field.field.name == "email" %}
|
||||||
<div class="admin-icon-group">
|
{% include "admin/input_with_clipboard.html" with field=field.field %}
|
||||||
{{ field.field }}
|
|
||||||
<button class="usa-button usa-button__icon usa-button__clipboard" type="button">
|
|
||||||
<svg
|
|
||||||
class="usa-icon"
|
|
||||||
>
|
|
||||||
<use aria-hidden="true" xlink:href="{%static 'img/sprite.svg'%}#content_copy"></use>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ field.field }}
|
{{ field.field }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue