gtx


Branch: develop

Author
Sotiri Bakagiannis <thewhodidthis@users.noreply.github.com>
Date
Feb. 19 '23 12:33:02
Commit
f34c8f16308709273dcaa9028564323a4578055a
Parent
d5144e2f0226241d631228678375fbaf836454c1
Changes
diff --git a/page.html.tmpl b/page.html.tmpl
index c158464..7432af7 100644
--- a/page.html.tmpl
+++ b/page.html.tmpl
@@ -29,9 +29,6 @@
   <body>
     <header>
       <h1><a href="./">{{with .Data.Project}}{{.}}{{else}}Home{{end}}</a></h1>
-      {{- range .Data.Breadcrumbs}}
-        <span>{{.}}</span>
-      {{- end}}
     </header>
     <main>
       <hr>
@@ -174,7 +171,22 @@
       {{- end }}
       <hr>
       <nav>
-        <p>Your are here: {{.Title}}</p>
+        <p>
+        {{- if .Data.Branches}}
+          You are home
+        {{- else}}
+          You are here:
+          <a href="./">home</a>
+          {{- with .Data.Path}}
+            {{- with .Branch}}: <a href="branch/{{.}}/">{{.}}</a>{{- end}}
+            {{- with .Commit}}: <a href="commit/{{.}}/">{{printf "%.7s" .}}</a>{{- end}}
+          {{- end}}
+          {{- with .Data.Branch}}: <span>{{.Name}}</span>{{- end}}
+          {{- with .Data.Commit}}: <span>{{.Abbr}}</span>{{- end}}
+          {{- with .Data.Object}}: <span>{{.Path}}</span>{{- end}}
+          {{- with .Data.Diff.Commit}}: <span>{{.Abbr}}</span>{{- end}}
+        {{- end}}
+        </p>
       </nav>
       <hr>
     </main>
diff --git a/project.go b/project.go
index e15f141..d89bab9 100644
--- a/project.go
+++ b/project.go
@@ -146,12 +146,12 @@ func (p *project) writeMainIndex(branches []branch) {
 	}
 
 	page := page{
+		Base: "./",
 		Data: Data{
 			"Branches": branches,
 			"Source":   p.options.Source,
 			"Project":  p.Name,
 		},
-		Base:  "./",
 		Title: p.Name,
 	}
 
@@ -184,15 +184,19 @@ func (p *project) writeCommitDiff(base string, b branch, c commit, par string) {
 	}
 
 	page := page{
+		Base: "../../",
 		Data: Data{
 			"Diff": diff{
 				Body:   fmt.Sprintf("%s", out),
 				Commit: c,
 				Parent: par,
 			},
+			"Path": Data{
+				"Branch": b.Name,
+				"Commit": par,
+			},
 			"Project": p.Name,
 		},
-		Base:  "../../",
 		Title: strings.Join([]string{p.Name, b.Name, c.Abbr}, ": "),
 	}
 
@@ -226,12 +230,12 @@ func (p *project) writeBranchPage(b branch) {
 	}
 
 	page := page{
+		Base: "../../",
 		Data: Data{
 			"Commits": b.Commits,
 			"Branch":  b,
 			"Project": p.Name,
 		},
-		Base:  "../../",
 		Title: strings.Join([]string{p.Name, b.Name}, ": "),
 	}
 
@@ -334,11 +338,15 @@ func (p *project) writeObject(dst string, obj object, base string, b branch, c c
 	}
 
 	page := page{
+		Base: "../../",
 		Data: Data{
 			"Object":  *o,
+			"Path": Data{
+				"Branch": b.Name,
+				"Commit": c.Hash,
+			},
 			"Project": p.Name,
 		},
-		Base:  "../../",
 		Title: strings.Join([]string{p.Name, b.Name, c.Abbr, obj.Path}, ": "),
 	}
 
@@ -379,11 +387,14 @@ func (p *project) writeCommitPage(base string, b branch, c commit) {
 	}
 
 	page := page{
+		Base: "../../",
 		Data: Data{
 			"Commit":  c,
+			"Path": Data{
+				"Branch": b.Name,
+			},
 			"Project": p.Name,
 		},
-		Base:  "../../",
 		Title: strings.Join([]string{p.Name, b.Name, c.Abbr}, ": "),
 	}