Author: Honza Pokorny <me@honza.ca>
Add a header to the commit page
include/commit.html | 23 +++++++++++++++++++++++ pkg/smithy/smithy.go | 6 +++---
diff --git a/include/commit.html b/include/commit.html index 1bfbd142023b127d5582fb43347aac5d1a7b649d..8a58cc0ca458e30ed13b3f218e1cd3ec4535d18e 100644 --- a/include/commit.html +++ b/include/commit.html @@ -1,5 +1,28 @@ {{ template "header" }} +{{ $repo := .Name }} + +<h1>{{ .Name }}</h1> + +<nav class="navbar navbar-expand navbar-light bg-light"> + <div class="collapse navbar-collapse" id="navbarNav"> + <ul class="navbar-nav"> + <li class="nav-item"> + <a class="nav-link" href="/{{ $repo }}">About</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="/{{ $repo }}/refs">Refs</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="/{{ $repo }}/log">Log</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="/{{ $repo }}/tree">Tree</a> + </li> + </ul> + </div> +</nav> + <h1>{{ .RepoName }}</h1> <h2>commit {{ .Commit.Hash }}</h2> diff --git a/pkg/smithy/smithy.go b/pkg/smithy/smithy.go index c7af2fdd52e5315ff3890144622db89628c24e08..58d5441bff63dfdbc0c7909c60d5f065cf594c6c 100644 --- a/pkg/smithy/smithy.go +++ b/pkg/smithy/smithy.go @@ -596,9 +596,9 @@ return } ctx.HTML(http.StatusOK, "commit.html", gin.H{ - "RepoName": repoName, - "Commit": commitObj, - "Changes": template.HTML(formattedChanges), + "Name": repoName, + "Commit": commitObj, + "Changes": template.HTML(formattedChanges), }) }