package moves import ( "dofdev/tem" "net/http" "github.com/gorilla/mux" ) type Move struct { Name string Desc string } var Moves = map[string]Move{ "color_cube": { Name: "color_cube", Desc: "color picker & indexer xyz >>> rgb", }, "oriel": { Name: "oriel", Desc: "volumetric graphical control element", }, "stretch_cursor": { Name: "stretch_cursor", Desc: "spatial control using hand distance", }, "orbital_view": { Name: "orbital_view", Desc: "inversely viewed point of interest", }, "fullstick": { Name: "fullstick", Desc: "joystick with full range of motion", }, } func Handler(w http.ResponseWriter, r *http.Request) { data := struct { Moves map[string]Move }{ Moves: Moves, } tem.Render( w, r, "moves.html", "moves", "dof driven moves", data, ) } func MoveHandler(w http.ResponseWriter, r *http.Request) { hash := mux.Vars(r)["hash"] move, ok := Moves[hash] if !ok { w.WriteHeader(http.StatusNotFound) return } data := struct { Hash string Move Move }{ Hash: hash, Move: move, } tem.Render( w, r, "move.html", move.Name, move.Desc, data, ) }