From 9beca95c6e2a52db62f4703c0da5a3b77857ec39 Mon Sep 17 00:00:00 2001 From: yequari Date: Sat, 3 Jan 2026 17:22:01 -0700 Subject: [PATCH] update guestbook --- content/guestbook.html | 40 ++++++++++++++++++++++++++++++++++++++-- static/guestbook.js | 7 +++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/content/guestbook.html b/content/guestbook.html index 4806757..a2ef6cc 100644 --- a/content/guestbook.html +++ b/content/guestbook.html @@ -3,6 +3,42 @@ title: "Guestbook" date: 2025-06-26T20:17:07-07:00 --- + + + + diff --git a/static/guestbook.js b/static/guestbook.js index 8a6dcac..ea09bcd 100644 --- a/static/guestbook.js +++ b/static/guestbook.js @@ -6,6 +6,8 @@ class GuestbookForm extends HTMLElement { constructor() { super(); this.attachShadow({ mode: 'open' }); + let template = document.getElementById("custom-guestbook-form"); + this.templateContent = template.content; this._guestbook = this.getAttribute('guestbook') || ''; this._postUrl = `${this._guestbook}/comments/create/remote` this.render(); @@ -63,6 +65,7 @@ class GuestbookForm extends HTMLElement { `; + this.shadowRoot.appendChild(document.importNode(this.templateContent, true)) } } @@ -74,9 +77,12 @@ class CommentList extends HTMLElement { constructor() { super(); this.attachShadow({ mode: 'open' }); + let template = document.getElementById("custom-guestbook-comments"); + this.templateContent = template.content; this.comments = []; this.loading = false; this.error = null; + } connectedCallback() { @@ -169,6 +175,7 @@ class CommentList extends HTMLElement { } `; + this.shadowRoot.appendChild(document.importNode(this.templateContent, true)) } }