The backend for the AiteStory website
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
737 B

  1. package controllers
  2. import (
  3. "net/http"
  4. "git.aiterp.net/AiteRP/aitestory/view"
  5. "git.aiterp.net/AiteRP/aitestory/viewmodel"
  6. "git.aiterp.net/AiteRP/aitestory/model"
  7. "git.aiterp.net/gisle/wrouter"
  8. "git.aiterp.net/gisle/wrouter/auth"
  9. )
  10. // TagController serves and handles the tag managment pages
  11. var TagController = wrouter.Router{}
  12. func tagList(path string, w http.ResponseWriter, req *http.Request, user *auth.User) bool {
  13. //var err error
  14. if (req.Method != "GET" && req.Method != "POST") || len(req.URL.Path) > len(path) {
  15. return false
  16. }
  17. tl := viewmodel.TagList{}
  18. tl.Tags, _ = model.ListTags()
  19. tl.Setup(user)
  20. view.Render(w, "tags/list", 200, tl)
  21. return true
  22. }
  23. func init() {
  24. TagController.Function("/", tagList)
  25. }