2023-03-14 15:22:52 +00:00
{{ template "header" .}}
{{ template "gist_header" .}}
{{ if ne (len .commits) 0 }}
< div >
{{ range $commit := .commits }}
< div class = "pb-8" >
< div class = "flex" >
2023-03-20 12:30:25 +00:00
< h3 class = "text-sm py-2 flex-auto" >
< svg xmlns = "http://www.w3.org/2000/svg" class = "h-3 w-3 mr-1 inline" fill = "none" viewBox = "0 0 24 24" stroke = "currentColor" stroke-width = "2" >
< path stroke-linecap = "round" stroke-linejoin = "round" d = "M13 5l7 7-7 7M5 5l7 7-7 7" / >
< / svg >
2023-05-26 07:15:37 +00:00
{{ $user := (index $.emails $commit.AuthorEmail) }}
2023-09-06 21:36:44 +00:00
< img class = "h-5 w-5 rounded-full inline" src = "{{if $user }}{{ avatarUrl $user $.DisableGravatar }}{{else}}{{defaultAvatar}}{{end}}" { { if $ user } } alt = "{{ $user.Username }}'s Avatar" { { end } } / >
2023-09-22 15:26:09 +00:00
< span class = "font-bold" > {{if $user}}< a href = "{{ $.c.ExternalUrl }}/{{$user.Username}}" class = "text-slate-300 hover:text-slate-300 hover:underline" > {{ $commit.AuthorName }}< / a > {{else}}{{ $commit.AuthorName }}{{end}}< / span > {{ $.locale.Tr "gist.revision.revised" }} < span class = "moment-timestamp font-bold" > {{ $commit.Timestamp }}< / span > . < a href = "{{ $.c.ExternalUrl }}/{{ $.gist.User.Username }}/{{ $.gist.Uuid }}/rev/{{ $commit.Hash }}" > {{ $.locale.Tr "gist.revision.go-to-revision" }}< / a > < / h3 >
2023-03-14 15:22:52 +00:00
{{ if ne $commit.Changed "" }}
< p class = "text-sm float-right py-2" >
< svg xmlns = "http://www.w3.org/2000/svg" fill = "none" viewBox = "0 0 24 24" stroke-width = "1.5" stroke = "currentColor" class = "w-5 h-5 inline-flex" >
< path stroke-linecap = "round" stroke-linejoin = "round" d = "M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z" / >
< / svg >
{{ $commit.Changed }}
{{ end }}
< / p >
< / div >
< div class = "grid gap-y-4" >
{{ if ne (len $commit.Files) 0 }}
{{ range $file := $commit.Files }}
2023-05-27 11:58:08 +00:00
< div class = "rounded-md border border-1 border-gray-200 dark:border-gray-700 overflow-auto" >
< div class = "border-b-1 border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 my-auto" >
2023-03-14 15:22:52 +00:00
< p class = "ml-4 mt-2 inline-flex" >
2023-05-27 11:58:08 +00:00
< svg xmlns = "http://www.w3.org/2000/svg" class = "h-5 w-5 flex text-slate-700 dark:text-slate-300" fill = "none" viewBox = "0 0 24 24" stroke = "currentColor" stroke-width = "2" >
2023-03-14 15:22:52 +00:00
< path stroke-linecap = "round" stroke-linejoin = "round" d = "M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" / >
< / svg >
2023-03-18 22:18:20 +00:00
{{ if $file.IsCreated }}
2023-09-22 15:26:09 +00:00
< span class = "flex text-sm ml-2 text-slate-700 dark:text-slate-300" > {{ $file.Filename }}< span class = "italic text-gray-600 dark:text-gray-400 ml-1" > ({{ $.locale.Tr "gist.revision.file-created" }})< / span > < / span >
2023-03-18 22:18:20 +00:00
{{ else if $file.IsDeleted }}
2023-09-22 15:26:09 +00:00
< span class = "flex text-sm ml-2 text-slate-700 dark:text-slate-300" > {{ $file.Filename }} < span class = "italic text-gray-600 dark:text-gray-400 ml-1" > ({{ $.locale.Tr "gist.revision.file-deleted" }})< / span > < / span >
2023-03-18 22:18:20 +00:00
{{ else if ne $file.OldFilename "" }}
2023-09-22 15:26:09 +00:00
< span class = "flex text-sm ml-2 text-slate-700 dark:text-slate-300" > {{ $file.OldFilename }} < span class = "italic text-gray-600 dark:text-gray-400 mx-1" > {{ $.locale.Tr "gist.revision.file-renamed" }}< / span > {{ $file.Filename }}< / span >
2023-03-14 15:22:52 +00:00
{{ else }}
2023-05-27 11:58:08 +00:00
< span class = "flex text-sm ml-2 text-slate-700 dark:text-slate-300" > {{ $file.Filename }}< / span >
2023-03-14 15:22:52 +00:00
{{ end }}
< / p >
< / div >
2023-03-23 02:12:21 +00:00
< div class = "overflow-auto" >
2023-03-18 22:53:05 +00:00
{{ if $file.Truncated }}
2023-09-29 04:32:09 +00:00
< p class = "m-2 ml-4 text-sm" > {{ $.locale.Tr "gist.revision.diff-truncated" }}< / p >
2023-03-18 22:53:05 +00:00
{{ else if and (eq $file.Content "") (ne $file.OldFilename "") }}
2023-09-29 04:32:09 +00:00
< p class = "m-2 ml-4 text-sm" > {{ $.locale.Tr "gist.revision.file-renamed-no-changes" }}< / p >
2023-03-18 22:18:20 +00:00
{{ else if eq $file.Content "" }}
2023-09-29 04:32:09 +00:00
< p class = "m-2 ml-4 text-sm" > {{ $.locale.Tr "gist.revision.empty-file" }}< / p >
2023-03-14 15:22:52 +00:00
{{ else }}
2023-03-23 02:12:21 +00:00
< table class = "code table-code w-full whitespace-pre" data-filename = "{{ $file.Filename }}" style = "font-size: 0.8em; border-spacing: 0" >
2023-03-14 15:22:52 +00:00
< tbody >
{{ $left := 0 }}
{{ $right := 0 }}
{{ range $line := split $file.Content "\n" }}
{{ if ne $line "" }}{{ if ne (index $line 0) 92 }}
{{ if eq (index $line 0) 64 }}
{{ $left = toInt (index (splitGit (index (split $line "-") 1)) 0) }}
{{ $right = toInt (index (splitGit (index (split $line "+") 1)) 0) }}
{{ end }}
< tr class = "{{ if eq (index $line 0) 64 }}gray-diff{{ end }}{{ if eq (index $line 0) 43 }}green-diff{{ end }}{{ if eq (index $line 0) 45 }}red-diff{{ end }}" >
{{ if eq (index $line 0) 64 }}
< td colspan = "2" class = "select-none py-3" > < / td >
{{ else }}
{{ if eq (index $line 0) 43 }}
< td class = "select-none line-num px-2" > < / td >
< td class = "select-none line-num px-2" > {{ $right }}< / td >
{{ $right = inc $right }}
{{ else if eq (index $line 0) 45 }}
< td class = "select-none line-num px-2" > {{ $left }}< / td >
< td class = "select-none line-num px-2" > < / td >
{{ $left = inc $left }}
{{ else if eq (index $line 0) 32 }}
< td class = "select-none line-num px-2" > {{ $left }}< / td >
< td class = "select-none line-num px-2" > {{ $right }}< / td >
{{ $left = inc $left }}
{{ $right = inc $right }}
{{ end }}
{{ end }}
< td class = "select-none" style = "width: 2%;" > {{ if ne (index $line 0) 64 }}{{ slice $line 0 1 }}{{ end }}< / td >
< td > {{ if ne (index $line 0) 64 }}{{ slice $line 1 }}{{ else }}{{ $line }}{{ end }}< / td >
< / tr >
{{end}}
{{end}}{{end}}
< / tbody >
< / table >
{{ end }}
< / div >
< / div >
{{end}}
{{else}}
2023-09-29 04:32:09 +00:00
< p class = "text-left text-sm text-slate-700 dark:text-slate-300 italic" > {{ $.locale.Tr "gist.revision.no-changes" }}< / p >
2023-03-14 15:22:52 +00:00
{{end}}
< / div >
< / div >
{{end}}
< / div >
< div class = "flex justify-center space-x-2" >
{{ template "pagination" . }}
< / div >
{{ else }}
< div class = "text-center" >
2023-05-27 11:58:08 +00:00
< svg xmlns = "http://www.w3.org/2000/svg" class = "mx-auto h-12 w-12 text-slate-600 dark:text-slate-400" fill = "none" viewBox = "0 0 24 24" stroke = "currentColor" stroke-width = "2" >
2023-03-14 15:22:52 +00:00
< path stroke-linecap = "round" stroke-linejoin = "round" d = "M14 10l-2 1m0 0l-2-1m2 1v2.5M20 7l-2 1m2-1l-2-1m2 1v2.5M14 4l-2-1-2 1M4 7l2-1M4 7l2 1M4 7v2.5M12 21l-2-1m2 1l2-1m-2 1v-2.5M6 18l-2-1v-2.5M18 18l2-1v-2.5" / >
< / svg >
2023-09-22 15:26:09 +00:00
< h3 class = "mt-2 text-sm font-medium text-slate-700 dark:text-slate-300" > {{ .locale.Tr "gist.revision.no-revisions" }}< / h3 >
2023-03-14 15:22:52 +00:00
< / div >
{{ end }}
{{ template "gist_footer" .}}
{{ template "footer" .}}