f3842a3486
The contact form was logging submissions but never actually sending emails. This commit: - Adds EmailService field to CVHandler - Initializes EmailService in main.go with SMTP config - Calls SendContactForm in HandleContact handler - Updates all test files to pass nil for emailService parameter
34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package handlers
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/juanatsap/cv-site/internal/pdf"
|
|
"github.com/juanatsap/cv-site/internal/services"
|
|
"github.com/juanatsap/cv-site/internal/templates"
|
|
)
|
|
|
|
// CVHandler handles CV-related requests
|
|
// Methods are split across multiple files for better organization:
|
|
// - cv_pages.go: Page rendering (Home, CVContent, DefaultCVShortcut)
|
|
// - cv_pdf.go: PDF export (ExportPDF)
|
|
// - cv_htmx.go: HTMX toggles (ToggleLength, ToggleIcons, SwitchLanguage, ToggleTheme)
|
|
// - cv_contact.go: Contact form submission (HandleContact)
|
|
// - cv_helpers.go: Helper functions (skills, dates, git, templates, cookies)
|
|
type CVHandler struct {
|
|
templates *templates.Manager
|
|
pdfGenerator *pdf.Generator
|
|
emailService *services.EmailService
|
|
serverAddr string
|
|
}
|
|
|
|
// NewCVHandler creates a new CV handler
|
|
func NewCVHandler(tmpl *templates.Manager, serverAddr string, emailService *services.EmailService) *CVHandler {
|
|
return &CVHandler{
|
|
templates: tmpl,
|
|
pdfGenerator: pdf.NewGenerator(30 * time.Second),
|
|
emailService: emailService,
|
|
serverAddr: serverAddr,
|
|
}
|
|
}
|