remove mustache
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2023-03-07 17:56:58 -05:00
parent 6d6630b7c1
commit a819dd702c
3 changed files with 260 additions and 173 deletions

View File

@@ -1,8 +1,24 @@
const cheerio = require("cheerio");
const mustache = require("./js/mustache.4.1.0.js");
const fs = require("fs");
const stores = require("./stores.json");
function TableViewTemplate(rows) {
table = "<table>";
rows.forEach((row, key) => {
row.rowNumber = key;
table = table + TableRowTemplate(row);
});
return table + "</table>";
}
function TableRowTemplate({ rowNumber, name, address, city }) {
return `
<tr id="${rowNumber}" class="spotRow">
<td class="name">${name}</td>
<td>${address}, ${city}</td>
</tr>`;
}
fs.readFile("./index.html", function (err, data) {
if (err) {
throw err;
@@ -15,7 +31,7 @@ fs.readFile("./index.html", function (err, data) {
return aname === bname ? 0 : +(aname > bname) || -1;
});
$("#Stores").html(mustache.render($("#Table").html(), { rows: stores }));
$("#Stores").html(TableViewTemplate(stores));
$("#storeCount").html(stores.length);
$("#updatedOn").html(
new Date().toLocaleDateString("en-US", {