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, fit: true,
klay: { klay: {
addUnnecessaryBendpoints: true, addUnnecessaryBendpoints: true,
direction: 'DOWN', direction: "DOWN",
nodePlacement: 'INTERACTIVE', nodePlacement: "INTERACTIVE",
layoutHierarchy: true layoutHierarchy: true,
} },
} },
}); });
let active_user = cy let active_user = cy
.getElementById(active_user_id) .getElementById(active_user_id)
@ -178,7 +178,9 @@ document.addEventListener("alpine:init", () => {
typeof depth_min === "undefined" || typeof depth_min === "undefined" ||
typeof depth_max === "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; return;
} }
@ -194,7 +196,7 @@ document.addEventListener("alpine:init", () => {
loading: false, loading: false,
godfathers_depth: get_initial_depth("godfathers_depth"), godfathers_depth: get_initial_depth("godfathers_depth"),
godchildren_depth: get_initial_depth("godchildren_depth"), godchildren_depth: get_initial_depth("godchildren_depth"),
reverse: initialUrlParams.get("reverse")?.toLowerCase?.() === 'true', reverse: initialUrlParams.get("reverse")?.toLowerCase?.() === "true",
graph: undefined, graph: undefined,
graph_data: {}, graph_data: {},
@ -227,7 +229,11 @@ document.addEventListener("alpine:init", () => {
async screenshot() { async screenshot() {
const link = document.createElement("a"); const link = document.createElement("a");
link.href = this.graph.jpg(); 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); document.body.appendChild(link);
link.click(); link.click();
document.body.removeChild(link); document.body.removeChild(link);

View File

@ -201,7 +201,7 @@ document.addEventListener("alpine:init", () => {
}, },
async delete_picture() { 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", method: "DELETE",
}); });
if (!res.ok) { if (!res.ok) {