62 lines
937 B
Go
62 lines
937 B
Go
package projects
|
|
|
|
import (
|
|
"dofdev/tem"
|
|
"net/http"
|
|
|
|
"github.com/gorilla/mux"
|
|
)
|
|
|
|
type Project struct {
|
|
Name string
|
|
Desc string
|
|
}
|
|
|
|
var Projects = map[string]Project{
|
|
"braille_xr": {
|
|
Name: "braille_xr",
|
|
Desc: "refreshable braille display for rendering and input with handtracking",
|
|
},
|
|
"tungtap": {
|
|
Name: "tungtap",
|
|
Desc: "easily augment your system's keyboard",
|
|
},
|
|
}
|
|
|
|
func Handler(w http.ResponseWriter, r *http.Request) {
|
|
data := struct {
|
|
Projects map[string]Project
|
|
}{
|
|
Projects: Projects,
|
|
}
|
|
tem.Render(
|
|
w, r,
|
|
"projects.html",
|
|
"projects",
|
|
"dof driven projects",
|
|
data,
|
|
)
|
|
}
|
|
|
|
func ProjectHandler(w http.ResponseWriter, r *http.Request) {
|
|
hash := mux.Vars(r)["hash"]
|
|
|
|
project, ok := Projects[hash]
|
|
if !ok {
|
|
w.WriteHeader(http.StatusNotFound)
|
|
return
|
|
}
|
|
|
|
data := struct {
|
|
Project Project
|
|
}{
|
|
Project: project,
|
|
}
|
|
tem.Render(
|
|
w, r,
|
|
"project.html",
|
|
project.Name,
|
|
project.Desc,
|
|
data,
|
|
)
|
|
}
|