From 409a62ba1ac1dd3a1d50907627991dfb7d350404 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Fri, 1 Mar 2024 09:55:52 +0200 Subject: Improve checkbox styling, add clipboard copy button --- templates/manage.html.j2 | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'templates/manage.html.j2') diff --git a/templates/manage.html.j2 b/templates/manage.html.j2 index db7da0b..4a7a99e 100644 --- a/templates/manage.html.j2 +++ b/templates/manage.html.j2 @@ -5,14 +5,16 @@

Managing poll {{ poll.title }} by {{ poll.author_name }}

{{ poll.pub_date_formatted_notz() }}.

-

+

Share this URL with your peers:
- {{ poll.share_url() }} -

-

+ {{ poll.share_url() }}

+
+

+
Note! You can only edit this poll if you have this URL or use the same browser session:
- {{ poll.manage_url() }} -

+ {{ poll.manage_url() }} +
+

{% include "poll_info_table.html.j2" %} @@ -124,9 +126,27 @@ const focusNext = query.get('focus_next'); if (focusNext !== null) { const nextInput = document.querySelector(`input[name="start_datetime"]`); if (nextInput !== null) { + nextInput.scrollIntoView(); nextInput.focus(); } } + +let shareLinkCopy = document.getElementById("share-link-copy"); +if (shareLinkCopy !== null) { + shareLinkCopy.outerHTML = ""; + shareLinkCopy = document.getElementById("share-link-copy"); // refresh the reference +} + +function copyShareLink() { + const shareLink = document.getElementById("share-link"); + const linkText = shareLink.getAttribute("href"); + navigator.clipboard.writeText(linkText); + console.log("Copied to clipboard: " + linkText); + shareLinkCopy.innerHTML = "✅"; + setTimeout(() => { + shareLinkCopy.innerHTML = "📋"; + }, 2000); +} {% endblock %} \ No newline at end of file -- cgit v1.3