Merge pull request #832 from ae-utbm/image-deletion-fix

Fixes after last deployment
This commit is contained in:
thomas girod 2024-09-19 23:57:12 +02:00 committed by GitHub
commit 66e88ac6fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 9 deletions

View File

@ -77,11 +77,11 @@ function create_graph(container, data, active_user_id) {
fit: true,
klay: {
addUnnecessaryBendpoints: true,
direction: 'DOWN',
nodePlacement: 'INTERACTIVE',
layoutHierarchy: true
}
}
direction: "DOWN",
nodePlacement: "INTERACTIVE",
layoutHierarchy: true,
},
},
});
let active_user = cy
.getElementById(active_user_id)
@ -178,7 +178,9 @@ document.addEventListener("alpine:init", () => {
typeof depth_min === "undefined" ||
typeof depth_max === "undefined"
) {
console.error("Some constants are not set before using the family_graph script, please look at the documentation");
console.error(
"Some constants are not set before using the family_graph script, please look at the documentation",
);
return;
}
@ -194,7 +196,7 @@ document.addEventListener("alpine:init", () => {
loading: false,
godfathers_depth: get_initial_depth("godfathers_depth"),
godchildren_depth: get_initial_depth("godchildren_depth"),
reverse: initialUrlParams.get("reverse")?.toLowerCase?.() === 'true',
reverse: initialUrlParams.get("reverse")?.toLowerCase?.() === "true",
graph: undefined,
graph_data: {},
@ -227,7 +229,11 @@ document.addEventListener("alpine:init", () => {
async screenshot() {
const link = document.createElement("a");
link.href = this.graph.jpg();
link.download = gettext("family_tree.%(extension)s", "jpg");
link.download = interpolate(
gettext("family_tree.%(extension)s"),
{ extension: "jpg" },
true,
);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);

View File

@ -201,7 +201,7 @@ document.addEventListener("alpine:init", () => {
},
async delete_picture() {
const res = await fetch(`/api/sas/picture/${this.current_picture.id}/`, {
const res = await fetch(`/api/sas/picture/${this.current_picture.id}`, {
method: "DELETE",
});
if (!res.ok) {