chore: consolidate contact templates to single location
Remove duplicate contact templates: - templates/partials/contact_success.html (old, 1.2KB) - templates/partials/contact_error.html (old, 1.1KB) The active templates remain in templates/partials/contact/: - contact-success.html - contact-error.html Updated contact.go to use the new template names to match cv_contact.go. The old templates had inline styles and were larger; the new ones use external CSS and are more maintainable. All contact form tests pass (7/7).
This commit is contained in:
@@ -139,7 +139,7 @@ func (h *ContactHandler) renderSuccess(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
tmpl, err := h.templates.Render("contact_success.html")
|
||||
tmpl, err := h.templates.Render("contact-success")
|
||||
if err != nil {
|
||||
log.Printf("ERROR loading success template: %v", err)
|
||||
// Fallback to simple HTML
|
||||
@@ -168,7 +168,7 @@ func (h *ContactHandler) renderError(w http.ResponseWriter, r *http.Request, mes
|
||||
"Message": message,
|
||||
}
|
||||
|
||||
tmpl, err := h.templates.Render("contact_error.html")
|
||||
tmpl, err := h.templates.Render("contact-error")
|
||||
if err != nil {
|
||||
log.Printf("ERROR loading error template: %v", err)
|
||||
// Fallback to simple HTML
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
<div class="alert alert-error" role="alert" style="
|
||||
padding: 1.5rem;
|
||||
margin: 1rem 0;
|
||||
border: 2px solid #ef4444;
|
||||
border-radius: 0.5rem;
|
||||
background-color: #fef2f2;
|
||||
color: #991b1b;
|
||||
animation: shake 0.4s ease-out;
|
||||
">
|
||||
<div style="display: flex; align-items: start; gap: 1rem;">
|
||||
<svg style="flex-shrink: 0; width: 1.5rem; height: 1.5rem; margin-top: 0.125rem;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||
</svg>
|
||||
<div style="flex: 1;">
|
||||
<h3 style="margin: 0 0 0.5rem 0; font-size: 1.125rem; font-weight: 600;">
|
||||
Unable to Send Message
|
||||
</h3>
|
||||
<p style="margin: 0; font-size: 0.95rem; line-height: 1.5;">
|
||||
{{.Message}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@keyframes shake {
|
||||
0%, 100% { transform: translateX(0); }
|
||||
10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
|
||||
20%, 40%, 60%, 80% { transform: translateX(5px); }
|
||||
}
|
||||
</style>
|
||||
@@ -1,36 +0,0 @@
|
||||
<div class="alert alert-success" role="alert" style="
|
||||
padding: 1.5rem;
|
||||
margin: 1rem 0;
|
||||
border: 2px solid #22c55e;
|
||||
border-radius: 0.5rem;
|
||||
background-color: #f0fdf4;
|
||||
color: #166534;
|
||||
animation: slideIn 0.3s ease-out;
|
||||
">
|
||||
<div style="display: flex; align-items: start; gap: 1rem;">
|
||||
<svg style="flex-shrink: 0; width: 1.5rem; height: 1.5rem; margin-top: 0.125rem;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
|
||||
</svg>
|
||||
<div style="flex: 1;">
|
||||
<h3 style="margin: 0 0 0.5rem 0; font-size: 1.125rem; font-weight: 600;">
|
||||
Message Sent Successfully!
|
||||
</h3>
|
||||
<p style="margin: 0; font-size: 0.95rem; line-height: 1.5;">
|
||||
Thank you for reaching out. I've received your message and will get back to you as soon as possible.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@keyframes slideIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user