From f611162b0e7bd37e73d3fffc51365a7278f8d56a Mon Sep 17 00:00:00 2001 From: jordi fita mas Date: Sat, 4 Feb 2023 10:48:03 +0100 Subject: [PATCH] Move contacts templates in their own directory This is what directories are for: namespacing; no need for cumbersome file name prefixes. --- pkg/contacts.go | 6 +++--- web/template/{contacts-edit.gohtml => contacts/edit.gohtml} | 0 .../{contacts-index.gohtml => contacts/index.gohtml} | 0 web/template/{contacts-new.gohtml => contacts/new.gohtml} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename web/template/{contacts-edit.gohtml => contacts/edit.gohtml} (100%) rename web/template/{contacts-index.gohtml => contacts/index.gohtml} (100%) rename web/template/{contacts-new.gohtml => contacts/new.gohtml} (100%) diff --git a/pkg/contacts.go b/pkg/contacts.go index 5e30bd1..20d6b65 100644 --- a/pkg/contacts.go +++ b/pkg/contacts.go @@ -25,7 +25,7 @@ func IndexContacts(w http.ResponseWriter, r *http.Request, _ httprouter.Params) page := &ContactsIndexPage{ Contacts: mustGetContactEntries(r.Context(), conn, company), } - mustRenderAppTemplate(w, r, "contacts-index.gohtml", page) + mustRenderAppTemplate(w, r, "contacts/index.gohtml", page) } func GetContactForm(w http.ResponseWriter, r *http.Request, params httprouter.Params) { @@ -52,11 +52,11 @@ func GetContactForm(w http.ResponseWriter, r *http.Request, params httprouter.Pa } func mustRenderNewContactForm(w http.ResponseWriter, r *http.Request, form *contactForm) { - mustRenderAppTemplate(w, r, "contacts-new.gohtml", form) + mustRenderAppTemplate(w, r, "contacts/new.gohtml", form) } func mustRenderEditContactForm(w http.ResponseWriter, r *http.Request, form *contactForm) { - mustRenderAppTemplate(w, r, "contacts-edit.gohtml", form) + mustRenderAppTemplate(w, r, "contacts/edit.gohtml", form) } func HandleAddContact(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { diff --git a/web/template/contacts-edit.gohtml b/web/template/contacts/edit.gohtml similarity index 100% rename from web/template/contacts-edit.gohtml rename to web/template/contacts/edit.gohtml diff --git a/web/template/contacts-index.gohtml b/web/template/contacts/index.gohtml similarity index 100% rename from web/template/contacts-index.gohtml rename to web/template/contacts/index.gohtml diff --git a/web/template/contacts-new.gohtml b/web/template/contacts/new.gohtml similarity index 100% rename from web/template/contacts-new.gohtml rename to web/template/contacts/new.gohtml