Remove now-unused locales field from admin handlers

This commit is contained in:
jordi fita mas 2024-01-15 22:47:16 +01:00
parent 50bcbf012f
commit 8205bec34d
8 changed files with 17 additions and 29 deletions

View File

@ -16,7 +16,6 @@ import (
"dev.tandem.ws/tandem/camper/pkg/home"
httplib "dev.tandem.ws/tandem/camper/pkg/http"
"dev.tandem.ws/tandem/camper/pkg/legal"
"dev.tandem.ws/tandem/camper/pkg/locale"
"dev.tandem.ws/tandem/camper/pkg/location"
"dev.tandem.ws/tandem/camper/pkg/media"
"dev.tandem.ws/tandem/camper/pkg/season"
@ -36,17 +35,17 @@ type adminHandler struct {
services *services.AdminHandler
}
func newAdminHandler(locales locale.Locales, mediaDir string) *adminHandler {
func newAdminHandler(mediaDir string) *adminHandler {
return &adminHandler{
campsite: campsite.NewAdminHandler(locales),
campsite: campsite.NewAdminHandler(),
company: company.NewAdminHandler(),
home: home.NewAdminHandler(locales),
home: home.NewAdminHandler(),
legal: legal.NewAdminHandler(),
location: location.NewAdminHandler(),
media: media.NewAdminHandler(mediaDir),
payment: booking.NewAdminHandler(),
season: season.NewAdminHandler(locales),
services: services.NewAdminHandler(locales),
season: season.NewAdminHandler(),
services: services.NewAdminHandler(),
}
}

View File

@ -48,7 +48,7 @@ func New(db *database.DB, avatarsDir string, mediaDir string) (http.Handler, err
db: db,
fileHandler: static,
profile: profile,
admin: newAdminHandler(locales, mediaDir),
admin: newAdminHandler(mediaDir),
public: newPublicHandler(),
media: mediaHandler,
locales: locales,

View File

@ -22,9 +22,9 @@ type AdminHandler struct {
types *types.AdminHandler
}
func NewAdminHandler(locales locale.Locales) *AdminHandler {
func NewAdminHandler() *AdminHandler {
return &AdminHandler{
types: types.NewAdminHandler(locales),
types: types.NewAdminHandler(),
}
}

View File

@ -22,11 +22,10 @@ import (
)
type AdminHandler struct {
locales locale.Locales
}
func NewAdminHandler(locales locale.Locales) *AdminHandler {
return &AdminHandler{locales}
func NewAdminHandler() *AdminHandler {
return &AdminHandler{}
}
func (h *AdminHandler) Handler(user *auth.User, company *auth.Company, conn *database.Conn) http.Handler {

View File

@ -24,16 +24,14 @@ import (
type AdminHandler struct {
name string
indexHandler IndexHandler
locales locale.Locales
}
type IndexHandler func(w http.ResponseWriter, r *http.Request, user *auth.User, company *auth.Company, conn *database.Conn)
func NewAdminHandler(name string, indexHandler IndexHandler, locales locale.Locales) *AdminHandler {
func NewAdminHandler(name string, indexHandler IndexHandler) *AdminHandler {
return &AdminHandler{
name: name,
indexHandler: indexHandler,
locales: locales,
}
}

View File

@ -12,21 +12,18 @@ import (
"dev.tandem.ws/tandem/camper/pkg/carousel"
"dev.tandem.ws/tandem/camper/pkg/database"
httplib "dev.tandem.ws/tandem/camper/pkg/http"
"dev.tandem.ws/tandem/camper/pkg/locale"
"dev.tandem.ws/tandem/camper/pkg/template"
)
const carouselName = "home"
type AdminHandler struct {
locales locale.Locales
carousel *carousel.AdminHandler
}
func NewAdminHandler(locales locale.Locales) *AdminHandler {
func NewAdminHandler() *AdminHandler {
return &AdminHandler{
locales: locales,
carousel: carousel.NewAdminHandler(carouselName, serveHomeIndex, locales),
carousel: carousel.NewAdminHandler(carouselName, serveHomeIndex),
}
}

View File

@ -29,13 +29,10 @@ import (
const UnsetColor = 0xd1d0df
type AdminHandler struct {
locales locale.Locales
}
func NewAdminHandler(locales locale.Locales) *AdminHandler {
return &AdminHandler{
locales: locales,
}
func NewAdminHandler() *AdminHandler {
return &AdminHandler{}
}
func (h *AdminHandler) Handler(user *auth.User, company *auth.Company, conn *database.Conn) http.HandlerFunc {

View File

@ -24,14 +24,12 @@ import (
const carouselName = "services"
type AdminHandler struct {
locales locale.Locales
carousel *carousel.AdminHandler
}
func NewAdminHandler(locales locale.Locales) *AdminHandler {
func NewAdminHandler() *AdminHandler {
return &AdminHandler{
locales: locales,
carousel: carousel.NewAdminHandler(carouselName, serveServicesIndex, locales),
carousel: carousel.NewAdminHandler(carouselName, serveServicesIndex),
}
}