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 | |
parent | 5091695e75b2db30b8926d8aa17164c84031bc77 (diff) | |
download | legit-3e6a720154b70a9882af14399548e494b1d0089f.tar.gz legit-3e6a720154b70a9882af14399548e494b1d0089f.tar.bz2 legit-3e6a720154b70a9882af14399548e494b1d0089f.zip |
git, templates: diff view
Diffstat (limited to '')
-rw-r--r-- | templates/commit.html | 56 | ||||
-rw-r--r-- | templates/log.html | 4 | ||||
-rw-r--r-- | templates/repo.html | 2 |
3 files changed, 43 insertions, 19 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> diff --git a/templates/log.html b/templates/log.html index c4ee9c3..4a0292c 100644 --- a/templates/log.html +++ b/templates/log.html @@ -9,7 +9,7 @@ <body> {{ template "nav" . }} <main> - {{ $repo := .repo }} + {{ $repo := .name }} <div class="log"> {{ range .commits }} <div> @@ -17,7 +17,7 @@ <div>{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div> <pre>{{ .Message }}</pre> </div> - <div class="commit-info">{{ .Author.Name }} <span style="color: var(--gray);">{{ .Author.Email }}</span></div> + <div class="commit-info">{{ .Author.Name }} <span class="commit-email">{{ .Author.Email }}</span></div> {{ end }} </div> </main> diff --git a/templates/repo.html b/templates/repo.html index d4e3e46..3b5d2b0 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -25,7 +25,7 @@ <div>{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div> <pre>{{ .Message }}</pre> </div> - <div class="commit-info">{{ .Author.Name }} <span style="color: var(--gray);">{{ .Author.Email }}</span></div> + <div class="commit-info">{{ .Author.Name }} <span class="commit-email">{{ .Author.Email }}</span></div> {{ end }} </div> <article class="readme"> |