mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-29 06:49:05 +08:00
@@ -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,
|
||||
})
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
20
templates/footer.html
Normal 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 ]]
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user