Implemented hub
This commit is contained in:
@ -29,7 +29,7 @@ func Login(db *data.DB) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
template.Must(template.ParseFiles("web/templates/editor.html")).ExecuteTemplate(w, "page-content", nil)
|
||||
template.Must(template.ParseFiles("web/templates/hub.html")).ExecuteTemplate(w, "page-content", nil)
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,13 +54,7 @@ func FinishEdit(feed *data.Feed) http.HandlerFunc {
|
||||
})
|
||||
feed.Save("tmp/rss.gob")
|
||||
|
||||
rss, err := feed.ToRss()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
template.Must(template.ParseFiles("web/templates/feed.rss")).ExecuteTemplate(w, "page-content", rss)
|
||||
template.Must(template.ParseFiles("web/templates/hub.html")).ExecuteTemplate(w, "page-content", nil)
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,6 +118,30 @@ func AddUser(db *data.DB) http.HandlerFunc {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
template.Must(template.ParseFiles("web/templates/editor.html")).Execute(w, nil)
|
||||
template.Must(template.ParseFiles("web/templates/hub.html")).ExecuteTemplate(w, "page-content", nil)
|
||||
}
|
||||
}
|
||||
|
||||
func WriteArticle() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
template.Must(template.ParseFiles("web/templates/editor.html")).ExecuteTemplate(w, "page-content", nil)
|
||||
}
|
||||
}
|
||||
|
||||
func ShowRSS(feed *data.Feed) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
rss, err := feed.ToRss()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
template.Must(template.ParseFiles("web/templates/index.html", "web/templates/feed.rss")).Execute(w, rss)
|
||||
}
|
||||
}
|
||||
|
||||
func CreateUser() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
template.Must(template.ParseFiles("web/templates/add-user.html")).ExecuteTemplate(w, "page-content", nil)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user