~huyngo/yue

b50ae276f4fe44a2ffdb8bfe33dbec379b126ab2 — Huy Ngo 9 months ago 45342cb
Add about page to footer
5 files changed, 13 insertions(+), 3 deletions(-)

M auth.go
M main.go
M static.go
M templates/base.tmpl
M timeline.go
M auth.go => auth.go +1 -1
@@ 41,7 41,7 @@ func LoginPage(w http.ResponseWriter, r *http.Request) {

	title := "Log In"
	description := "Login page"
	err = tmpl.Execute(w, CreateRequestContext("", title, description, "system"))
	err = tmpl.Execute(w, CreateRequestContext("", title, description, "system", nil))
	if err != nil {
		log.Println(err.Error())
		http.Error(w, "Internal Server Error", 500)

M main.go => main.go +2 -0
@@ 19,6 19,7 @@
package main

import (
	"fmt"
	"net/http"

	"github.com/gorilla/mux"


@@ 43,6 44,7 @@ func main() {

	// Timelines
	r.HandleFunc("/", HomeTimeline)
	fmt.Println("Serving on http://localhost:8080")

	http.ListenAndServe(":8080", r)
}

M static.go => static.go +3 -1
@@ 39,7 39,9 @@ func genericStaticPage(w http.ResponseWriter, r *http.Request, page string) {
		return
	}

	err = tmpl.Execute(w, nil)
	title := page
	description := page + " page"
	err = tmpl.Execute(w, CreateRequestContext("", title, description, "system", nil))
	if err != nil {
		log.Println(err.Error())
		http.Error(w, "Internal Server Error", 500)

M templates/base.tmpl => templates/base.tmpl +6 -0
@@ 45,6 45,12 @@
            GNU Affero General Public License version 3.</a>
          Current version: {{ .Yue.Version }}
        </p>
        <p>
          See:
          <ul>
            <li><a href="/about">About page</a></li>
          </ul>
        </p>
      </footer>
    </div>
  </body>

M timeline.go => timeline.go +1 -1
@@ 41,7 41,7 @@ func HomeTimeline(w http.ResponseWriter, r *http.Request) {

	title := "Home"
	description := "Home timeline"
	err = tmpl.Execute(w, CreateRequestContext("", title, description, "system"))
	err = tmpl.Execute(w, CreateRequestContext("", title, description, "system", nil))
	if err != nil {
		log.Println(err.Error())
		http.Error(w, "Internal Server Error", 500)