dead code entfert
This commit is contained in:
1 parent
00ac28aebf
commit
70338266f2
1 file changed
-41
@@ -18,47 +18,6 @@ export function addItem(itemAsJSON) {
|
||||
list.append(li);
|
||||
}
|
||||
|
||||
export function createEditItemForm(currentName, currentAmount) {
|
||||
const editForm = document.createElement("form");
|
||||
const inputName = document.createElement("input");
|
||||
const inputAmount = document.createElement("input");
|
||||
const abortButton = document.createElement("button");
|
||||
const saveButton = document.createElement("button");
|
||||
|
||||
inputName.setAttribute("name", "newItemName");
|
||||
inputName.setAttribute("value", currentName);
|
||||
inputName.classList.add("editForm__name");
|
||||
|
||||
inputAmount.setAttribute("name", "newItemAmount");
|
||||
inputAmount.setAttribute("value", currentAmount);
|
||||
inputAmount.classList.add("editForm__amount");
|
||||
|
||||
|
||||
abortButton.setAttribute("type", "button");
|
||||
abortButton.classList.add("editForm__buttonAbort");
|
||||
abortButton.textContent = "Abbrechen";
|
||||
|
||||
saveButton.textContent = "Speichern";
|
||||
saveButton.setAttribute("type", "submit");
|
||||
|
||||
|
||||
editForm.append(inputName, inputAmount, saveButton, abortButton);
|
||||
|
||||
return editForm;
|
||||
}
|
||||
|
||||
export function editItem(shoppingItemElement, formElement, formData) {
|
||||
|
||||
let newName = formData.itemName;
|
||||
let newAmount = formData.itemAmount;
|
||||
shoppingItemElement.setAttribute("item-name", newName);
|
||||
shoppingItemElement.setAttribute("item-amount", newAmount);
|
||||
|
||||
|
||||
formElement.replaceWith(shoppingItemElement);
|
||||
|
||||
}
|
||||
|
||||
export function deleteItem(li) {
|
||||
li.remove();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user