|
|
@ -282,7 +282,7 @@ function generateTemplateDOM(index, template) {
|
|
|
|
editReadCell.classList.add("template-data-view");
|
|
|
|
editReadCell.classList.add("template-data-view");
|
|
|
|
const switchToEditButton = document.createElement("button");
|
|
|
|
const switchToEditButton = document.createElement("button");
|
|
|
|
switchToEditButton.type = "button";
|
|
|
|
switchToEditButton.type = "button";
|
|
|
|
switchToEditButton.innerText = "Edit"
|
|
|
|
switchToEditButton.innerText = "Edit";
|
|
|
|
editReadCell.appendChild(switchToEditButton);
|
|
|
|
editReadCell.appendChild(switchToEditButton);
|
|
|
|
const editEditCell = document.createElement("div");
|
|
|
|
const editEditCell = document.createElement("div");
|
|
|
|
editEditCell.classList.add("template-data-edit", "hidden");
|
|
|
|
editEditCell.classList.add("template-data-edit", "hidden");
|
|
|
@ -356,7 +356,7 @@ function generateTemplateDOM(index, template) {
|
|
|
|
description: description,
|
|
|
|
description: description,
|
|
|
|
attribution: attribution,
|
|
|
|
attribution: attribution,
|
|
|
|
crop: [cropXStart, cropYStart, cropXEnd, cropYEnd],
|
|
|
|
crop: [cropXStart, cropYStart, cropXEnd, cropYEnd],
|
|
|
|
location: [locXStart, locYStart, locXEnd, locYEnd]
|
|
|
|
location: [locXStart, locYStart, locXEnd, locYEnd],
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const imageFiles = imageEditField.files;
|
|
|
|
const imageFiles = imageEditField.files;
|
|
|
@ -387,7 +387,11 @@ function generateTemplateDOM(index, template) {
|
|
|
|
|
|
|
|
|
|
|
|
const origName = templateData[index].name;
|
|
|
|
const origName = templateData[index].name;
|
|
|
|
const encodedName = encodeURIComponent(origName);
|
|
|
|
const encodedName = encodeURIComponent(origName);
|
|
|
|
const submitResponse = await fetch(`/thrimshim/update-template/${encodedName}`, { method: "POST", body: JSON.stringify(submitData), headers: { "Content-Type": "application/json" }});
|
|
|
|
const submitResponse = await fetch(`/thrimshim/update-template/${encodedName}`, {
|
|
|
|
|
|
|
|
method: "POST",
|
|
|
|
|
|
|
|
body: JSON.stringify(submitData),
|
|
|
|
|
|
|
|
headers: { "Content-Type": "application/json" },
|
|
|
|
|
|
|
|
});
|
|
|
|
if (!submitResponse.ok) {
|
|
|
|
if (!submitResponse.ok) {
|
|
|
|
const submitError = document.createElement("li");
|
|
|
|
const submitError = document.createElement("li");
|
|
|
|
submitError.innerText = await submitResponse.text();
|
|
|
|
submitError.innerText = await submitResponse.text();
|
|
|
|