1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-11-03 00:53:00 +00:00

Categories: Implement category pages

This commit is contained in:
Timur Ismagilov
2022-03-20 11:21:59 +03:00
parent f5cbd5622d
commit d2a4285e7f
4 changed files with 96 additions and 4 deletions

30
web/categories.go Normal file
View File

@@ -0,0 +1,30 @@
package web
import (
"github.com/bouncepaw/mycorrhiza/util"
"github.com/bouncepaw/mycorrhiza/views"
"github.com/gorilla/mux"
"net/http"
)
func initCategories(r *mux.Router) {
r.PathPrefix("/add-to-category").HandlerFunc(handlerAddToCategory).Methods("POST")
r.PathPrefix("/remove-from-category").HandlerFunc(handlerRemoveFromCategory).Methods("POST")
r.PathPrefix("/category/").HandlerFunc(handlerCategory).Methods("GET")
}
func handlerCategory(w http.ResponseWriter, rq *http.Request) {
util.PrepareRq(rq)
var (
catName = util.HyphaNameFromRq(rq, "category")
)
views.CategoryPageHTML(w, rq, catName)
}
func handlerRemoveFromCategory(w http.ResponseWriter, rq *http.Request) {
}
func handlerAddToCategory(w http.ResponseWriter, rq *http.Request) {
}

View File

@@ -108,6 +108,7 @@ func Handler() http.Handler {
initStuff(wikiRouter)
initSearch(wikiRouter)
initBacklinks(wikiRouter)
initCategories(wikiRouter)
// Admin routes.
if cfg.UseAuth {