other section are being hidden in the case of a search and vice versa. a 'nothing found' div was implemented
40 lines
1.1 KiB
JavaScript
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;
|
|
}
|
|
}
|