Skip to content

Commit

Permalink
website: add help page
Browse files Browse the repository at this point in the history
  • Loading branch information
icxes committed Mar 14, 2024
1 parent f975876 commit 674d49e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions website/public/help.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package public

import (
"net/http"

"github.com/R-a-dio/valkyrie/website/middleware"
)

type HelpInput struct {
middleware.Input
}

func (HelpInput) TemplateBundle() string {
return "help"
}

func NewHelpInput(r *http.Request) HelpInput {
return HelpInput{
Input: middleware.InputFromRequest(r),
}
}

func (s State) GetHelp(w http.ResponseWriter, r *http.Request) {
input := NewHelpInput(r)

err := s.Templates.Execute(w, r, input)
if err != nil {
s.errorHandler(w, r, err)
return
}
}
1 change: 1 addition & 0 deletions website/public/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@ func Route(ctx context.Context, s State) func(chi.Router) {
r.Get("/faves/{Nick}", s.GetFaves)
r.Post("/faves", s.PostFaves)
r.Get("/irc", s.GetChat)
r.Get("/help", s.GetHelp)
}
}

0 comments on commit 674d49e

Please sign in to comment.