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)) } }