diff --git a/template.go b/template.go index 1e13776..6d5da0e 100644 --- a/template.go +++ b/template.go @@ -13,6 +13,7 @@ type Status struct { About bool Upload bool Stats bool + Help bool } func GetStatus(w http.ResponseWriter, r *http.Request) Status { @@ -37,6 +38,7 @@ var templates = template.Must(template.ParseFiles(TEMPLATE_PATH+"header.html", TEMPLATE_PATH+"edit.html", TEMPLATE_PATH+"settings.html", TEMPLATE_PATH+"stats.html", + TEMPLATE_PATH+"help.html", )) func loadTemplate(w http.ResponseWriter, tmpl string, data interface{}) { diff --git a/templates/header.html b/templates/header.html index eaab6bb..d46e17e 100644 --- a/templates/header.html +++ b/templates/header.html @@ -78,6 +78,9 @@ + diff --git a/templates/help.html b/templates/help.html new file mode 100644 index 0000000..3400d9d --- /dev/null +++ b/templates/help.html @@ -0,0 +1,19 @@ +{{template "header.html" .S}} + +

Advanced Search

+

It is possible to search for books in an specific language adding lang:code to the search string. See for example some searches: +

+

+ +

There is other topics than lang that can be used: +

+

+ +{{template "footer.html"}} diff --git a/trantor.go b/trantor.go index e2b6ed5..04c2d5b 100644 --- a/trantor.go +++ b/trantor.go @@ -9,17 +9,24 @@ import ( "strings" ) -type aboutData struct { +type statusData struct { S Status } func aboutHandler(w http.ResponseWriter, r *http.Request, sess *Session) { - var data aboutData + var data statusData data.S = GetStatus(w, r) data.S.About = true loadTemplate(w, "about", data) } +func helpHandler(w http.ResponseWriter, r *http.Request, sess *Session) { + var data statusData + data.S = GetStatus(w, r) + data.S.Help = true + loadTemplate(w, "help", data) +} + func logoutHandler(w http.ResponseWriter, r *http.Request, sess *Session) { sess.LogOut() sess.Notify("Log out!", "Bye bye "+sess.User, "success") @@ -168,6 +175,7 @@ func setUpRouter() { r.HandleFunc("/edit/{id:[0-9a-fA-F]+}", GatherStats(editHandler)) r.HandleFunc("/save/{id:[0-9a-fA-F]+}", GatherStats(saveHandler)).Methods("POST") r.HandleFunc("/about/", GatherStats(aboutHandler)) + r.HandleFunc("/help/", GatherStats(helpHandler)) r.HandleFunc("/download/{id:[0-9a-fA-F]+}/{epub:.*}", GatherStats(downloadHandler)) r.HandleFunc("/cover/{id:[0-9a-fA-F]+}/{size}/{img:.*}", coverHandler) r.HandleFunc("/settings/", GatherStats(settingsHandler))