This commit is contained in:
Dan Ballard 2015-05-21 22:59:28 -07:00
parent ff9c3e7f77
commit d8c7ec2295
3 changed files with 11 additions and 0 deletions

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -15,6 +15,7 @@ import (
"github.com/dballard/transmet/news" "github.com/dballard/transmet/news"
"bytes" "bytes"
txtTemplate "text/template" txtTemplate "text/template"
"path"
) )
func GetFlashes(session *sessions.Session) map[string]interface{} { func GetFlashes(session *sessions.Session) map[string]interface{} {
@ -250,10 +251,18 @@ func addedHandler(w http.ResponseWriter, r *http.Request, user *user.User) {
ShowTemplate("added", w, map[string]interface{}{"user": user, "flashes": flashes}) ShowTemplate("added", w, map[string]interface{}{"user": user, "flashes": flashes})
} }
func ServeFileHandler(res http.ResponseWriter, req *http.Request) {
fname := path.Base(req.URL.Path)
http.ServeFile(res, req, "./"+fname)
}
func init_route_handlers() { func init_route_handlers() {
http.Handle("/js/", http.StripPrefix("/js/", http.FileServer(http.Dir("js/")))) http.Handle("/js/", http.StripPrefix("/js/", http.FileServer(http.Dir("js/"))))
http.Handle("/css/", http.StripPrefix("/css/", http.FileServer(http.Dir("css/")))) http.Handle("/css/", http.StripPrefix("/css/", http.FileServer(http.Dir("css/"))))
http.Handle("/fonts/", http.StripPrefix("/fonts", http.FileServer(http.Dir("fonts/")))) http.Handle("/fonts/", http.StripPrefix("/fonts", http.FileServer(http.Dir("fonts/"))))
http.HandleFunc("/favicon.ico", ServeFileHandler)
r := mux.NewRouter() r := mux.NewRouter()

View File

@ -12,6 +12,8 @@
<link href="/css/jquery-ui.min.css" rel="stylesheet"> <link href="/css/jquery-ui.min.css" rel="stylesheet">
<link href="/css/template.css" rel="stylesheet"> <link href="/css/template.css" rel="stylesheet">
<link href="/css/signin.css" rel="stylesheet"> <link href="/css/signin.css" rel="stylesheet">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
</head> </head>
<body> <body>