frontend tags

This commit is contained in:
2020-07-08 17:33:39 -04:00
parent 13f4dbed2d
commit 230988d6d1
10 changed files with 190 additions and 18 deletions

View File

@@ -338,9 +338,27 @@ function createDocCard(hit) {
docCardBody.appendChild(tagContainer);
attachTagContainerEventListener(tagContainer);
return docCard;
}
function attachTagContainerEventListener(tagContainer) {
const sizeTag = Array.from(tagContainer.children).find(child => child.tagName === "SMALL");
const addTagButton = document.createElement("span");
addTagButton.setAttribute("class", "badge badge-pill add-tag-button");
addTagButton.appendChild(document.createTextNode("+Add"));
tagContainer.addEventListener("mouseenter", () => tagContainer.insertBefore(addTagButton, sizeTag));
tagContainer.addEventListener("mouseleave", () => addTagButton.remove());
addTagButton.addEventListener("click", () => {
tagBar.value = "";
$("#tagModal").modal("show");
tagBar.focus();
});
}
function makeThumbnail(mimeCategory, hit, imgWrapper, small) {
if (!hit["_source"].hasOwnProperty("thumbnail")) {