#205 add footer. closes #205

This commit is contained in:
Shawn Smith
2017-09-20 15:32:40 +09:00
parent a37c379aa9
commit e565019669
11 changed files with 30 additions and 95 deletions

View File

@@ -10,7 +10,7 @@ import (
func AboutHandler(w http.ResponseWriter, r *http.Request) {
log.Println("Serving about page")
t := template.Must(template.New("about.html").Delims("[[", "]]").ParseFiles("templates/about.html"))
t := template.Must(template.New("about.html").Delims("[[", "]]").ParseFiles("templates/about.html", "templates/footer.html"))
t.Execute(w, map[string]interface{}{
"google_analytics_key": googleAnalyticsKey,
})

View File

@@ -8,7 +8,7 @@ import (
func errorHandler(w http.ResponseWriter, r *http.Request, status int) {
w.WriteHeader(status)
if status == http.StatusNotFound {
t := template.Must(template.New("404.html").ParseFiles("templates/404.html"))
t := template.Must(template.New("404.html").ParseFiles("templates/404.html", "templates/footer.html"))
t.Execute(w, nil)
}
}

View File

@@ -72,7 +72,7 @@ func HighScoresHandler(w http.ResponseWriter, r *http.Request) {
}
funcs := template.FuncMap{"add": add, "formatScore": formatScore}
t := template.Must(template.New("high_scores.html").Delims("[[", "]]").Funcs(funcs).ParseFiles("templates/high_scores.html"))
t := template.Must(template.New("high_scores.html").Delims("[[", "]]").Funcs(funcs).ParseFiles("templates/high_scores.html", "templates/footer.html"))
sortedScores := make([]scoreItem, len(*scores))
for i := range sortedScores {

View File

@@ -48,7 +48,7 @@ func HomeHandler(w http.ResponseWriter, r *http.Request) {
j--
}
t := template.Must(template.New("home.html").Delims("[[", "]]").ParseFiles("templates/home.html"))
t := template.Must(template.New("home.html").Delims("[[", "]]").ParseFiles("templates/home.html", "templates/footer.html"))
t.Execute(w, map[string]interface{}{
"Recent": recentRepos,
"google_analytics_key": googleAnalyticsKey,

View File

@@ -15,7 +15,7 @@ var googleAnalyticsKey = flag.String("google_analytics_key", "UA-58936835-1", "G
// ReportHandler handles the report page
func ReportHandler(w http.ResponseWriter, r *http.Request, repo string, dev bool) {
log.Printf("Displaying report: %q", repo)
t := template.Must(template.New("report.html").Delims("[[", "]]").ParseFiles("templates/report.html"))
t := template.Must(template.New("report.html").Delims("[[", "]]").ParseFiles("templates/report.html", "templates/footer.html"))
resp, err := getFromCache(repo)
needToLoad := false
if err != nil {

View File

@@ -67,24 +67,7 @@
</div>
</div>
</section>
<footer class="footer">
<div class="container">
<div class="content has-text-centered">
<p>
<strong>Go Report Card</strong> by
<a href="https://twitter.com/shawnps">Shawn Smith</a> and
<a href="https://twitter.com/ironzeb">Herman Schaaf</a>.
</p>
<p>Sponsored by:</p>
<p>
<a href="https://www.signalsciences.com">
<img width="15%" src="/assets/signalsciences.png">
</a>
</p>
<p>Protect your most critical web applications, APIs, and microservices.</p>
</div>
</div>
</footer>
[[ template "footer" . ]]
<style>
#gopherimage {
width: 200px;

View File

@@ -64,23 +64,6 @@
<p>Go Report Card relies on the excellent <a href="https://github.com/alecthomas/gometalinter">Go Meta Linter</a> tool.</p>
</div>
</section>
<footer class="footer">
<div class="container">
<div class="content has-text-centered">
<p>
<strong>Go Report Card</strong> by
<a href="https://twitter.com/shawnps">Shawn Smith</a> and
<a href="https://twitter.com/ironzeb">Herman Schaaf</a>.
</p>
<p>Sponsored by:</p>
<p>
<a href="https://www.signalsciences.com">
<img width="15%" src="/assets/signalsciences.png">
</a>
</p>
<p>Protect your most critical web applications, APIs, and microservices.</p>
</div>
</div>
</footer>
[[ template "footer" . ]]
</body>
</html>

20
templates/footer.html Normal file
View File

@@ -0,0 +1,20 @@
[[ define "footer" ]]
<footer class="footer">
<div class="container">
<div class="content has-text-centered">
<p>
<strong>Go Report Card</strong> by
<a href="https://twitter.com/shawnps">Shawn Smith</a> and
<a href="https://twitter.com/ironzeb">Herman Schaaf</a>.
</p>
<p>Sponsored by:</p>
<p>
<a href="https://www.signalsciences.com">
<img width="15%" src="/assets/signalsciences.png">
</a>
</p>
<p>Protect your most critical web applications, APIs, and microservices.</p>
</div>
</div>
</footer>
[[ end ]]

View File

@@ -82,23 +82,6 @@
</p>
</div>
</section>
<footer class="footer">
<div class="container">
<div class="content has-text-centered">
<p>
<strong>Go Report Card</strong> by
<a href="https://twitter.com/shawnps">Shawn Smith</a> and
<a href="https://twitter.com/ironzeb">Herman Schaaf</a>.
</p>
<p>Sponsored by:</p>
<p>
<a href="https://www.signalsciences.com">
<img width="15%" src="/assets/signalsciences.png">
</a>
</p>
<p>Protect your most critical web applications, APIs, and microservices.</p>
</div>
</div>
</footer>
[[ template "footer" . ]]
</body>
</html>

View File

@@ -138,24 +138,7 @@
</div>
</section>
<footer class="footer">
<div class="container">
<div class="content has-text-centered">
<p>
<strong>Go Report Card</strong> by
<a href="https://twitter.com/shawnps">Shawn Smith</a> and
<a href="https://twitter.com/ironzeb">Herman Schaaf</a>.
</p>
<p>Sponsored by:</p>
<p>
<a href="https://www.signalsciences.com">
<img width="15%" src="/assets/signalsciences.png">
</a>
</p>
<p>Protect your most critical web applications, APIs, and microservices.</p>
</div>
</div>
</footer>
[[ template "footer" . ]]
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.js"></script>

View File

@@ -87,24 +87,7 @@
</div>
</section>
<footer class="footer">
<div class="container">
<div class="content has-text-centered">
<p>
<strong>Go Report Card</strong> by
<a href="https://twitter.com/shawnps">Shawn Smith</a> and
<a href="https://twitter.com/ironzeb">Herman Schaaf</a>.
</p>
<p>Sponsored by:</p>
<p>
<a href="https://www.signalsciences.com">
<img width="15%" src="/assets/signalsciences.png">
</a>
</p>
<p>Protect your most critical web applications, APIs, and microservices.</p>
</div>
</div>
</footer>
[[ template "footer" . ]]
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.js"></script>