DataDash/src/main/resources/static/dataset.js
J-Klinke d96da1b1e7 search nw displays the search results.
other section are being hidden in the case of a search and vice versa.
a 'nothing found' div was implemented
2024-06-24 17:03:47 +02:00

40 lines
1.1 KiB
JavaScript

export default class Dataset {
#abstract;
#author;
#categories;
#date;
#description;
#id;
#rating;
#title;
#type;
#upvotes;
#url;
#votes;
constructor({abst: shortDescription, author, categories, date, description, id, rating, title, type, upvotes, url, votes}) {
this.#abstract = shortDescription;
this.#author = author;
this.#categories = categories;
this.#date = date;
this.#description = description;
this.#id = id;
this.#rating = rating;
this.#title = title;
this.#type = type;
this.#upvotes = upvotes;
this.#url = url;
this.#votes = votes;
}
createDatasetHTMLElement() {
let template = document.querySelector("#dataset-template");
const clone = template.content.cloneNode(true);
clone.querySelector(".dataset").dataset.id = this.#id;
clone.querySelector("h3").innerText = this.#title;
clone.querySelector("p").innerText = this.#description;
clone.querySelector("span").innerText = this.#upvotes;
return clone;
}
}