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:
30
web/categories.go
Normal file
30
web/categories.go
Normal 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) {
|
||||
|
||||
}
|
||||
@@ -108,6 +108,7 @@ func Handler() http.Handler {
|
||||
initStuff(wikiRouter)
|
||||
initSearch(wikiRouter)
|
||||
initBacklinks(wikiRouter)
|
||||
initCategories(wikiRouter)
|
||||
|
||||
// Admin routes.
|
||||
if cfg.UseAuth {
|
||||
|
||||
Reference in New Issue
Block a user