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