dead code entfernt
This commit is contained in:
1 parent
2d19d9a06f
commit
0b69384fb7
1 file changed
-34
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
export function addCategory(categoryAsJSON) {
|
||||
const list = document.querySelector(".displayedList");
|
||||
const category = document.createElement("shopping-category");
|
||||
@@ -29,36 +27,4 @@ export function deleteCategory(deleteAllItems, categoryID) {
|
||||
}
|
||||
category.remove()
|
||||
document.querySelector(`option[value='${categoryID}']`).remove();
|
||||
|
||||
}
|
||||
|
||||
export function createEditCategoryForm(categoryName) {
|
||||
const editForm = document.createElement("form");
|
||||
const inputName = document.createElement("input");
|
||||
const abortButton = document.createElement("button");
|
||||
const saveButton = document.createElement("button");
|
||||
|
||||
inputName.setAttribute("name", "newCategoryName");
|
||||
inputName.setAttribute("value", categoryName);
|
||||
inputName.classList.add("editForm__name");
|
||||
|
||||
abortButton.setAttribute("type", "button");
|
||||
abortButton.classList.add("editForm__buttonAbort");
|
||||
abortButton.textContent = "Abbrechen";
|
||||
saveButton.textContent = "Speichern";
|
||||
|
||||
editForm.append(inputName, saveButton, abortButton);
|
||||
|
||||
return editForm;
|
||||
}
|
||||
|
||||
export function editCategory(id, formElement, formData, categoryDiv) {
|
||||
|
||||
let newName = formData.newCategoryName;
|
||||
|
||||
categoryDiv.querySelector(".category__name").textContent = newName;
|
||||
formElement.replaceWith(categoryDiv);
|
||||
|
||||
document.querySelector(`option[value='${id}']`).textContent = newName;
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user