M Makefile => Makefile +1 -1
@@ 1,4 1,4 @@
-VERSION?=`hg log -r . -T "{latesttag}{sub('^-0-.*', '', '-{latesttagdistance}-{node|short}')}" || echo 0.1.0`
+VERSION?=`git describe 2>/dev/null || git rev-parse --short HEAD`
GO?=go
GOFLAGS?=
LDFLAGS+=-X main.Version=$(VERSION)
M input.go => input.go +3 -0
@@ 76,6 76,9 @@ func (l *LoginForm) Validate(c echo.Context) error {
var RepoTypes = []string{
"git",
"hg",
+ "bzr",
+ "fossil",
+ "svn",
}
// RepoForm ...
M routes.go => routes.go +7 -3
@@ 24,6 24,7 @@ type Service struct {
}
func (s *Service) RegisterRoutes() {
+ s.eg.Use(RepoMiddleware)
s.eg.GET("/--admin--/set-password", s.SetPassword).Name = s.RouteName("set_password")
s.eg.POST("/--admin--/set-password", s.SetPassword).Name = s.RouteName("set_password_post")
s.eg.GET("/--admin--/login", s.Login).Name = s.RouteName("login")
@@ 234,7 235,7 @@ func GetRepoFromPath(c echo.Context, path string) error {
repo *Repo
rname string
)
- for i := 0; i < 3; i++ {
+ for i := 0; i < len(parts); i++ {
// XXX Is this even needed? Should it just be the first value (parts[0])?
rname = strings.Join(parts[:i+1], "/")
opts := &database.FilterOptions{
@@ 268,11 269,14 @@ func GetRepoFromPath(c echo.Context, path string) error {
}
rdomain := fmt.Sprintf("%s%s", gctx.Server.Config.Domain, fpath)
return c.HTML(http.StatusOK,
- fmt.Sprintf(`<meta name="go-import" content="%s %s %s" />`,
+ fmt.Sprintf(`<html><head><meta name="go-import" content="%s %s %s" /></head></html>`,
rdomain, repo.RepoType, repo.RepoURL),
)
}
- gmap := gobwebs.Map{"repo": repo}
+ gmap := gobwebs.Map{
+ "repo": repo,
+ "hideNav": true,
+ }
return gctx.Render(http.StatusOK, "repo_detail.html", gmap)
}
A templates/repo_detail.html => templates/repo_detail.html +36 -0
@@ 0,0 1,36 @@
+{{template "base" .}}
+<section class="app-header">
+ <h1 class="app-header__title">{{.repo.Name}} ({{ .repo.RepoName }})</h1>
+</section>
+
+<div class="row">
+ <div class="col-12">
+ <section class="card shadow-card vertical-section">
+ <header>
+ <h2>Description:</h2>
+ </header>
+ <p>{{ .repo.Description }}</p>
+ </section>
+ </div>
+</div>
+<div class="row">
+ <div class="col-6">
+ <section class="card shadow-card">
+ <header>
+ <h2>Details:</h2>
+ </header>
+ <p><strong>Repo URL:</strong><br /><a href="{{ .repo.RepoURL }}">{{ .repo.RepoURL }}</a> ({{ .repo.RepoType }})</p>
+ <p><strong>Repo Homepage:</strong><br />{{ if .repo.Homepage }}<a href="{{ .repo.Homepage }}">{{ .repo.Homepage }}</a>{{ else }}N/A{{ end }}</p>
+ </section>
+ </div>
+ <div class="col-6">
+ <section class="card shadow-card">
+ <header>
+ <h2>Extras:</h2>
+ </header>
+ <p><strong>Issue Tracker:</strong><br />{{ if .repo.IssuesURL }}<a href="{{ .repo.IssuesURL }}">{{ .repo.IssuesURL }}</a>{{ else }}N/A{{ end }}</p>
+ <p><strong>Mailing List:</strong><br />{{ if .repo.MailURL }}<a href="{{ .repo.MailURL }}">{{ .repo.MailURL }}</a>{{ else }}N/A{{ end }}</p>
+ </section>
+ </div>
+</div>
+{{template "base_footer" .}}