Add about page
This commit is contained in:
parent
beb032eddb
commit
f1eab1bebc
4 changed files with 16 additions and 1 deletions
9
about.html
Normal file
9
about.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{template "header.html"}}
|
||||
|
||||
<p>The <strong>Imperial Library of Trantor</strong> (also known as <em>Galactic Library</em>) is a repository of ebooks on ePub format.</p>
|
||||
|
||||
<p>You can <a href="/upload/">upload</a> your books. And one of our librarians will take care to store them on our bast bookshelfs and make it avaliable for the rest of the galaxy.</p>
|
||||
|
||||
<p>We like to pay the authors, but not the corporations that make profit from them. We won't listen to any content remove request from corporations, editorials, right management organizations or any other blood-shuckers.<p>
|
||||
|
||||
{{template "footer.html"}}
|
|
@ -3,3 +3,4 @@
|
|||
<title>Imperial Library of Trantor</title>
|
||||
</head>
|
||||
<body>
|
||||
<a href="/">Index</a> || <a href="/about/">About</a> || <a href="/upload/">Upload your epub</a>
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
func loadTemplate(w http.ResponseWriter, tmpl string, data interface{}) {
|
||||
// TODO: when finish devel conver to global:
|
||||
var templates = template.Must(template.ParseFiles("header.html", "footer.html", "index.html", "book.html", "search.html", "upload.html"))
|
||||
var templates = template.Must(template.ParseFiles("header.html", "footer.html", "index.html", "about.html", "book.html", "search.html", "upload.html"))
|
||||
|
||||
err := templates.ExecuteTemplate(w, tmpl+".html", data)
|
||||
if err != nil {
|
||||
|
|
|
@ -12,6 +12,10 @@ const (
|
|||
BOOKS_COLL = "books"
|
||||
)
|
||||
|
||||
func aboutHandler(w http.ResponseWriter, r *http.Request) {
|
||||
loadTemplate(w, "about", nil)
|
||||
}
|
||||
|
||||
func bookHandler(coll *mgo.Collection, w http.ResponseWriter, r *http.Request) {
|
||||
var book Book
|
||||
coll.Find(bson.M{"title": r.URL.Path[len("/book/"):]}).One(&book)
|
||||
|
@ -36,6 +40,7 @@ func main() {
|
|||
http.HandleFunc("/book/", func(w http.ResponseWriter, r *http.Request) { bookHandler(coll, w, r) })
|
||||
http.HandleFunc("/search/", func(w http.ResponseWriter, r *http.Request) { searchHandler(coll, w, r) })
|
||||
http.HandleFunc("/upload/", func(w http.ResponseWriter, r *http.Request) { uploadHandler(coll, w, r) })
|
||||
http.HandleFunc("/about/", aboutHandler)
|
||||
fileHandler("/img/")
|
||||
fileHandler("/cover/")
|
||||
fileHandler("/books/")
|
||||
|
|
Reference in a new issue