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.
32 lines
669 B
32 lines
669 B
package controllers
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
|
|
"git.aiterp.net/AiteRP/aitestory/view"
|
|
"git.aiterp.net/AiteRP/aitestory/viewmodel"
|
|
|
|
"git.aiterp.net/gisle/wrouter"
|
|
"git.aiterp.net/gisle/wrouter/auth"
|
|
)
|
|
|
|
// ListController serves the front page's list, with and without filters
|
|
var ListController = wrouter.Router{}
|
|
|
|
func listIndex(path string, w http.ResponseWriter, req *http.Request, user *auth.User) bool {
|
|
if req.Method != "GET" || strings.LastIndex(req.URL.Path, "/") >= len(path) {
|
|
return false
|
|
}
|
|
|
|
vm := viewmodel.PageList{}
|
|
vm.Setup(user)
|
|
|
|
view.Render(w, "index", 200, vm)
|
|
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
ListController.Function("/", listIndex)
|
|
}
|