aboutsummaryrefslogtreecommitdiff
path: root/forged/internal/incoming/web/handlers/group.go
blob: e56a3b53f8ea8514f94721b953e88fbed96d7ad1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

package handlers

import (
	"net/http"
	"strings"

	"go.lindenii.runxiyu.org/forge/forged/internal/incoming/web/templates"
	wtypes "go.lindenii.runxiyu.org/forge/forged/internal/incoming/web/types"
)

type GroupHTTP struct {
	r templates.Renderer
}

func NewGroupHTTP(r templates.Renderer) *GroupHTTP {
	return &GroupHTTP{
		r: r,
	}
}

func (h *GroupHTTP) Index(w http.ResponseWriter, r *http.Request, _ wtypes.Vars) {
	base := wtypes.Base(r)
	_ = h.r.Render(w, "group/index.html", struct {
		GroupPath string
	}{
		GroupPath: "/" + strings.Join(base.GroupPath, "/") + "/",
	})
}