editList Funktionen entfernt
This commit is contained in:
1 parent
6c8b61fdda
commit
75cc93f141
1 file changed
-35
@@ -30,38 +30,3 @@ export function deleteList(listElement) {
|
||||
document.querySelector(`li.navbar__list[data-id='${listElement.dataset.id}']`).remove();
|
||||
listElement.remove();
|
||||
}
|
||||
|
||||
export function createEditListForm(textElement) {
|
||||
const editForm = document.createElement("form");
|
||||
const inputName = document.createElement("input");
|
||||
const abortButton = document.createElement("button");
|
||||
const saveButton = document.createElement("button");
|
||||
|
||||
inputName.setAttribute("name", "newListName");
|
||||
inputName.setAttribute("value", textElement.querySelector(".list__name").textContent);
|
||||
inputName.classList.add("editForm__name");
|
||||
|
||||
abortButton.textContent = "Abbrechen";
|
||||
saveButton.textContent = "Speichern";
|
||||
|
||||
saveButton.classList.add("editForm__saveButton");
|
||||
abortButton.classList.add("editForm__abortButton");
|
||||
|
||||
editForm.append(inputName, saveButton, abortButton);
|
||||
|
||||
return editForm;
|
||||
}
|
||||
|
||||
export function editList(id, formElement, formData, listLi) {
|
||||
|
||||
let newName = formData.newListName;
|
||||
|
||||
|
||||
document.querySelector(`.navbar__list[data-id='${listLi.dataset.id}'] > a`).textContent = newName;
|
||||
|
||||
listLi.querySelector(".list__name").textContent = newName;
|
||||
listLi.setAttribute("href", `/list/${id}`);
|
||||
formElement.replaceWith(listLi);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user