diff options
author | Anirudh Oppiliappan <x@icyphox.sh> | 2022-12-17 22:35:48 +0530 |
---|---|---|
committer | Anirudh Oppiliappan <x@icyphox.sh> | 2022-12-17 22:35:48 +0530 |
commit | 3e6a720154b70a9882af14399548e494b1d0089f (patch) | |
tree | 6926af0c380ce3eb303af05d664a78962083d546 /templates/commit.html | |
parent | 5091695e75b2db30b8926d8aa17164c84031bc77 (diff) | |
download | legit-3e6a720154b70a9882af14399548e494b1d0089f.tar.gz legit-3e6a720154b70a9882af14399548e494b1d0089f.tar.bz2 legit-3e6a720154b70a9882af14399548e494b1d0089f.zip |
git, templates: diff view
Diffstat (limited to 'templates/commit.html')
-rw-r--r-- | templates/commit.html | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/templates/commit.html b/templates/commit.html index f7a36b4..b4061aa 100644 --- a/templates/commit.html +++ b/templates/commit.html @@ -9,8 +9,12 @@ <body> {{ template "nav" . }} <main> - <section> - <p>author: {{ .commit.Author.Name }} <{{ .commit.Author.Email}}> on {{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</p> + <section class="commit"> + <pre> + {{- .commit.Message -}} + </pre> + <p>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</p> + <p>{{ .commit.Author.Name }} <span class="commit-email">{{ .commit.Author.Email}}</span></p> <p>commit: <a href="/{{ .name }}/commit/{{ .commit.This }}"> {{ .commit.This }} </a> @@ -19,34 +23,54 @@ {{ .commit.Parent }} </a> </p> - <p>{{ .stat.FilesChanged }} files changed, + <div class="diff-stat"> + <div> + {{ .stat.FilesChanged }} files changed, {{ .stat.Insertions }} insertions(+), {{ .stat.Deletions }} deletions(-) - </p> + </div> + <div> + <br> + <p>jump to:</p> + {{ range .diff }} + <ul> + <li><a href="#{{ .Name.New }}">{{ .Name.New }}</a></li> + </ul> + {{ end }} + </div> + </div> </section> <section> + {{ $repo := .name }} + {{ $this := .commit.This }} {{ range .diff }} + <div class="diff"> + <div id="{{ .Name.New }}"> {{ if .Name.Old }} - <p>{{ .Name.Old }} → {{ .Name.New }}</p> + <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.Old }}">{{ .Name.Old }}</a> → + <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a> {{ else }} - <p>{{.Name.New }}</p> + <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a> {{- end -}} + </div> + <pre> {{- range .TextFragments -}} <p>{{- .Header -}}</p> - {{- range .Lines -}} - {{- if eq .Op.String "+" -}} - <span style="color: green">{{ .String }}</span> - {{- end -}} - {{- if eq .Op.String "-" -}} - <span style="color: red">{{ .String }}</span> - {{- end -}} - {{- if eq .Op.String " " -}} - <span style="color: gray">{{ .String }}</span> - {{- end -}} + {{- range .Lines -}} + {{- if eq .Op.String "+" -}} + <span class="diff-add">{{ .String }}</span> {{- end -}} + {{- if eq .Op.String "-" -}} + <span class="diff-del">{{ .String }}</span> + {{- end -}} + {{- if eq .Op.String " " -}} + <span class="diff-noop">{{ .String }}</span> + {{- end -}} + {{- end -}} {{- end -}} </pre> + </div> {{ end }} </section> </main> |