mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 10:54:18 +00:00
34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
function createCorpusElement(corpus) {
|
|
corpusElement = document.createElement("a");
|
|
corpusElement.classList.add("avatar", "collection-item");
|
|
corpusElement.dataset.key = "id";
|
|
corpusElement.dataset.value = corpus.id;
|
|
corpusElement.href = `/corpora/${corpus.id}`;
|
|
corpusDescriptionElement = document.createElement("p");
|
|
corpusDescriptionElement.dataset.key = "description";
|
|
corpusDescriptionElement.innerText = corpus.description;
|
|
corpusIconElement = document.createElement("i");
|
|
corpusIconElement.classList.add("circle", "material-icons");
|
|
corpusIconElement.innerText = "book";
|
|
corpusTitleElement = document.createElement("span");
|
|
corpusTitleElement.classList.add("title");
|
|
corpusTitleElement.dataset.key = "title";
|
|
corpusTitleElement.innerText = corpus.title;
|
|
|
|
corpusElement.appendChild(corpusIconElement);
|
|
corpusElement.appendChild(corpusTitleElement);
|
|
corpusElement.appendChild(corpusDescriptionElement);
|
|
|
|
return corpusElement;
|
|
}
|
|
|
|
|
|
function createCorpusElements(corpusList) {
|
|
for (corpus of corpora) {
|
|
corpusList.list.appendChild(createCorpusElement(corpus));
|
|
}
|
|
corpusList.reIndex();
|
|
corpusList.update();
|
|
updatePagination(corpusList);
|
|
}
|