package handlers
import (
"html/template"
"net/http"
)
func (h *Handlers) ServeShowForm(w http.ResponseWriter, r *http.Request) {
tmpl, err := template.ParseGlob("components/*.html")
if err != nil {
abortWithError(w, err.Error())
return
}
tmpl.ExecuteTemplate(w, "actionform", nil)
}
func (h *Handlers) ServeHideForm(w http.ResponseWriter, r *http.Request) {
tmpl, err := template.ParseGlob("components/*.html")
if err != nil {
abortWithError(w, err.Error())
return
}
tmpl.ExecuteTemplate(w, "showformbtn", nil)
}
func (h *Handlers) ShowRecommended(w http.ResponseWriter, r *http.Request) {
var username string
// TODO: getusername
// TODO: get recommendations for user
acts, err := h.fetchRecommendations(username, 5)
if err != nil {
abortWithError(w, err.Error())
return
}
h.log.Debug("got actions", "acts#", len(acts))
tmpl, err := template.ParseGlob("components/*.html")
if err != nil {
abortWithError(w, err.Error())
return
}
tmpl.ExecuteTemplate(w, "showformbtn", nil)
}
func (h *Handlers) HideRecommended(w http.ResponseWriter, r *http.Request) {
tmpl, err := template.ParseGlob("components/*.html")
if err != nil {
abortWithError(w, err.Error())
return
}
tmpl.ExecuteTemplate(w, "showformbtn", nil)
}