From 9d31c5959c037056d0a64ff9154b4f2d5fa58f18 Mon Sep 17 00:00:00 2001 From: Gerben Date: Wed, 21 Mar 2018 18:03:57 +0100 Subject: [PATCH] Add original repo/view_{file,list}.tmpl --- templates/repo/view_file.tmpl | 90 ++++++++++++++++++++++++++++++++++ templates/repo/view_list.tmpl | 91 +++++++++++++++++++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 templates/repo/view_file.tmpl create mode 100644 templates/repo/view_list.tmpl diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl new file mode 100644 index 0000000..6c37aab --- /dev/null +++ b/templates/repo/view_file.tmpl @@ -0,0 +1,90 @@ +
+

+
+
+ {{if .ReadmeExist}} + + {{if .ReadmeInList}} + {{.FileName}} + {{else}} + {{.FileName}} {{FileSize .FileSize}}{{if .IsLFSFile}} ({{.i18n.Tr "repo.stored_lfs"}}){{end}} + {{end}} + {{else}} + + {{.FileName}} {{FileSize .FileSize}}{{if .IsLFSFile}} ({{.i18n.Tr "repo.stored_lfs"}}){{end}} + {{end}} +
+
+ {{if not .ReadmeInList}} +
+ + {{if .Repository.CanEnableEditor}} + {{if .CanEditFile}} + + {{else}} + + {{end}} + {{if .CanDeleteFile}} + + {{else}} + + {{end}} + {{end}} +
+ {{end}} +
+
+

+
+
+ {{if .IsMarkup}} + {{if .FileContent}}{{.FileContent | Safe}}{{end}} + {{else if .IsRenderedHTML}} +
{{if .FileContent}}{{.FileContent | Str2html}}{{end}}
+ {{else if not .IsTextFile}} +
+ {{if .IsImageFile}} + + {{else if .IsVideoFile}} + + {{else if .IsPDFFile}} + + {{else}} + {{.i18n.Tr "repo.file_view_raw"}} + {{end}} +
+ {{else if .FileSize}} + + + + {{if .IsFileTooLarge}} + + {{else}} + + + {{end}} + + +
{{.i18n.Tr "repo.file_too_large"}}{{.LineNums}}
    {{.FileContent}}
+ {{end}} +
+
+
+ + diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl new file mode 100644 index 0000000..34c76fc --- /dev/null +++ b/templates/repo/view_list.tmpl @@ -0,0 +1,91 @@ + + + + + + + + + + {{if .HasParentPath}} + + + + {{end}} + {{range $item := .Files}} + {{$entry := index $item 0}} + {{$commit := index $item 1}} + + {{if $entry.IsSubModule}} + + {{else}} + + {{end}} + + + + {{end}} + +
+ {{if .LatestCommitUser}} + + {{if .LatestCommitUser.FullName}} + {{.LatestCommitUser.FullName}} + {{else}} + {{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}} + {{end}} + {{else}} + {{if .LatestCommit.Author}} + + {{.LatestCommit.Author.Name}} + {{end}} + {{end}} + + {{ShortSha .LatestCommit.ID.String}} + {{if .LatestCommit.Signature}} +
+ {{if .LatestCommitVerification.Verified}} + + {{else}} + + {{end}} +
+ {{end}} +
+ {{RenderCommitMessage .LatestCommit.Summary .RepoLink $.Repository.ComposeMetas}} + {{if IsMultilineCommitMessage .LatestCommit.Message}} + + + {{end}} + {{template "repo/commit_status" .LatestCommitStatus}} +
+ {{if .LatestCommit.Author}}{{TimeSince .LatestCommit.Author.When $.Lang}}{{end}}
..
+ + {{$refURL := $commit.RefURL AppUrl $.BranchLink}} + {{if $refURL}} + {{$entry.Name}} @ {{ShortSha $commit.RefID}} + {{else}} + {{$entry.Name}} @ {{ShortSha $commit.RefID}} + {{end}} + + {{if $entry.IsDir}} + {{$subJumpablePathName := $entry.GetSubJumpablePathName}} + {{$subJumpablePath := SubJumpablePath $subJumpablePathName}} + + + {{if eq (len $subJumpablePath) 2}} + {{index $subJumpablePath 0}}{{index $subJumpablePath 1}} + {{else}} + {{index $subJumpablePath 0}} + {{end}} + + {{else}} + + {{$entry.Name}} + {{end}} + + {{RenderCommitMessageLink $commit.Summary $.RepoLink (print $.RepoLink "/commit/" $commit.ID) $.Repository.ComposeMetas}} + {{TimeSince $commit.Committer.When $.Lang}}
+{{if .ReadmeExist}} + {{template "repo/view_file" .}} +{{end}}