Compare commits

...

2 Commits

Author SHA1 Message Date
f27bb870e1 chore(deps): update dependency setuptools to v72
Some checks failed
renovate/artifacts Artifact file update failure
Ruff / ruff (pull_request) Successful in 48s
Ruff / ruff (push) Successful in 53s
Test / test (push) Failing after 1m8s
Test / test (pull_request) Failing after 2m53s
2024-08-13 15:31:06 +00:00
1827d10bf4 membershipworks: Fix script in upcoming events post generator
Some checks failed
Ruff / ruff (push) Successful in 1m38s
Test / test (push) Failing after 3m43s
2024-08-09 01:47:07 -04:00
3 changed files with 26 additions and 24 deletions

View File

@ -0,0 +1,19 @@
import { Popover } from "bootstrap";
async function copyToClipboard(event: MouseEvent) {
// https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API
const data = new ClipboardItem({
"text/plain": new Blob([document.getElementById("preview")!.innerHTML], {
type: "text/plain",
}),
});
await navigator.clipboard.write([data]);
let popover = Popover.getInstance(event.target as Element)!;
popover.show();
setTimeout(() => popover.hide(), 1000);
}
const button = document.getElementById("copy-button")!;
new Popover(button, { trigger: "manual" });
button.addEventListener("click", copyToClipboard);

View File

@ -1,6 +1,11 @@
{% extends "base.dj.html" %} {% extends "base.dj.html" %}
{% load nh3_tags %} {% load nh3_tags %}
{% load django_vite %}
{% block vite_extra_assets %}
{% vite_asset 'membershipworks/js/upcoming_events_post_generator.entry.ts' %}
{% endblock %}
{% block title %}Upcoming Events{% endblock %} {% block title %}Upcoming Events{% endblock %}
{% block content %} {% block content %}
@ -136,25 +141,3 @@
</button> </button>
</div> </div>
{% endblock %} {% endblock %}
{% block script %}
<script>
async function copyToClipboard(event) {
// https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API
const data = new ClipboardItem({
"text/plain": new Blob(
[document.getElementById("preview").innerHTML], {
type: "text/plain"
})
});
await navigator.clipboard.write([data]);
bootstrap.Popover.getInstance(event.target).show();
setTimeout(() => bootstrap.Popover.getInstance(event.target).hide(), 1000);
}
const button = document.getElementById("copy-button");
const popover = new bootstrap.Popover(button, {
trigger: "manual"
})
button.addEventListener("click", copyToClipboard);
</script>
{% endblock %}

View File

@ -46,7 +46,7 @@ requires-python = ">=3.11"
[project.optional-dependencies] [project.optional-dependencies]
server = [ server = [
"uvicorn[standard]~=0.30", "uvicorn[standard]~=0.30",
"setuptools~=71.1", "setuptools~=72.2",
] ]
[project.entry-points."djangoq.errorreporters"] [project.entry-points."djangoq.errorreporters"]
@ -119,7 +119,7 @@ lint = [
typing = [ typing = [
"mypy~=1.10", "mypy~=1.10",
"django-stubs~=5.0", "django-stubs~=5.0",
"setuptools~=71.1", "setuptools~=72.2",
"types-bleach~=6.1", "types-bleach~=6.1",
"types-requests~=2.32", "types-requests~=2.32",
"types-urllib3~=1.26", "types-urllib3~=1.26",