Integrate Bootstrap CSS

This commit is contained in:
Alex 2020-02-09 16:19:55 +01:00
parent e72034c430
commit 3fe43f85ae
5 changed files with 18 additions and 3 deletions

View file

@ -4,7 +4,6 @@ import (
"os" "os"
"strings" "strings"
"flag" "flag"
"fmt"
"log" "log"
"net/http" "net/http"
"io/ioutil" "io/ioutil"
@ -156,6 +155,7 @@ type LoginFormData struct {
var ( var (
templateLogin = template.Must(template.ParseFiles("templates/layout.html", "templates/login.html")) templateLogin = template.Must(template.ParseFiles("templates/layout.html", "templates/login.html"))
templateHome = template.Must(template.ParseFiles("templates/layout.html", "templates/home.html"))
) )
// Page handlers ---- // Page handlers ----
@ -166,7 +166,7 @@ func handleHome(w http.ResponseWriter, r *http.Request) {
return return
} }
fmt.Fprintf(w, "Welcome, %s!", login.Username) templateHome.Execute(w, login)
} }
func handleLogin(w http.ResponseWriter, r *http.Request) *LoginInfo { func handleLogin(w http.ResponseWriter, r *http.Request) *LoginInfo {

7
static/css/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

7
templates/home.html Normal file
View file

@ -0,0 +1,7 @@
{{define "title"}}Guichet{{end}}
{{define "body"}}
<h1>Guichet</h1>
Welcome, {{ .Username }}!
{{end}}

View file

@ -3,7 +3,8 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>{{template "title"}}</title> <title>{{template "title"}}</title>
<link rel="stylesheet" href="/static/style.css"> <link rel="stylesheet" href="/static/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/css/main.css">
</head> </head>
<body> <body>
<div id="contents"> <div id="contents">