This commit is contained in:
+12
-8
@@ -72,6 +72,8 @@ function renderAddBookView() {
|
||||
volume: document.getElementById("volume").value,
|
||||
year: document.getElementById("year").value,
|
||||
coverURL: document.getElementById("coverURL").value,
|
||||
childrens: document.getElementById("childrens").checked,
|
||||
signed: document.getElementById("signed").checked,
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -114,8 +116,8 @@ function renderTable(bookList, sortField) {
|
||||
}
|
||||
bookList.sort((one, two) =>
|
||||
(one[sortState.sortBy] + one["sortTitle"]).localeCompare(
|
||||
two[sortState.sortBy] + two["sortTitle"]
|
||||
)
|
||||
two[sortState.sortBy] + two["sortTitle"],
|
||||
),
|
||||
);
|
||||
if (sortState.sortOrder === "desc") {
|
||||
bookList.reverse();
|
||||
@@ -135,7 +137,7 @@ function renderTable(bookList, sortField) {
|
||||
row.addEventListener("click", (e) => {
|
||||
// add listener to swap current book
|
||||
document.getElementById("current").innerHTML = BookTemplate(
|
||||
bookList[e.currentTarget.id]
|
||||
bookList[e.currentTarget.id],
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -146,7 +148,7 @@ function renderTable(bookList, sortField) {
|
||||
// only add callback when there's a sortBy attribute
|
||||
renderTable(bookList, e.target.dataset.sortBy);
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
// mark currently active column
|
||||
bookElement
|
||||
@@ -187,7 +189,7 @@ function search(searchBy, includeChildrensBooks) {
|
||||
return inSearch && !childrens;
|
||||
}
|
||||
return inSearch;
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -218,7 +220,7 @@ function clearAddBookForm() {
|
||||
document
|
||||
.getElementById("newBookForm")
|
||||
.childNodes.forEach((node) =>
|
||||
node.nodeName === "LABEL" ? (node.lastChild.value = "") : null
|
||||
node.nodeName === "LABEL" ? (node.lastChild.value = "") : null,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -265,7 +267,9 @@ function TableRowTemplate({
|
||||
return `<tr class="tRow" id="${rowNumber}">
|
||||
<td class="title">
|
||||
${title} ${
|
||||
signed ? '<span class="signed" title="Signed by the author" >✒</span>' : ""
|
||||
signed
|
||||
? '<span class="signed" title="Signed by the author" >✒</span>'
|
||||
: ""
|
||||
}
|
||||
</td>
|
||||
<td class="author">${authors}</td>
|
||||
@@ -312,7 +316,7 @@ function AddBookTemplate() {
|
||||
type="${field.type}"
|
||||
name="${field.name.toLowerCase()}"
|
||||
id="${field.id}"
|
||||
/></label><br/>`
|
||||
/></label><br/>`,
|
||||
);
|
||||
}, "")}
|
||||
<input id="lookup" type="submit" value="look up">
|
||||
|
||||
Reference in New Issue
Block a user